Saturday, August 25, 2012

Integrating Mythtv and Plex/XBMC

There is not native Mythtv support in Plex as of the writing of this blog post.  However, Plex contains xbmc code that can play Mythtv's transcoded .nuv NuppelVideo files. I transcode mpeg2 files to nuv to save on disk space.  XBMC has mythtv integration but scanning of tv shows doesn't always work and it's sometimes days or weeks behind in updating the tv shows and episodes.

Mythtv also does not name the files in a format that plex and xbmc scrapers can use to help identify the episode.  Hell On Wheels.s02e02.mpg looks something like 5066_20120825091500.nuv on the mythtv side.


The recipe for integration calls for:

MythicalLibrarian - http://code.google.com/p/mythicallibrarian/
SMB/CIFS share of your mythtv recordings or where you link your mythtv recordings via MythicalLibrarian.



Follow the instructions for downloading and installing MythicalLibrarian on the following site: http://wiki.xbmc.org/?title=MythicalLibrarian


Easy installation:

sudo apt-get install curl && mkdir ~/.mythicalLibrarian && mkdir ~/.mythicalLibrarian/mythicalSetup && cd ~/.mythicalLibrarian/mythicalSetup
curl http://mythicallibrarian.googlecode.com/svn/trunk/mythicalSetup.sh>./mythicalSetup.sh
sudo su
chmod +x ./mythicalSetup.sh && ./mythicalSetup.sh


I made 3 modifications to the default settings in the file.

I set the MoveDir= to a directory where I would make a samba share just for mythtv linked recordings.

I set  the SYMLINK=LINK  to symbolically link the nuv to the mpeg file created by the mythicalLibrarian script.

I also added the ip addresses of my xbmc frontends in the XBMCIPs=( '192.168.x.x:8080') section.


When the script finished it will add a user job to mythtv to automatically run for new recording schedules. A few modifications will be needed to modify existing recording schedules.  I'll show you how to do that shortly.

I had years of recordings that I needed to scan and identify so I let the script run over 3 days to identify all my shows in a format the plex and xbmc could understand.

mythicalLibrarian --scan nuv /home/mythtv/Videos


Once that was complete I added the following share to my samba configuration file.  (/etc/samba/smb.conf for me in linux) and restarted samba for it to take effect.

[Tv]
        comment = Tv
        path = /home/mythtv/Videos
        writeable = yes
        browseable = yes
        create mask = 0775
        force create mode = 0664
        directory mask = 0775
        force directory mode = 0775


sudo service smb restart


I added the directory /home/mythtv/Videos as a tv source in both Plex and XBMC.  They will both need some time to scan and also identify the files in their own way.

The recording now looks like this:

Hell on Wheels S02E02 (Durant, Nebraska).nuv -> /mnt/tv/5066_20120825091500.nuv



How do update your mythtv recording schedules to use the mythicalLibrarian scripts

You'll need to use mysql to update the database.  You setup may be different.


mysql -umythtv -pmythtv mythconverg
update record set autouserjob1=1 where autouserjob1=0;


That should update your recording schedule to use mythicalLibrarian to run after the recording has ended.

This will work where mythicalLibrarian is setup as userjob 1.   Modify the job number to meet your setup.


Post a Comment