[mythtv-users] add season and episode number to mythlink.pl

Andre Ross andre.ross at sbcglobal.net
Thu Jan 3 01:41:56 UTC 2013


Matt 


Thanks for the heads up for a quick way of finding dead symlinks 


Thanks,
Andre


________________________________
From: Matt Emmott <memmott at gmail.com>
To: Andre Ross <andre.ross at sbcglobal.net>; Discussion about MythTV <mythtv-users at mythtv.org> 
Sent: Sunday, December 30, 2012 8:36 PM
Subject: Re: [mythtv-users] add season and episode number to mythlink.pl







On Fri, Dec 28, 2012 at 12:33 PM, Andre Ross <andre.ross at sbcglobal.net> wrote:

Matt
>
>That is one of the reasons I use this script its because I use Mythtv and Plex.
>I forgot to put the comment start of hack, the start of the hack is the below comments in the script mythlink.pl
>
>
>
>#######################################################
>#
># find this statment and place hack after my $name =
>#
>
>#
>
># end of hack
>########################################################
>
>Make sure you run the script on the backend if the frontend/backend are not on the same system.
>If you run it from the command line, you have to make sure that the user that runs the script under has access mythtv.
>remember if you run the command as root the symlinks will be owned by root.
>
>On my system the recording are located:
>/var/lib/mythtv/recordings/
>
>With a names like:
>1206_20121204042900.mpg
>
>So you got the format right leaving off the file name create symlinks of all your recordings.
>
>
>2) How would I run this manually to test? Would it be
>mythlink.pl
> --link "/destination/of/symlink" --filename "/myfilename.mpg" --format
>"%T/Season %qs2/%T-S%qs2E%qe2-%S" --separator "#"
>
>And if I wanted to run it once against all the recordings in that directory, just leave off the filename argument:
>mythlink.pl --link "/destination/of/symlinks" --format "%T/Season %qs2/%T-S%qs2E%qe2-%S" --separator "#"
>
>  
>

So, some updates:


First, I prefer to have all seasons of each recording dumped into their own folder rather than separating them by season 1, season 2 etc. I did this by running the following:

/mythlink.pl --link show_names/ --format "%T/%T-S%qs2E%qe2-%S" --separator "#"


And it's AWESOME. So much more usable so far than Mythical Librarian ever was. 


But I ran into a usability issue that may be of concern. From reading this on the mythlink.pl wiki page, I think your method will end up with a lot of dead symlinks:

"Note that when specifying --filename or --chanid and --starttime, deletion of old symlinks is suppressed."


It does say that running mythlink without those switches will blow away all old symlinks first, which at first glance sounds good. However, as i discovered, it recreates all the symlinks which means they all have new datestamps. This means that A) Plex has to re-index everything every time there's a refresh and B) The "Recently Added" sort option would never work (which I use constantly).


I did some digging and found that I could run the following to find and delete orphaned symlinks:

find /var/lib/mythtv/recordings/show_names/ -type l ! -exec test -e {} \; -exec rm {} \;


I'm going to do some more testing but I think using your user job and a cron job of the above find command might be a good way to go, and I can disable Mythical Librarian altogether.


More information about the mythtv-users mailing list