Christmas specials

I noticed today that our MythTV box was going to fail to record the Christmas special of The Real Hustle. Why? Because the programme’s name was The Real Hustle Christmas and we had instructed the machine to record only The Real Hustle, which as far as MythTV is concerned, is an entirely different programme.

Now, one doesn’t want to have to create a second companion rule for each recording rule, purely to catch the Christmas specials. Nor does one want to have to create a power rule instead of a normal rule, so that one can match the basic programme name followed somewhere by the word Christmas.

What does one really want to do? Ideally, you want to record any programme that has Christmas in the title, if, when the string Christmas or Christmas Special is removed, the remainder of the title matches the name of any programme for which one has already created a recording rule.

To do this, create a custom rule, perhaps called Christmas Specials. In the search phrase, place the following:

program.title LIKE ‘%Christmas%’

AND REPLACE(REPLACE(program.title, ‘ Special’, ”), ‘ Christmas’, ”) =

REPLACE(record.title, ‘ (Power Search)’, ”)

Dissecting this, we first check to see whether a given programme in the TV guide contains the word Christmas in the title. If it does, we remove the suffix Special, if present, from the title. Next, we remove the suffix Christmas from the title. That leaves us with the stub of the programme’s title, which, with a bit of luck, will be the same as the title of a normal episode of the programme.

On the right-hand side of the equality check, we join with the record table to see whether there’s a recording rule with the same name as the title stub of the Christmas programme. The REPLACE function first removes the text that MythTV itself adds to the name of any rule that is a power search, as this will otherwise potentially cause valid matches to be missed.

If we find a match, bingo, the Christmas special is caught in the net and MythTV will record it.

As I’ve said before, absolutely anything is possible with MythTV’s recording scheduler, as long as you can figure out how to express yourself in SQL. This is the first time I’ve found a use for a database table other than program.

This entry was posted in Hacking. Bookmark the permalink.

Leave a Reply

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