Opened 8 years ago

Last modified 2 years ago

#10325 accepted Patch - Feature

Modify mythlink.pl to allow relative file names to be used in the links

Reported by: Nick Martin <njm@…> Owned by: sphery
Priority: minor Milestone: unknown
Component: Contributed Scripts & Apps Version: 0.24-fixes
Severity: medium Keywords: mythlink.pl relative
Cc: Ticket locked: no

Description

This is useful if your links directory and recordings directory are both in a directory tree exported by an NFS server. Links to absolute file names will be broken in the NFS clients, but links to relative file names will be ok.

E.g., if /home is exported on an NFS server with the following dirs:

/home/nick/links
/home/mythtv/recordings

...and the exported /home is mounted by an NFS client at /mnt/mythtv, then

/mnt/mythtv/nick/links/Title.mpg -> /home/mythtv/recordings/1004_20111224115800.mpg is broken
/mnt/mythtv/nick/links/Title.mpg -> ../../mythtv/recordings/1004_20111224115800.mpg is ok

The attached patch adds a --relative option to allow relative file names to be used in the links created by mythlink.pl.

Attachments (1)

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

Download all attachments as: .zip

Change History (7)

Changed 8 years ago by Nick Martin <njm@…>

Attachment: mythlink.pl.patch added

comment:1 Changed 8 years ago by sphery

Owner: changed from xris to sphery
Status: newaccepted

comment:2 Changed 8 years ago by sphery

Component: Apps - NuvexportContributed Scripts & Apps

comment:3 Changed 7 years ago by mythtvorg@…

There is a bug in this patch!

The added line:

$local_path = File::Spec->abs2rel($local_path, $dest);

Should be:

$local_path = File::Spec->abs2rel($local_path, $dirname);

Because $name may be of form "tv_show/episode" in which case the final directory will be attached to $name and missing from $dest.

Luckily, the existing code defines already: my $directory = dirname("$dest/$name");

comment:4 in reply to:  3 Changed 7 years ago by justpaul@…

Replying to mythtvorg@…: The "should be":

$local_path = File::Spec->abs2rel($local_path, $dirname);

Should really be:

$local_path = File::Spec->abs2rel($local_path, $directory);

$dirname is undefined.

comment:5 Changed 7 years ago by mythtv@…

You are absolutely right! For some reason, I typo'd when copying over the code...

comment:6 Changed 2 years ago by sphery

Duplicate ticket/patch posted at #13115 . The implementation from the other ticket is at ​https://github.com/MythTV/mythtv/pull/149 .

Note: See TracTickets for help on using tickets.