Skip to content
joncl edited this page Sep 27, 2014 · 10 revisions

Welcome to myth2kodi!... A tool for turning Kodi into a frontend for ALL MythTV recordings!

This wiki is the main source of info to setup myth2kodi. For additional info, or to post questions/comments, please see this myth2kodi thread on the XBMC forum: http://forum.xbmc.org/showthread.php?tid=205009


Overview

Unfortunately, mythicalLibrarian or mythlink (both very nice tools) didn't work for me like I had hoped. Most of my MythTV recordings are kids' shows, and close to 1/2 out of ~750 or so don't get recognized as actual show/episodes (call them "Specials"), so they end up under Videos instead of all together under TV Shows in XBMC. Even worse, these "Specials" show up as just folder icons without any posters, fanarts, or banners. I came across another project for Plex called mythPlex (see thread, and GitHub repo) which inspired me to try and roll my own solution for XBMC (all the while learn Python along the way, nice!)

Objectives

Duplicate the navigation of recordings in MythTV as much as possible (my family is used to Mythfrontend which works well, so similar functionality would be good!). This means that ALL recordings, whether they be episodes (recognized by show and episode number) or "Specials" (unrecognized by either ttvdb or tmdb) need to all go under "TV Shows" and under THE SAME SERIES in XBMC! It's also very important that posters, fanart, and banners be correct and present just like in Mythfrontend (well most of them come in, so maybe we can even improve a little!)

  1. Show both episodes and "Specials" under the same common series, all under "TV Shows" in XBMC.
  2. Scrape show/episode metadata into local .nfo files so that XBMC can read everything in as "Local information only".
  3. Pull down posters, fanarts, and banners from TheTVDB or TheMovieDB depending on the inetref from MythTV.

What It Does

  1. Read the metadata for each recording stored in the MythTV backend database
  2. Create a directory and tvshow.nfo file for each series
  3. Scrape poster, fanart, and banner links from TTVDB or TMDB, and copy image files alongside tvshow.nfo for each series
  4. Create a symlink to the video file for each episode
  5. Create a nfo file for each episode alongside the video symlink with the same name
  6. Ability to add a single video by command line (useful to add as a Mythbackend user job when the recording finishes for each schedule
  7. Ability to cleanup symlinks, nfo files, and/or series directories when shows are deleted from MythTV (this is still TODO)

Download

myth2kodi is written in Python with help from PyCharm 3.4, tested with Python 2.7.3 in Ubuntu 12.04 running Mythbackend .27. You can find the latest myth2kodi right here on GitHub:

https://github.com/joncl/myth2kodi

Intial Setup

  1. Request for a TTVDB API key here: http://thetvdb.com/?tab=apiregister
  2. Request for a TMDB API key here: https://www.themoviedb.org/documentation/api
  3. Copy config.py and myth2kodi.py (from this GitHub repo) to your backend server here as root:
/usr/local/bin/myth2kodi
  1. Create a directory where symlinks to MythTV recordings will go, such as /pool/myth2kodi/recordings
  2. Create a separate directory to store TTVDB zip files (this is for caching the show/episode metadata zip files), such as /pool/myth2xbmc/ttvdb
  3. Set the ownership and permissions with something like this:
sudo chown mythtv:mythtv -R /pool/myth2kodi
sudo chmod +x -R /pool/myth2kodi
  1. Edit config.py to suite. Here's how mine looks:

config.py

# IP or hostname of your MythTV backend
hostname = "<ip or hostname>"

# Port number of your MythTV backend (this is the default, can probably leave as-is)
host_port = "6544"

# A list of MythTV recording directories, full paths in quotes, separated by commas
mythtv_recording_dirs = ["/pool/mythtv/recordings/"]

# Path to write symlinks
symlinks_dir = "/pool/mythtv2xbmc/recordings/"

# API key for TheTVDB
ttvdb_key = "<your ttvdb key>"

# Path to store TheTVDB series zips
ttvdb_zips_dir = "/pool/myth2xbmc/ttvdb/"

# API key for TheMovieDB
tmdb_key = "<your tmdb key>"

Configure Your Recording Schedules

  • Have MythTV lookup the TTVDB or TMDB reference number for your existing recording schedules:
mythmetadatalookup --refresh-all-rules
  • Alternatively, go to mythweb > click Recording Schedules > pick a schedule > pick "Look up Metadata". You should have a reference number filled in for each of your schedules. Format should be ttvdb.py_# or tmdb.py_#:
Clone this wiki locally