[vdr] [Patch] Public access to cRecording::fileSizeMB

Klaus Schmidinger Klaus.Schmidinger at cadsoft.de
Mon Apr 17 10:41:01 CEST 2006


Udo Richter wrote:
> Hi Klaus,
> 
> The attached patch provides public access to cRecording::fileSizeMB by 
> adding a function cRecording::FileSizeMB(). The size is calculated if it 
> is still unknown.
> Please consider adding the patch to VDR. The patch shouldn't have any 
> negative side effects and might be useful to others.
> 
> Cheers,
> 
> Udo

You do realize that this will only work reliably for recordings
that have already been finished, right? An ongoing recording will
only tell you its size at the moment you call the function, and
will keep telling that size later on (until the next restart, or
until the /video/.update file has been touched and the list of
recordings has been refreshed). BTW: that's the reason why I did
not make this information public in the first place ;-)

Klaus

> ------------------------------------------------------------------------
> 
> --- vdr-1.3.46-orig/recording.h	2006-04-16 15:35:32.341839992 +0200
> +++ vdr-1.3.46/recording.h	2006-04-16 15:35:36.436217552 +0200
> @@ -87,6 +87,7 @@
>    const char *Title(char Delimiter = ' ', bool NewIndicator = false, int Level = -1) const;
>    const cRecordingInfo *Info(void) const { return info; }
>    const char *PrefixFileName(char Prefix);
> +  int FileSizeMB();
>    int HierarchyLevels(void) const;
>    void ResetResume(void) const;
>    bool IsNew(void) const { return GetResume() <= 0; }
> --- vdr-1.3.46-orig/recording.c	2006-04-16 15:35:28.444432488 +0200
> +++ vdr-1.3.46/recording.c	2006-04-16 15:35:40.708568056 +0200
> @@ -762,6 +762,13 @@
>    return NULL;
>  }
>  
> +int cRecording::FileSizeMB()
> +{
> +  if (fileSizeMB < 0)
> +     fileSizeMB = DirSizeMB(FileName());
> +  return fileSizeMB;
> +}
> +
>  int cRecording::HierarchyLevels(void) const
>  {
>    const char *s = name;



More information about the vdr mailing list