MythTV and Plex

For discussion related to MythTV which doesn't belong in another forum.

Moderator: Forum Moderators

Post Reply
drjdmartin
Newcomer
Posts: 11
Joined: Wed Jul 29, 2020 7:32 am
Great Britain

MythTV and Plex

Post by drjdmartin » Mon Aug 03, 2020 1:37 pm

Hi,

I've been trying to find a good way of getting mythtv recorded media into Plex readable format so I can watch it on all my devices. I couldn't quite find exactly what I wanted so I'm posting the following in case it is useful. The below bash script uses the provided mythlink.pl script to create links in a decent format for TV Shows in a TV directory (any movies seem to fail to get loaded due to missing season numbers which is fine), then it generates a different set of links in a Movie directory and removes any directories without a decent year attached which seems to tidy up the TV Shows which otherwise would clutter up Plex.

My directories are in /mnt/mythtv/ as per below:

Code: Select all

#!/bin/bash
/usr/share/doc/mythtv-backend/contrib/user_jobs/mythlink.pl --link /mnt/mythtv/TV Shows/ --format '%T/Season %ss/%T-S%ssE%ep-%S'
/usr/share/doc/mythtv-backend/contrib/user_jobs/mythlink.pl --link /mnt/mythtv/Movies/ --format '%T (%oY)/%T (%oY)'
find /mnt/mythtv/Movies/ -type d -name '*(0000)*' -exec rm -r {} \; -prune
Let me know if anyone finds a better way to do it or spots any problems!

Thanks,

James

LinuxGeek28
Newcomer
Posts: 6
Joined: Mon Dec 24, 2018 4:55 pm
United States of America

Re: MythTV and Plex

Post by LinuxGeek28 » Mon Aug 03, 2020 2:34 pm

I use the MythTV android client when I am at home and use Plex to watch my MythTV recordings when I am traveling. My method is similar, but I pre-pend all the titles with YYYYMMDD-title that way I can sort my recordings to easily show my most recent. I do lose the metadata feature of Plex, but that doesent matter for how I use it.

drjdmartin
Newcomer
Posts: 11
Joined: Wed Jul 29, 2020 7:32 am
Great Britain

Re: MythTV and Plex

Post by drjdmartin » Sun Sep 13, 2020 8:19 am

A thing that wasn't quite working was for movies with multiple parts - e.g. those recorded on channels that put a news program or other annoying piece in the middle of a movie showing. The mythlinks script seems to label the first part with a .2 and plex doesn't really understand that the 2 parts are for the same movie. So I wrote another script to deal with this occurrence.

Code: Select all

#!/bin/bash
# Find movies with 2 parts and output the file list to a text file
find /mnt/mythtv/Movies/ -name '*.2.ts' > files.txt
cat ~/files.txt | while read i; do
   # Move the file with a .2. in it to be pt1
   mv "$i" "${i//.2/-pt1}"
   # Move the other file to be pt2
   mv "${i//.2/}" "${i//.2/-pt2}"
done

Post Reply