Thursday, October 11, 2007

MGM HD.. what day is it? wait.. what time is it?

MGM HD site creation has certainly been an interesting experience. From what I understand the feedback on the TV Channel itself has been overwhelmingly positive. Which is great for us, because it means we're dealing with TPTB while they are in a good mood.

I can honestly say I never ever read a TV guide in my life. I don't know why, I just never needed to know when my shows are on, because I always had the power of advertising to let me know, and now my cable box tells me what's on when.
I thought someone had made a mistake, and messed up the "dates" on the excel spreadsheet I got, which had laid out (in a way no one could possibly script to get the data out of it) that each "day" starts at 6am, and goes through until 5.59am the following day.

Apparently that's how it's done in TV Guides, and TV Stations. Silly me to think that 12am marks the start of a new day! This has created tons of problems for me creating the schedule. As on the feed and schedule.. the date is correct literally, and the time is also correct. This means two things. I have to constantly be checking to make sure that today really is today.. it really is today if it's after 6am. Before 6am, I have to reset all the variable like it's yesterday.

My head hurts.. seriously my code has turned to complete spaghetti.. it's almost incomprehensible that I can't use plain regular old dates.. I have to always be checking the time to work out if it's really today or not.

The other snafu created by this crazy system is getting them out of the database in the right order, for the right "day". My query ended up like this:

select * from schedule where (air_date='".$now_date."' and air_time >='600') or (air_date='".$tomorrow_date."' and air_time < '600') order by air_date, air_time

Lovely aint it?

It's live, it appears to work, now I just have to wait and see what happens at the end of the month, and the end of the year. Lets hope I got all those calculations right!

BFN

3 comments:

Anonymous said...

Hehe, yeah I guess TV GUIDE follows the part of human nature that observes that people tend to stay up at night or perhaps coming home late after being out at an event being in the mindset that it's still the same night even though it's after midnight. And they arrange the listings as though the nightowls (*cough*now who would that be?*cough*) might just be going to sleep when the birds start chirping and consider that the end of the night.

Whereas all the fit Jogsters and nice breakfast-making school moms, and workers and farmers and morning show watchers and so forth are just waking up, and considering that the Start of their day.

You should be glad I dont run TV-GUIDE or your times would probably start at NOON or something. hehe. :)

Good job though! Looks good.

-SGC

Anonymous said...

oh, speaking of what day is it & what time is it. David and Jane had their baby. :-) Sebastian Flynn Hewlett. 9 pounds 4 ounces.


-SGC

Unknown said...

Hi! I saw David's twitter about the baby, great news for them!
Oh but I still don't agree with TV Guide.. all that extra code *shakes head* I was tempted to set the site to a timezone 6 hours wrong, so that it would work itself out.. LOL.