From 2ceb19e566c26a42b3d69244609772082f9a7997 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Thu, 6 Sep 2012 10:07:25 +0200 Subject: Fixed getting the file size and number of frames of ongoing recordings --- HISTORY | 5 ++++- recording.c | 6 +++--- recording.h | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/HISTORY b/HISTORY index 0eeec429..7381b546 100644 --- a/HISTORY +++ b/HISTORY @@ -7191,7 +7191,7 @@ Video Disk Recorder Revision History turn on adding the source character to channel names whenever they are displayed (suggested by Ludi Kaleni). -2012-09-05: Version 1.7.30 +2012-09-06: Version 1.7.30 - Fixed sorting recordings in the top level video directory. - Fixed handling control characters in SI data in case of UTF-8 encoded strings @@ -7223,3 +7223,6 @@ Video Disk Recorder Revision History given in the -v option if only -v and no -c is given. - Fixed a long delay at the end when replaying a recording that has stopped recording less than an hour ago (typically time shift mode or a freshly edited recording). +- Fixed getting the file size and number of frames of ongoing recordings (only the + timestamp of the recording's directory was checked, while it should have been that + of the index file). diff --git a/recording.c b/recording.c index de010440..9c80505e 100644 --- a/recording.c +++ b/recording.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: recording.c 2.59 2012/09/05 11:45:55 kls Exp $ + * $Id: recording.c 2.60 2012/09/06 09:57:31 kls Exp $ */ #include "recording.h" @@ -1067,7 +1067,7 @@ int cRecording::NumFrames(void) const { if (numFrames < 0) { int nf = cIndexFile::GetLength(FileName(), IsPesRecording()); - if (time(NULL) - LastModifiedTime(FileName()) < MININDEXAGE) + if (time(NULL) - LastModifiedTime(cIndexFile::IndexFileName(FileName(), IsPesRecording())) < MININDEXAGE) return nf; // check again later for ongoing recordings numFrames = nf; } @@ -1086,7 +1086,7 @@ int cRecording::FileSizeMB(void) const { if (fileSizeMB < 0) { int fs = DirSizeMB(FileName()); - if (time(NULL) - LastModifiedTime(FileName()) < MININDEXAGE) + if (time(NULL) - LastModifiedTime(cIndexFile::IndexFileName(FileName(), IsPesRecording())) < MININDEXAGE) return fs; // check again later for ongoing recordings fileSizeMB = fs; } diff --git a/recording.h b/recording.h index f08fd0b0..84a23b3b 100644 --- a/recording.h +++ b/recording.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: recording.h 2.35 2012/09/05 11:25:33 kls Exp $ + * $Id: recording.h 2.36 2012/09/06 09:59:11 kls Exp $ */ #ifndef __RECORDING_H @@ -280,7 +280,6 @@ private: static void AddToIndexList(const cIndexFile *IndexFile); static void RemoveFromIndexList(const cIndexFile *IndexFile); static bool IsInIndexList(const cIndexFile *IndexFile); - static cString IndexFileName(const char *FileName, bool IsPesRecording); void ConvertFromPes(tIndexTs *IndexTs, int Count); void ConvertToPes(tIndexTs *IndexTs, int Count); bool CatchUp(int Index = -1); @@ -300,6 +299,7 @@ public: static int GetLength(const char *FileName, bool IsPesRecording = false); ///< Calculates the recording length (number of frames) without actually reading the index file. ///< Returns -1 in case of error. + static cString IndexFileName(const char *FileName, bool IsPesRecording); }; class cFileName { -- cgit v1.2.3