Go to the documentation of this file.
73 if (strstr(FileName,
Name()) != FileName) {
83 dsyslog(
"renaming '%s' to '%s'", OldName, NewName);
84 if (rename(OldName, NewName) == -1) {
93 dsyslog(
"moving '%s' to '%s'", FromName, ToName);
95 if (rename(FromName, ToName) == -1) {
157 int deleted = DeletedRecordings->TotalFileSizeMB();
166 return (free + used) ? round(
double(used) * 100 / (free + used)) : 0;
171 char PrefixedName[strlen(FileName) + 2];
173 const char *p = FileName + strlen(FileName);
175 while (p-- > FileName && n > 0) {
178 int l = p - FileName + 1;
179 strncpy(PrefixedName, FileName, l);
180 PrefixedName[l] = Prefix;
181 strcpy(PrefixedName + l + 1, p + 1);
201 #define DISKSPACECHEK 5 // seconds between disk space checks
202 #define MB_PER_MINUTE 25.75 // this is just an estimate!
219 double MBperMinute = Recordings->MBperMinute();
220 if (MBperMinute <= 0)
227 if (State !=
state) {
static cString sprintf(const char *fmt,...) __attribute__((format(printf
static void SetName(const char *Name)
cRecordingsHandler RecordingsHandler
static bool MoveVideoFile(const char *FromName, const char *ToName)
virtual bool Remove(const char *Name)
Removes the directory with the given Name and everything it contains.
static const char * Name(void)
static bool IsOnVideoDirectoryFileSystem(const char *FileName)
#define LOCK_DELETEDRECORDINGS_READ
bool Add(int Usage, const char *FileNameSrc, const char *FileNameDst=NULL)
Adds the given FileNameSrc to the recordings handler for (later) processing.
static bool HasChanged(int &State)
Returns true if the usage of the video disk space has changed since the last call to this function wi...
static bool VideoFileSpaceAvailable(int SizeMB)
static bool RenameVideoFile(const char *OldName, const char *NewName)
virtual ~cVideoDirectory()
virtual int FreeMB(int *UsedMB=NULL)
Returns the total amount (in MB) of free disk space for recording.
#define LOCK_RECORDINGS_READ
virtual bool Move(const char *FromName, const char *ToName)
Moves the directory FromName to the location ToName.
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...
cUnbufferedFile is used for large files that are mainly written or read in a streaming manner,...
static void InvokeCommand(const char *State, const char *RecordingFileName, const char *SourceFileName=NULL)
static cString String(void)
Returns a localized string of the form "Disk nn% - hh:mm free".
static int FreeMB(void)
Returns the amount of free space on the video disk in MB.
virtual bool Contains(const char *Name)
Checks whether the directory Name is on the same file system as the video directory.
static int UsedPercent(void)
Returns the used space of the video disk in percent.
static int VideoDiskSpace(int *FreeMB=NULL, int *UsedMB=NULL)
static bool RemoveVideoFile(const char *FileName)
static cUnbufferedFile * OpenVideoFile(const char *FileName, int Flags)
virtual bool Rename(const char *OldName, const char *NewName)
Renames the directory OldName to NewName.
static cUnbufferedFile * Create(const char *FileName, int Flags, mode_t Mode=DEFFILEMODE)
#define RUC_RENAMEDRECORDING
virtual void Cleanup(const char *IgnoreFiles[]=NULL)
Recursively removes all empty directories under the video directory.
#define RUC_MOVEDRECORDING
static void RemoveEmptyVideoDirectories(const char *IgnoreFiles[]=NULL)
static cVideoDirectory * current
static time_t lastChecked
static cVideoDirectory * Current(void)
static cString PrefixVideoFileName(const char *FileName, char Prefix)
static void Destroy(void)