[mythtv-users] mythrename.pl renames my .avi to .nuv

Christophe Zwecker doc at zwecker.de
Mon Jan 15 20:37:18 UTC 2007


>>
>>      # Figure out the suffix
>>          my $out    = `file -b $safe_file 2>/dev/null`;
>> #        my $suffix = ($out =~ /mpe?g/i) ? '.mpg' : '.nuv';
>>           my $suffix = ($out =~ /mpe?g$/i) ? '.mpg' : '.nuv';
>>           $suffix = ".avi" if ( $out =~ /\.avi$/i );
>>      # Link destination
>>
>> ---snip---
> 
> Looks like it should work to me. Try putting in a bunch of print  
> statements to track the values of the varaibles at each step and see  
> if you can tell where the extension is changed to .nuv.

uh ok I tried, I put it like this:

        # Get a shell-safe version of the filename (yes, I know it's not 
    needed in this case, but I'm anal about such things)
         my $safe_file = $info{'basename'};
         $safe_file =~ s/'/'\\''/sg;
         $safe_file = "'$safe_file'";
     # Figure out the suffix
         my $out    = `file -b $safe_file 2>/dev/null`;

  # Figure out the suffix
         my $out    = `file -b $safe_file 2>/dev/null`;
vprint ("filefound = $safe_file");
           my $suffix = ($out =~ /mpe?g$/i) ? '.mpg' : '.nuv';
            $suffix = ".avi" if ( $out =~ /\.avi$/i );
vprint ("Suffix = $suffix");

I ran mythrename.pl with verbose option:

filefound = '1 (1) - 2007-01-15, 7-25 PM - Mon Jan 15 19-24-00 2007.avi'
Suffix = .nuv
1 (1) - 2007-01-15, 7-25 PM - Mon Jan 15 19-24-00 2007.avi      -> 1 (1) 
- 2007-01-15, 7-25 PM - Mon Jan 15 19-24-00 2007.nuv


sorry im lost here, I dont see where the script gets the idea that its a 
nuv.
-- 
Christophe Zwecker
:Sysctl
Koppel 96
20099 Hamburg
phon: +49 40 41263790
  fax: +49 40 41263799
mail: czwecker at sysctl.de


More information about the mythtv-users mailing list