summaryrefslogtreecommitdiff
path: root/videodir.h
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2012-04-23 09:07:55 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2012-04-23 09:07:55 +0200
commit3d32b07862aff8de213e999f27eaf9082696ec01 (patch)
tree89a8261b475654df3cce58b81743ecc451aab448 /videodir.h
parent09e58657a1abc2dcebf1761c5c2406f3b4a4345f (diff)
downloadvdr-3d32b07862aff8de213e999f27eaf9082696ec01.tar.gz
vdr-3d32b07862aff8de213e999f27eaf9082696ec01.tar.bz2
The disk usage is no longer automatically added to the title of the main and "Recordings" menus
Diffstat (limited to 'videodir.h')
-rw-r--r--videodir.h40
1 files changed, 39 insertions, 1 deletions
diff --git a/videodir.h b/videodir.h
index 253e07b0..0a0587a6 100644
--- a/videodir.h
+++ b/videodir.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: videodir.h 1.7 2008/02/16 12:53:11 kls Exp $
+ * $Id: videodir.h 2.1 2012/04/22 15:07:56 kls Exp $
*/
#ifndef __VIDEODIR_H
@@ -25,4 +25,42 @@ cString PrefixVideoFileName(const char *FileName, char Prefix);
void RemoveEmptyVideoDirectories(void);
bool IsOnVideoDirectoryFileSystem(const char *FileName);
+class cVideoDiskUsage {
+private:
+ static int state;
+ static time_t lastChecked;
+ static int usedPercent;
+ static int freeMB;
+ static int freeMinutes;
+public:
+ static bool HasChanged(int &State);
+ ///< Returns true if the usage of the video disk space has changed since the last
+ ///< call to this function with the given State variable. The caller should
+ ///< initialize State to -1, and it will be set to the current internal state
+ ///< value of the video disk usage checker upon return. Future calls with the same
+ ///< State variable can then quickly check for changes.
+ static void ForceCheck(void) { lastChecked = 0; }
+ ///< To avoid unnecessary load, the video disk usage is only actually checked
+ ///< every DISKSPACECHEK seconds. Calling ForceCheck() makes sure that the next call
+ ///< to HasChanged() will check the disk usage immediately. This is useful in case
+ ///< some files have been deleted and the result shall be displayed instantly.
+ static cString String(void);
+ ///< Returns a localized string of the form "Disk nn% - hh:mm free".
+ ///< This function is mainly for use in skins that want to retain the display of the
+ ///< free disk space in the menu title, as was the case until VDR version 1.7.27.
+ ///< An implicit call to HasChanged() is done in this function, to make sure the
+ ///< returned value is up to date.
+ static int UsedPercent(void) { return usedPercent; }
+ ///< Returns the used space of the video disk in percent.
+ ///< The caller should call HasChanged() first, to make sure the value is up to date.
+ static int FreeMB(void) { return freeMB; }
+ ///< Returns the amount of free space on the video disk in MB.
+ ///< The caller should call HasChanged() first, to make sure the value is up to date.
+ static int FreeMinutes(void) { return freeMinutes; }
+ ///< Returns the number of minutes that can still be recorded on the video disk.
+ ///< This is an estimate and depends on the data rate of the existing recordings.
+ ///< There is no guarantee that this value will actually be met.
+ ///< The caller should call HasChanged() first, to make sure the value is up to date.
+ };
+
#endif //__VIDEODIR_H