[mythtv] Re: [mythtv-commits] Ticket #857: Patch to mythrename.pl to work correctly with slave backends

Michael T. Dean mtdean at thirdcontact.com
Thu Dec 22 21:11:49 EST 2005

Tom Lichti wrote:

> Michael T. Dean wrote:
>> MythTV wrote:
>>> #857: Patch to mythrename.pl to work correctly with slave backends
>>> -------------------------------------+-------------------------------------- 
>>> Reporter:  tom at redpepperracing.com  |       Owner:  ijr     Type:  
>>> patch                    |      Status:  new Priority:  
>>> minor                    |   Milestone:      Component:  
>>> mythtv                   |     Version:  head
>>> Severity:  low                      |  
>>> -------------------------------------+-------------------------------------- 
>>> This small patch updates mythrename.pl to use the hostname when 
>>> deciding
>>> what records to process. I only use the --link option, so further 
>>> testing
>>> may be required. 
>> If you check for hostname with the query, we won't get links to 
>> recordings recorded on other backends, even if the file exists on the 
>> filesystem (i.e. multiple backends share a recordings directory using 
>> NFS).  Since mythrename.pl checks for the existence of the file 
>> before creating the link, we shouldn't need to do this check.  As is, 
>> we (should) only get links to recordings that are available through 
>> the filesystem and recordings whose filies are not available are 
>> (should be) ignored.
>> If there's a specific problem/error you're trying to fix, more info 
>> would be nice...  :) 
> Hrm. Well, in my case, using the --link option on both my master and 
> slave backends creates the same links on both, so something isn't 
> working. I'll see if I can narrow it down some more. At a quick 
> glance, I don't see where the check for the file existence is being 
> done, but I'm no perl expert. 

Hrmmm.  It seems that mythlink.sh had it, but mythlink.pl (which 
eventually became mythrename.pl) never got it...

So, how's this?  It should also make for many less "restores" after 
rename fails on inaccessible files...  Good catch.

If it works, you can post it on your ticket as a replacement for your 
patch (since this should meet both our expectations :).

Thanks (and, thanks especially for noticing my reply on the list instead 
of only watching the ticket),
-------------- next part --------------
Index: contrib/mythrename.pl
--- contrib/mythrename.pl	(revision 8364)
+++ contrib/mythrename.pl	(working copy)
@@ -244,6 +244,7 @@
     while (my $ref = $sh->fetchrow_hashref()) {
         my %info = %{$ref};
         die "This script requires mythtv >= 0.19\n" unless ($info{'basename'});
+        next unless (-e "$video_dir/".$info{'basename'});
     # Default times
         my ($syear, $smonth, $sday, $shour, $sminute, $ssecond) = $info{'starttime'} =~ /(\d+)-(\d+)-(\d+)\s+(\d+):(\d+):(\d+)/;
         my ($eyear, $emonth, $eday, $ehour, $eminute, $esecond) = $info{'endtime'}   =~ /(\d+)-(\d+)-(\d+)\s+(\d+):(\d+):(\d+)/;

More information about the mythtv-dev mailing list