views:

726

answers:

1

I'd like to query the Windows 7 Media Center Program Guide from a C# app. e.g. to answer questions like "What time is The Inbetweeners next showing on Channel 4?".

I've looked through the Media Center SDK (v6 and v5) but this suggests it is only possible to use the Microsoft.MediaCenter.TV.Scheduling classes to request recordings ("Click-to-record"). I can't find a way to just query and get back a list of show times without asking Media Center to record something.

A bit of web searching suggests I could open the SQLite db that Media Center uses behind the scenes (ProgramData\Microsoft\eHome\EPG\epg.sdf) and query that. I could do this, but it feels a bit flakey to access Media Center's data directly.

So, am I missing something in the .Net API? Is there a way to query the schedule without going behind Media Center's back?

+2  A: 

The TVSchedule class seems to be the closest documented (albeit deprecated) way to do this. The Lineup class only works to look up channels.

I also saw the thread you mentioned about using the SqlLite database (at http://discuss.mediacentersandbox.com/forums/thread/559.aspx) but if your choice is using a deprecated API and accessing an undocumented database, I'd suggest the former. ;-) Especially since I suspect the database format has already changed (or will be changing in Win 8).

Also, check out http://mobilewares.spaces.live.com/blog/cns!78533A1A2E078194!4535.entry which is Niall Gainsbourg's post complaining about the latest SDK not having any EPG support. So you're not the only one looking for this.

You might want to try containing Niall directly, perhaps he'd be willing to post what he knows about accessing the EPG here... considering he has an EPG-related product for sale, I imagine he'd know what he's talking about. :-)

Justin Grant
Thanks, the TVSchedule looks like what I need, but has been deprecated and I'm trying not be naughty. MSDN recommends using the ScheduleEvent class instead, but I can't see how to use this to just query.The Lineup class seems to just be for resolving channel names.
Yep. The API is severely limited. I updated my answer with more info. See above.
Justin Grant
So, to sum up, it looks like the options in the current Windows 7 Media Center SDK are:1. Use the deprecated TVSchedule class2. Query the SQLite DB directly3. Give up :)Thanks for following up.
Yep. Bummer. Sorry I couldn't be more helpful Watch out for the sqllite option-- I read that the db had bog changes in win7.
Justin Grant