vdr  2.2.0
videodir.h
Go to the documentation of this file.
1 /*
2  * videodir.h: Functions to maintain the video directory
3  *
4  * See the main source file 'vdr.c' for copyright information and
5  * how to reach the author.
6  *
7  * $Id: videodir.h 3.2 2013/10/11 09:37:48 kls Exp $
8  */
9 
10 #ifndef __VIDEODIR_H
11 #define __VIDEODIR_H
12 
13 #include <stdlib.h>
14 #include "tools.h"
15 
17 private:
18  static cString name;
20  static cVideoDirectory *Current(void);
21 public:
22  cVideoDirectory(void);
23  virtual ~cVideoDirectory();
24  virtual int FreeMB(int *UsedMB = NULL);
28  virtual bool Register(const char *FileName);
39  virtual bool Rename(const char *OldName, const char *NewName);
46  virtual bool Move(const char *FromName, const char *ToName);
52  virtual bool Remove(const char *Name);
57  virtual void Cleanup(const char *IgnoreFiles[] = NULL);
63  virtual bool Contains(const char *Name);
72  static const char *Name(void);
73  static void SetName(const char *Name);
74  static void Destroy(void);
75  static cUnbufferedFile *OpenVideoFile(const char *FileName, int Flags);
76  static bool RenameVideoFile(const char *OldName, const char *NewName);
77  static bool MoveVideoFile(const char *FromName, const char *ToName);
78  static bool RemoveVideoFile(const char *FileName);
79  static bool VideoFileSpaceAvailable(int SizeMB);
80  static int VideoDiskSpace(int *FreeMB = NULL, int *UsedMB = NULL); // returns the used disk space in percent
81  static cString PrefixVideoFileName(const char *FileName, char Prefix);
82  static void RemoveEmptyVideoDirectories(const char *IgnoreFiles[] = NULL);
83  static bool IsOnVideoDirectoryFileSystem(const char *FileName);
84  };
85 
87 private:
88  static int state;
89  static time_t lastChecked;
90  static int usedPercent;
91  static int freeMB;
92  static int freeMinutes;
93 public:
94  static bool HasChanged(int &State);
100  static void ForceCheck(void) { lastChecked = 0; }
105  static cString String(void);
111  static int UsedPercent(void) { return usedPercent; }
114  static int FreeMB(void) { return freeMB; }
117  static int FreeMinutes(void) { return freeMinutes; }
122  };
123 
124 #endif //__VIDEODIR_H
static bool RenameVideoFile(const char *OldName, const char *NewName)
Definition: videodir.c:120
static int usedPercent
Definition: videodir.h:90
virtual ~cVideoDirectory()
Definition: videodir.c:31
static cVideoDirectory * current
Definition: videodir.h:19
virtual bool Move(const char *FromName, const char *ToName)
Moves the directory FromName to the location ToName.
Definition: videodir.c:84
static cString name
Definition: videodir.h:18
virtual bool Contains(const char *Name)
Checks whether the directory Name is on the same file system as the video directory.
Definition: videodir.c:108
static bool VideoFileSpaceAvailable(int SizeMB)
Definition: videodir.c:135
cUnbufferedFile is used for large files that are mainly written or read in a streaming manner...
Definition: tools.h:418
virtual bool Remove(const char *Name)
Removes the directory with the given Name and everything it contains.
Definition: videodir.c:98
static cUnbufferedFile * OpenVideoFile(const char *FileName, int Flags)
Definition: videodir.c:113
static cString PrefixVideoFileName(const char *FileName, char Prefix)
Definition: videodir.c:156
virtual bool Register(const char *FileName)
By default VDR assumes that the video directory consists of one large volume, on which it can store i...
Definition: videodir.c:63
static const char * Name(void)
Definition: videodir.c:53
static void Destroy(void)
Definition: videodir.c:43
static void RemoveEmptyVideoDirectories(const char *IgnoreFiles[]=NULL)
Definition: videodir.c:176
virtual bool Rename(const char *OldName, const char *NewName)
Renames the directory OldName to NewName.
Definition: videodir.c:74
static void SetName(const char *Name)
Definition: videodir.c:58
virtual int FreeMB(int *UsedMB=NULL)
Returns the total amount (in MB) of free disk space for recording.
Definition: videodir.c:48
static cVideoDirectory * Current(void)
Definition: videodir.c:36
static int freeMB
Definition: videodir.h:91
static int VideoDiskSpace(int *FreeMB=NULL, int *UsedMB=NULL)
Definition: videodir.c:140
static bool RemoveVideoFile(const char *FileName)
Definition: videodir.c:130
cVideoDirectory(void)
Definition: videodir.c:25
static int state
Definition: videodir.h:88
static bool MoveVideoFile(const char *FromName, const char *ToName)
Definition: videodir.c:125
static bool IsOnVideoDirectoryFileSystem(const char *FileName)
Definition: videodir.c:181
virtual void Cleanup(const char *IgnoreFiles[]=NULL)
Recursively removes all empty directories under the video directory.
Definition: videodir.c:103
static int FreeMinutes(void)
Returns the number of minutes that can still be recorded on the video disk.
Definition: videodir.h:117
static void ForceCheck(void)
To avoid unnecessary load, the video disk usage is only actually checked every DISKSPACECHEK seconds...
Definition: videodir.h:100
static int freeMinutes
Definition: videodir.h:92
static time_t lastChecked
Definition: videodir.h:89
Definition: tools.h:168
static int FreeMB(void)
Returns the amount of free space on the video disk in MB.
Definition: videodir.h:114
static int UsedPercent(void)
Returns the used space of the video disk in percent.
Definition: videodir.h:111