Friday, September 7, 2012

Phantom Recordings Vaporized

As I mentioned in my previous post, a rather odd problem with network ports and IPv6 addressing broke my Mythbuntu installation. I've since confirmed that the fix I reported is working. At one point during the breakdown I tried to record an episode of the TV series "Perception" title "Kilimanjaro". When the recording failed, I rescheduled it ... once. That somehow led to approximately 1,100 entries for "Kilimanjaro" in the list of recorded shows, all with a size of either zero or one byte. Not only did that clutter the list, it significantly slowed  MythTV's display of the list, not to mention some other functions. The phantoms had to go.

I knew that MythTV stores all sorts of records in a MySQL database. A bit of searching turned up this post, which told me what I needed to know: that I could delete entries from the recorded table without breaking the database. So I installed MySQL Navigator, pointed it at the mythconverg database, and got to work. The database name, user id and password (along with host name and port) are all stored in ~/.mythv/config.xml. Once into the database, I ran

select * from recorded

to get the lay of the land, then

select count (*) from recorded

to get the total number of entries and 

select count (*) from recorded where subtitle = 'Kilimanjaro'

to get the number of phantom entries. The point of this was not just to satisfy my curiosity; I wanted to be sure that my next query would not delete everything. The third select helps me confirm that my "where" clause will do the right thing. (I tend to be cautious when deleting or updating database records.) Finally, it was time to do the deed:

delete from recorded where subtitle = 'Kilimanjaro'

nuked the phantom entries.

(As a quick sidebar, learning SQL, and specifically the MySQL version, has paid dividends for me over the years. For anyone doing operations research software development, whether personal or professional, and for anyone doing web development, it's a great investment of time.)

Deleting entries in the recorded table does not delete any actual recordings, and I wanted to be sure that there were no files associated with the phantoms. I also wanted to make sure that there were no live TV recordings sitting around. (The recorded table also showed a 10 second live recording from the day that I installed Mythbuntu and tested its functionality. That entry was another phantom, which I deleted.) So I went to check the directories where MythTV stores files. I started by looking in obvious places, to no avail. I then did a web search, which provided several widely differing answers, some specific to Mythbuntu and some generic for MythTV, and all of them wrong! So it was back to manual search. For the record, I found the files under /var/lib/mythtv (live recordings in the livetv directory, taped shows in the recordings directory).

No comments:

Post a Comment

If this is your first time commenting on the blog, please read the Ground Rules for Comments. In particular, if you want to ask an operations research-related question not relevant to this post, consider asking it on OR-Exchange.