[mythtv-users] Plex integration.

myth tv mythtv at cain.id.au
Wed Mar 17 03:33:48 UTC 2021

> Has anyone wrote a script that will automatically create a link in the
> recordings folder (or any other folder for that matter) in such that
> it will be recognised with Plex?

I have setup scripts for mythlink to be triggered by system events
Recording deleted
Recording expired
Recording finished

I did this to keep the backend load down, because it just adds a
single link rather than doing a full mythlink scan of all recordings.
For the recording finished I create two directory structures.  That
way in Plex (although I've now changed to Jellyfin) I can use one
format for TV Shows and another for Movies.  Also note I create
categories for the recordings using recording groups (the %U).  This
is the way I separate Movies from TV Shows in both Mythtv and Plex.

Here is the main part of the scripts:

sleep 10
/usr/bin/ionice -c 3 /usr/bin/nice -n 19
--destination /tv/show_names/ --filename $1 --underscores --maxlength
120 --format "%U/%T/%Y-%m-%d %S S%ssE%ep"
sleep 2
/usr/bin/ionice -c 3 /usr/bin/nice -n 19
--destination /tv/show_names-movies/ --filename $1 --maxlength 120
--format "%U/%T/%T - %Y-%m-%d (%oY) %S"

For expired or finished I just search for missing links and delete them.
sleep 10
find /tv/show_names/ -xtype l -delete
find /tv/show_names-movies/ -xtype l -delete

More information about the mythtv-users mailing list