1. davels
  2. tvdb-bulk-update


Clone wiki

tvdb-bulk-update / Home

Upgrade Notice
As of 'commit 35: 95a2922fcf20', the tvdb_api package has been upgraded to a more recent version that breaks compatibility.
You should delete the tvdb_api directory and run the script to download the correct version.

What Is It

tvdb-bulk-update is a command-line script used to set metadata and posters for tv episodes in MythVideo using the excellent database at http://thetvdb.com. The script works against the mythtv database so always make sure it's up to date by using the myth UI to do a scan first.


You will need the following to use this script:

Download the script http://bitbucket.org/davels/tvdb-bulk-update/raw/tip/tvdb_bulk_update.py and set the user options to match your environment. You have two ways to define your options.

  1. Modify the USER OPTIONS section of the script
  2. Create a new file containing the options you want to override and specify it on the command line with the --config=FILE option.

Method 2 is a bit more work but it makes future upgrades much easier. For example if you place the following in the file myconfig.py, you can run the script using: $ tvdb-bulk-update.py --config=myconfig.py

DRY_RUN = False
ROOTS = ["/video/tv/"]

At a bare minimum you need to define the ROOTS variable to identify the directories where you TV episodes are stored. This is recursive so just specify the top level directories. You should also check the MYTH_HOST, MYTH_USER, MYTH_PASSWD and MYTH_DB variables to make sure the connection information is correct. You will also want to add DRY_RUN = False once you're sure everything looks good. There are many other options that can be configured for more advanced control.

Using The Script

Simply run the script to start

$ tvdb-bulk-update.py

There are a few command-line options that can be specified as well

  • --config=FILE read options from FILE and merge them into the options specified in the script
  • --root=ROOT search for files at ROOT instead of using the ROOTS configuration option
  • --dry-run unconditionally turn on dry run mode (see options)
  • --debug print extra debug output

If you don't have the tvdb_api package it will offer to download it for you and place it in the current directory. This is the best way to ensure you have a compatible version.

The script will look at all files in the database (limited by the ROOTS specified) that don't currently have any metadata assigned. For each file it will attempt to parse out the series, season and episode number from the filename (see NAME_PARSERS in options). If that succeeds you will presented with a list of the best matches for the series name. You can choose the correct series from the list or type a new search term if none of the options are correct. You also have to option to skip the series/episode for this session, or to permanently skip the episode. If you choose to permanently skip the episode a bogus inetref value will saved in the database so it will be ignored in future scans.