[mythtv-users] Using mythlink.pl in a system event.

Michael T. Dean mtdean at thirdcontact.com
Tue Feb 7 00:28:01 UTC 2012


On 02/06/2012 06:49 PM, Zarthan South wrote:
> I have mythlink.pl as a part of a userjob. It is suggested that you 
> can use mythlink.pl with "Recording deleted" and "Recording expired" 
> system events to just remove the deleted links. Can someone tell me 
> the format of the event entry.
> Would it be just
>     /path/to/mythlink --link /tv/shows --chanid --starttime ??

mythlink.pl, itself, cannot be used to remove individual symlinks.

What the wiki page ( http://www.mythtv.org/wiki/Mythlink.pl ) is trying 
to suggest is:
   a) when receiving a "Recording deleted" or "Recording expired" system 
event, just do a "full" run of mythlink.pl, which will delete all links 
in the link/destination directory, then create new links for all recordings
   b) when receiving a "Recording deleted" or "Recording expired" system 
event, run your own script that figures out which recording got deleted 
and deletes its symlink

Option b) isn't that difficult, as the name of the file should be 
<chanid>_<starttime>.<ext> (with the appropriate start time format), so 
you could do a long list of the directory/directories content and grep 
for the recording file name, then remove that link (possibly checking 
that the file it references is, in fact, no longer on the file system).  
Alternatively, you could just check every link in the

By the time the recording is deleted, though, we no longer have 
recording database metadata available to get a definitive file name from 
the database via the bindings.  This "uncertainty" and the fact that a 
"full run" of mythlink.pl nicely cleans up the links to the deleted 
recording(s) (and any other garbage/orphaned links) is the main reason 
that mythlink.pl doesn't try to handle "single link deletes" itself.

My recommendation is to just create a script to run mythlink.pl without 
--chanid/--starttime/--filename arguments and run it when you get a 
Recording deleted/expired event.  You could even do a simple "locking" 
mechanism for it (to ensure only one "full-run" copy of mythlink.pl is 
executed at a time and to allow "rolling up" multiple close-in-time 
requests into a single run).

Mike


More information about the mythtv-users mailing list