Ttvdb.py

From MythTV Official Wiki
Revision as of 23:24, 21 March 2009 by Rdv (talk | contribs)

Jump to: navigation, search
                     THIS PAGE IS A WORK IN PROGRESS

What is ttvdb.py

This python script is intended to perform TV series data lookups based on the thetvdb.comwiki

Downloading ttvdb.py set of scripts

Currently ttvdb.py does not ship with MythTV and only works with v0.22 revision 20232 or higher with a data base Schema Version: 1232 or higher. You will also need to apply the following patch #6346 and optionally: #6158

Click on the follow link to find the ttvdb scripts archive: #6242 - ttvdb make sure to download the latest version (v0.8.9)

Installing ttvdb.py

The MythVideo scripts are typically installed in /usr/share/mythtv/mythvideo/scripts/ or /usr/local/share/mythtv/mythvideo/scripts/. When using mythvideo to download the TV series data, ttvdb must be installed in your "...mythvideo/scripts/" directory.

With sudo privileges un-archive all ttvdb archive files into your mythvideo scripts directory as described above. You can then delete the ttvdb archive file as it is no longer required.

Configuring MythVideo 0.22 to use ttvdb.py

Setup the directories for the TV Series artwork. Utilities/Setup|Setup|Media Settings|Videos Settings|General Settings on page 1/8, enter the directories where the graphic files will be stored. It is recommended to use separate directories for each type of graphic file (Posters, Banners, Fanart and Screen shots).

Change the MythVideo settings to use the new script, the Command to search for TV series listings:

Using the default menu theme, you can find the settings in Utilities/Setup|Setup|Media Settings|Videos Settings|General Settings on page 8/8. After making the changes, the settings should look like:

Command to search for TV Shows in Mythvideo: /usr/local/share/mythtv/mythvideo/scripts/ttvdb.py -M
Command to search for TV Season posters: /usr/local/share/mythtv/mythvideo/scripts/ttvdb.py -mlP
Command to search for TV Show fanart: /usr/local/share/mythtv/mythvideo/scripts/ttvdb.py -tlF
Command to search for TV Season banners: /usr/local/share/mythtv/mythvideo/scripts/ttvdb.py -lB
Command to extract data for TV Episodes: /usr/local/share/mythtv/mythvideo/scripts/ttvdb.py -mD

Now you can use the mythvideo download feature "Manage Video|Download Metadata" to get a TV series episode artwork (poster, fanart and banner) plus episode details.

Languages

!!!! New feature that will only be available in release v0.9.0 or higher

ttvdb data requests defaults to English unless the -l option is used. If you specify a language (e.g. -l es), ttvdb will first look for data in that language but if none is available ttvdb will return the English equivalent assuming any exists.

Currently thetvdb.com wiki supports the following languages: (da, fi, nl, de, it, es, fr, pl, hu, el, tr, ru, he, ja, pt, zh, cs, sl, hr, ko, en, sv, no)

Why am I not getting the promised episode data?

Here are the usual suspects:

1) The Schedules Direct episode is completely different then what was entered in thetvdb.com.

2) You have not set up the commands properly in the setting as described above.

3) The episode data was updated but one or more of the graphics will not display. Thetvdb.com web site can get overloaded which results in graphic files that are actually html error messages. A typical mythfrontend end log message when this is the case looks like:

example error message goes here !!!

If this occurs all you need to do is use the mythvideo "Manage Video|Reset Metadata", then download again, "Manage Video|Download Metadata". If you get a lot of these issues perform your metadata downloads when thetvdb.com is not so busy.

4) If problems persist verify that ttvdb is properly installed by viewing your mythfrontend log or trying ttvdb from the command line. See the next section on how to display examples.

Command line examples

To view command line examples of all ttvdb features type:

/usr/local/share/mythtv/mythvideo/scripts/ttvdb.py -u

User configuration file

A user configuration file is not required when grabbing TV data through mythvideo download metadata. This is because you interactively select the specific TV series. If you intend to use ttvdb in your own user scripts a user configuration file is highly recommended.

TV listing sources such as Schedules Directdo not always pass MythTV TV series and episode names that match those on thetvdb.com wiki. This can cause ttvdb to retrieve unintended information. Luckily this does not happen often. To compensate ttvdb provides a user configuration file which can deal with those rare cases.

The configuration file can tie a series name (%TITLE%) to a specific thetvdb.com series id (the equivalent of an IMDB number). Also a TV series episode name (%SUBTITLE%) can be modified to match the episode name on thetvdb.com.

The included configuration file "tvdb-example.conf" already has examples of TV series names that need special attention. There is also an episode name that must be manipulated to match those on thetvdb.com wiki.

Copy and rename the "tvdb-example.conf" to a directory of your choosing (e.g. ~/,tvdb/tvdb.conf). Then edit the new file making changes as required. The example configuration file contains documentation for all sections and fields. To have ttvdb use your configuration file use the -c option, For example:

ttvdb -c "/home/user/,tvdb/tvdb.conf" ... 

See the command line examples for details. For mythbackend user jobs always specify a full qualified path for the configuration file, do not use the "~" short cut.

An example of a mismatch is where Schedules Direct has the TV Series name "The Beast" but thetvdb.com has the series name as "The Beast (2009)". Schedules Direct has the series "24" episode name of "Day 7: 10:00PM-11:00PM" while thetvdb.com has "Day 7: 10:00 PM-11:00 PM". The configuration file can compensate for these discrepancies.

Here are several examples that you can add as part of your own ttvdb configuration file. Please add new ones to this section when you encounter them.

[series_name_override] 
# Specify recorded "Life On Mars" shows as the US version  
Life on Mars:82289
# Specify recorded "Eleventh Hour" shows as the US version  
Eleventh Hour:83066
# Specify recorded "Frontline" or "Frontline/World" shows as the "Frontline PBS" version  
Frontline/World:80646
Frontline:80646
# Specify recorded "The Beast" shows are the 2009 version  
The Beast:83805
# Specify recorded "Castle" shows are the 2009 version  
Castle:83462
# Specify recorded "Battlestar Galactica" shows are the 2003 version  
Battlestar Galactica:73545
[ep_name_massage]
# Modify the TV series 24 episode name (%SUBTITLE%)
24: PM," PM", AM, " AM"