[mythtv-commits] Ticket #7731: Delay file deletion in mythtranscode

MythTV mythtv at cvs.mythtv.org
Sun Dec 13 22:29:02 UTC 2009

#7731: Delay file deletion in mythtranscode
 Reporter:  stichnot@…              |       Owner:  ijr    
     Type:  patch                   |      Status:  new    
 Priority:  minor                   |   Milestone:  unknown
Component:  MythTV - Mythtranscode  |     Version:  unknown
 Severity:  medium                  |     Mlocked:  0      

Comment(by stichnot@…):

 At Mike Dean's challenge, I updated the patch to also do something
 sensible with an existing bookmark when a cutlist is present, rather than
 just clearing it.  Computing the bookmark for the new file based on the
 old file's bookmark and cutlist is straightforward.  Things are somewhat
 complicated when a bookmark is updated while mythtranscode is waiting to
 delete the original file, because it may be hard to know whether the
 bookmark was set with respect to the old or the new file.

 Here is how it works at a high level:

 1. There was existing code that updates the recordedmarkup table to remove
 commflag and cutlist marks.  This has been moved to a point before the
 original recording file is deleted, so that if a new playback instance is
 started on the new file while waiting to delete the old file, the new
 playback instance won't have the old cutlist.  (An old playback instance
 will consequently have its cutlist removed, but that's preferable to
 having a bogus cutlist for a new playback instance.)

 2. Before waiting for old playback instances to exit, reload the bookmark
 (since it might have changed during the several minutes transcoding takes)
 and update with the translated value so that new playback instances have
 the right bookmark.

 3. Take an initial timestamp, then periodically (every 10 seconds in this
 code) check the inuseprograms table for any 'playback' records that were
 updated before the initial timestamp.  If there are any, we need to keep
 waiting.  When there are none, we can finally delete the old file.

 4. Reload the bookmark.  If it has changed since step 2, translate it
 again and write it back.  (Unfortunately, the new bookmark could be from a
 new playback instance in which case it shouldn't be translated, but
 there's not much we can do when both the old and the new files are in

Ticket URL: <http://svn.mythtv.org/trac/ticket/7731#comment:1>
MythTV <http://www.mythtv.org/>

More information about the mythtv-commits mailing list