More permanent stuff at http://www.dusbabek.org/~garyd

22 December 2008

Myth listings

One of the ancillary things that broke when I upgraded my MythTv systems last month was my listings page that gets pushed from MythWeb daily.

In 0.20.x, the listings page was a simple php app that output plain html. I had a few bash/sed/awk scripts that grabbed the prime-time listing, cleaned up the HTML to remove references to my system, fix relative links, etc; and then scp to my web host.

Those scripts stopped working in 0.21 because the listings page is now a fancy AJAX application that doesn't use simple HTTP GET operations. I had two options: figure out their AJAX API to get the scraping done, or write some dirty PHP to query the database for the daily listings.

I chose the latter, even though I am a nasty PHP hack. It is straightforward stuff. The result can be found at listing.php. Most of my time was spent figuring how to get dates into and out of my PHP queries.

When I am more inclined, I will go back and fix the table HTML for shows that do not start or begin on the hour or half-hour, and also exclude the radio and other channels I don't watch.

0 comments: