[mythtv-users] Plex integration
Michael T. Dean
mtdean at thirdcontact.com
Tue Jan 12 22:51:24 UTC 2016
On 01/12/2016 12:06 PM, Matt Emmott wrote:
> On Sat, Jan 2, 2016 at 8:44 AM, Michael T. Dean wrote:
>> No, as I said, the alternate option. To quote, again:
>> -----
>> Alternatively, you may use a script triggered on "Recording
>> deleted" and "Recording expired" to remove the specific link when its
>> recording is removed.
>> ---
>>
> I misunderstood what you meant by "alternate" option. I inferred that it
> you were referring to an option built into the script itself. But
> re-re-reading it, I see you're talking about using some sort of other
> script that is triggered by recording deleted or expired, which would
> delete just that one specific file.
Exactly.
> But I'm not smart enough to do anything
> outside of the norm, so I wouldn't know where to begin to write a script
> like that. I assume it would be some sort of simple for loop but I don't
> know how to input just that specific filename.
>
I don't know for sure when the system event for expiry is called (before
or after the file is gone); however since the delete will just change
the recording group to Deleted, the file will still exist. If this is
also the case for expiry, you should be able to just have the system
event pass the %FILE% , and then use something like:
find -L /path/to/symlink/dir -samefile /path/to/original.file
I don't know for sure if %FILE% includes the path, but if so, you're
golden. If not, you'll have to find which path the recording file is
in--you could do that any number of ways, but the easiest would just be
checking (i.e. with an "if [ -e /path/to/original.file ]" type
construct) each directory in each of your Storage Groups (even
hard-coded into the script).
If the expiry event is called after the file is gone (or if you just
want to do some occasional cleanup, in case something was missed), you
could just do:
find /path/to/symlink/dir -xtype l
(where that's an ell, as in link, after -xtype).
You can test your script with a -print at the end of your find commands
to see what was found. Once you feel comfortable, you could do -delete,
instead. Note, however, if you do an -xtype l test with -delete and you
happen to have some unmounted storage, you may delete links to valid
(yet unavailable) recordings.
Feel free to post something here, and I'm sure you could find some
others who would have fun testing and commenting and improving your
script, and you can put the script in the wiki where others could use
it, too.
https://www.mythtv.org/wiki/Category:Scripts
and/or
https://www.mythtv.org/wiki/Category:MythTV_System_Event_Scripts
Mike
More information about the mythtv-users
mailing list