rebuilding a mythtv recorded shows database

22 07 2010

Ok, so late one night I decided to upgrade my MythTV server… Yeah, I was bored with my insomnia.. 😉

I’ve kept it with Debian stable throughout the years but this time I wanted to give it lvm and ext4 (squeeze) and decided to jump into testing instead of pining it.

It had been awhile since I backed up my database and yes, I backed up everything to and external HDD but var.. After all, I did want a fresh install and it was late at night. 😛

Well the new installation went well and myth was working nicely but without my recordings that are on a separate drive under xfs. Sure it recorded new shows but bugger it, I wanted my old ones back.. My music and photos came back nicely after I rdiff’d my /home partition but my recordings!!???

Well this is what I did to recover them, google wasn’t so nice this time. 😉

This is on Debian but should give you a rough idea if on another *nix

First off, create a fresh database:

$ cd /usr/share/mythtv/sql

mysql -u root -p < mc.sql

Then restore your backup: 😉
This should work fine if your .mythtv/backuprc is present.

/usr/share/mythtv/ --filename /path/to/your/<mythtvbackupdir>/mythconverg-xxxxxxxxx.sql.gz

So now we have a working db up until your last backup but what about the rest of the recordings?

Thanks to Greg Froese you’ll find a perl script in /usr/share/doc/mythtv-backend/contrib/recovery/ called

gunzip it, chmod 700…

Run that with the options you require, I needed –pass and –dir but if you have a default setup you should be fine without any extra options.

As it goes through your recordings, it’ll prompt you for info on the ones it finds that aren’t already in the db. Although you can manually enter the details, which can be a bugger if you can’t remember what it was from the file name, “2099_20100523230000.mpg”,
I found it easier just to “enter” my way through the script and use myth itself, to fill in the blanks.

First off play the file so you can remember what it was exactly then press “M”, -> “recording options”, -> “change recording title” then fill in the title and subtitle for it.

Rinse and repeat.

You’ll now have your Myth back like nothing had gone wrong. 😉

PS. I wrote this down late at night the following night so I might of missed something.. 😛 Let us know if I have. 🙂



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: