Ticket #10325: mythlink.pl.patch

File mythlink.pl.patch, 1.8 KB (added by Nick Martin <njm@…>, 8 years ago)
  • mythlink.

    old new  
    1919    use File::Path;
    2020    use File::Basename;
    2121    use File::Find;
     22    use File::Spec;
    2223    use MythTV;
    2324
    2425# Some variables we'll use here
     
    2627    our ($chanid, $starttime, $filename);
    2728    our ($dformat, $dseparator, $dreplacement, $separator, $replacement);
    2829    our ($db_host, $db_user, $db_name, $db_pass, $video_dir, $verbose);
    29     our ($hostname, $dbh, $sh, $q, $count, $base_dir);
     30    our ($hostname, $dbh, $sh, $q, $count, $base_dir, $relative);
    3031
    3132# Default filename format
    3233    $dformat = '%T %- %Y-%m-%d, %g-%i %A %- %S';
     
    4849               'format=s'                     => \$format,
    4950               'live'                         => \$live,
    5051               'separator=s'                  => \$separator,
     52               'relative'                     => \$relative,
    5153               'replacement=s'                => \$replacement,
    5254               'rename'                       => \$rename,
    5355               'usage|help|h'                 => \$usage,
     
    215217
    216218    default:  No underscores
    217219
     220--relative
     221
     222    Use relative file names in the links.
     223
    218224--rename
    219225
    220226    Rename the recording files back to their default names.  If you had
     
    375381            mkpath($directory, 0, 0775)
    376382                or die "Failed to create $directory:  $!\n";
    377383        }
    378         symlink $show->{'local_path'}, "$dest/$name"
     384
     385        my $local_path = $show->{'local_path'};
     386        if ($relative) {
     387            $local_path = File::Spec->abs2rel($local_path, $dest);
     388        }
     389
     390        symlink $local_path, "$dest/$name"
    379391            or die "Can't create symlink $dest/$name:  $!\n";
    380392        vprint("$dest/$name");
    381393    }