Importing TV shows into Mythtv

mythtvI have been using the popular open source multimedia programme called mythtv for a while now. Apart from recording my favourite TV shows, I also utilise the various modules like mythmusic, mythnews, mythvideo and mythweb. Though you can use mythvideo to view videos which are not tv recordings, there are no specific modules which can import a show into mythtv.

But wait, just when you think its not possible to import a show into the mythtv recordings, there is a way to do so. There is a perl script called “myth.rebuilddatabase.pl” which comes with the mythtv-doc package of mythtv. Usually the “myth.rebuilddatabase.pl” script resides at “/usr/share/doc/packages/mythtv-doc/contrib/” folder. Else, If you are on an rpm based system you can look for its path with the following command:

rpm -qal "myth*" | grep "\.pl"

This should return all the available perl scripts which are distributed with mythtv. Now to use the script, we need make a copy of the script to your home folder and configure it. Edit the file and update the relevant mysql mythtv database connection details. Now copy the tv show files which you want to import, into your mythtv recordings folder.


Meta Data

To import the show into Mythtv, you have the option of importing the meta data associated with it. The meta data consists of the show title, sub-title, description, show time and most importantly the channel id. To retrieve the channel ids which are available on your mythtv installation, you can query the mysql database with the following shell command:
mysql --host [localhost] --user [mythtv] -p -e 'use [mythconverg]; select chanid, name, callsign from channel where visible=1'
Change the appropriate values in the command shown above (in brackets) to reflect your database setup and hit enter. It should now prompt you to enter the database password for the mythtv database table and then will list the available channels on your mythtv installation.

Import Show

To import the show we change into the recordings folder and just execute the script followed by the file extension of the show we are importing:

~/myth.rebuilddatabase.pl --ext avi

In this instance I am importing an .avi file. The rebuild script scans your mythtv directory and each file will be checked against your database to see if it exists. If they do not, you will be prompted for a channel-id, the show title, subtitle, description, show start time and duration of the show, and a record will be created. Finally it will prompt you with the question of whether you want to “build a seek table for this file”. Just say yes and it will update the “seek” information for that show. Another important thing to remember is not to give the same “show time” of an already existing show for the same channel id, else it will produce a mysql database error “Duplicate entry”.

Final Note:

I have noted that only the following files types can be imported: {nuv,mpg,mpeg,avi}. I am hoping to import a few ogg based files into mythtv. I will update this entry on my attempt to import those ogg files.

This entry was posted in Linux and tagged , , . Bookmark the permalink.

2 Responses to Importing TV shows into Mythtv

  1. Pingback: Ted Williams

  2. Pingback: Bend in the Weather

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>