AW: [vdr] Cleanup Thread (like .update)

Message ID 4DB53CB822%linux@youmustbejoking.demon.co.uk
State New
Headers

Commit Message

Darren Salt Oct. 5, 2005, 8:02 p.m. UTC
  I demand that hgm.bg may or may not have written...

> vdr-bounces@linuxtv.org wrote:
>>> #define REMOVECHECKDELTA 3600 // seconds between checks for removing
>>> deleted files
>> Experimental patch (compile-tested only) attached. It adjusts the removal
>> check scheduling so that removal occurs at (by default) 6 minutes after
>> deletion. There is a 1-minute minimum delay, and the delay is reset every
>> time a recording is marked for deletion.
>> This also gives you enough time to unmark a recording, either by renaming
>> it manually or by using an undelete plugin.

> Okay, i will try this, thx

It turns out that that one contained a stupid bug - it'd default to 54
minutes, not six. See attached.

(BTW, fix your subject prefix or we'll get long "Re: AW:" strings...)

Klaus: are you deliberately using > rather than >= in the removal time checks
in RemoveDeletedRecordings()?
  

Comments

HGM.bg \(GMX\) Oct. 5, 2005, 9:18 p.m. UTC | #1
Darren Salt wrote:

>> Okay, i will try this, thx
> 
> It turns out that that one contained a stupid bug - it'd default to
> 54 minutes, not six. See attached. 

Okay, i was already wondering :)
 
> (BTW, fix your subject prefix or we'll get long "Re: AW:" strings...)

Done... (And Yes there's a switch in Outlook for this :))
 
/hgm.bg
  

Patch

--- vdr-1.3.34~/recording.c
+++ vdr-1.3.34/recording.c
@@ -62,10 +62,10 @@ 
 bool VfatFileSystem = false;
 
 static cRecordings DeletedRecordings(true);
+static time_t LastRemoveCheck = 0;
 
 void RemoveDeletedRecordings(void)
 {
-  static time_t LastRemoveCheck = 0;
   if (LastRemoveCheck == 0) {
      DeletedRecordings.Update();
      LastRemoveCheck = time(NULL) - REMOVECHECKDELTA * 9 / 10;
@@ -743,6 +743,7 @@ 
         }
      isyslog("deleting recording %s", FileName());
      result = RenameVideoFile(FileName(), NewName);
+     LastRemoveCheck = time(NULL) - REMOVECHECKDELTA + max (60, REMOVECHECKDELTA / 10);
      }
   free(NewName);
   return result;