Getting rid of redundant resume.vdr files.

Message ID 431AD3C8.9030603@icem.com
State New
Headers

Commit Message

Carsten Koch Sept. 4, 2005, 11 a.m. UTC
  Carsten Koch wrote:
...
> 2) vdr's recordings scan is slowed down further by the fact that
>    VDR opens all resume.vdr files to see if the recording is rewound.
>    This problem can be greatly reduced by two steps:
>    a) Remove the resume.vdr file if it points to (almost) the
>       beginning of the file.

Attached is an updated version of my patch for VDR 1.3.31.


>    b) Never try to read it. If the directory entry is there,
>       with the above patch it can be assumed that the recording
>       is not rewound.
  

Patch

diff -ur vdr-1.3.31/recording.c vdr-1.3.31+DeleteResume/recording.c
--- vdr-1.3.31/recording.c	2005-08-13 16:00:48.000000000 +0200
+++ vdr-1.3.31+DeleteResume/recording.c	2005-09-04 12:51:07.766593688 +0200
@@ -199,13 +199,19 @@ 
 bool cResumeFile::Save(int Index)
 {
   if (fileName) {
-     int f = open(fileName, O_WRONLY | O_CREAT | O_TRUNC, DEFFILEMODE);
-     if (f >= 0) {
-        if (safe_write(f, &Index, sizeof(Index)) < 0)
-           LOG_ERROR_STR(fileName);
-        close(f);
-        return true;
-        }
+     if (Index / FRAMESPERSEC < 60) {
+        Delete();
+	return true;
+	}
+     else {
+ 	int f = open(fileName, O_WRONLY | O_CREAT | O_TRUNC, DEFFILEMODE);
+ 	if (f >= 0) {
+ 	   if (safe_write(f, &Index, sizeof(Index)) < 0)
+ 	      LOG_ERROR_STR(fileName);
+ 	   close(f);
+ 	   return true;
+ 	   }
+	}
      }
   return false;
 }