RdTelly - database plotting
First, a note of explanation. A "day" in telly-land starts at roughly 6am. After midnight tonight, it'll be Tuesday, but the listings for that time are on the Monday page in magazines, and in the data file on bleb.org for Monday. This makes sense to most humans, but not machines and programmers. So whenever I download data, or decide which programmes to show for "Today", I'll have to think in GMT-6.
And just to make things a little bit harder, the bleb.org data provides 8 days of listings (yesterday, today, and 6 future days) in folders named by their offset from the current date. These change at the same time the listings run out. So I have to be careful not to pull data when I can't predict what date "Today" might be on bleb.org. Phew...
Yes, I say "phew" too much. Anyway, bleb.org limits data grabbing to 10 channels at a time, and I'll probably want more than that, so the first table I need is called "datasources". It's also generally a Good Thing to avoid hardcoding that sort of stuff. The datasources table has three columns: a primary key, a data URL (with %d or something where the required day goes), and the last (telly-land) day it was pulled.
It's fairly obvious I would need a "channels" table. I'll be using XMLTV data, which stores any number of channels and programmes in one file, so I'll make the parsing code fill the channels table as it finds them. The channels table will have a primary key, which will hold the hostname-like IDs used by XMLTV, and the channel's name. I'll also store the ID of the datasource the channel's data is from, to help me debug and manage datasources. Finally, I'll have a "starred" boolean that stores whether the channel is any good or not. Starred channels get displayed higher on the page when horizontal space is limited.
Finally, "programmes" (not "programs"). Obligatory primary key, secondary key linking programmes to channels, start time, stop time. (There's a minor problem with stop time, in that it's not provided for the last programme in the day, but meh, I'm not planning on watching much 5am TV.) Title, subtitle, and description of the programme are provided, so I might as well store them. And again, I'll have the ability to "star" (since when was that a verb?) programmes I plan on watchng and be politely reminded about them later.
I think now I'm entitled to say "phew". Amazingly, I've made what would seem to be a complete logical plan...
...if it wasn't for the fact that my mind is still making more ideas and I can't type them fast enough. Oh well, time for bed.
As I said before, there are still things I want in my TV guide that aren't started or planned in any great detail yet. I want: U... / Trackback from rdmsoft.com Blog on 13 Nov 2005 at 17:46.
Feedback is closed. Feel free to contact me privately.