Getting rid of redundant resume.vdr files.

Message ID 4310ACE5.3030508@icem.com
State New
Headers

Commit Message

Carsten Koch Aug. 27, 2005, 6:11 p.m. UTC
  Carsten Koch wrote:
...
> Attached is an updated version of my patch for VDR 1.3.30.

at least now it is.  ;-)
  

Patch

diff -ru vdr-1.3.30/recording.c vdr-1.3.30+DeleteResume/recording.c
--- vdr-1.3.30/recording.c	2005-08-13 16:00:48.000000000 +0200
+++ vdr-1.3.30+DeleteResume/recording.c	2005-08-27 12:23:14.366571840 +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;
 }