The Media Center Sandbox

Resources and discussion for developing experiences in the Windows Media Center platform.
Welcome to The Media Center Sandbox Sign in | Join | Help
in Search

how do you get recorded tv info or guide info from mcml in c#?

Last post 01-07-2010, 6:37 PM by eddyc. 1 replies.
Sort Posts: Previous Next
  •  01-07-2010, 12:37 PM 9521

    how do you get recorded tv info or guide info from mcml in c#?

    how do you get recorded tv info or guide info from mcml in c#?
    mcml nub
  •  01-07-2010, 6:37 PM 9522 in reply to 9521

    Re: how do you get recorded tv info or guide info from mcml in c#?

    There is no direct access to the TV guide for third-party code, due to the licensing agreement Microsoft have with their EPG provider. (Would make life so much easier if this changed...)

    For Recorded TV, one way is to use the WMPLib interface to enumerate all video on the system, like this:

    using WMPLib;
    ...
    WindowsMediaPlayer player = new WindowsMediaPlayer();
    IWMPPlaylist playlist = player.mediaCollection.getByAttribute("MediaType", "Video");

    for (int i = 0; i (lessthan) playlist.count; i++)
    {
    IWMPMedia media = (IWMPMedia)playlist.get_Item(i);
    string videopath = media.getItemInfo("SourceUrl");
    string videotitle = media.getItemInfo("Title");
    Debug.WriteLine("Found Video item: " + videotitle + " at " + videopath);
    }

    (You'll need to add a project reference to wmp.dll in your System32 folder as well, to get the Interop.WMPLib.dll interface library created.)

    If you look at all the videos with .wtv or .dvr-ms file extensions, that will give you a list of Recorded TV programs.

    Getting additional metadata from the programs is a bit trickier, but doable -- you need to read the metadata directly from the .dvr-ms or .wtv file. A good start is Stephen Toub's article here:

    http://blogs.msdn.com/toub/archive/2005/05/12/416874.aspx

    Eddy

    P.S. It looks like I can't include angle brackets in messages any more; I think this is a change since moving to the new hosting center. Even using ampersand 'lt' semicolon doesn't work...
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems