The service end point for most of the calls is defined as follows:

All the Methods are defined by a UriTemplate that are relative to:

http://computerName:port/MediaBrowserService

 

 

    public interface IMediaBrowserService
    {
        /// <summary>
        /// Retrieves an item from MediaBrowser given an Id, this is either a BasicItemCollection or MetadataItem depending on its type
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        UriTemplate = "/item?id={id}"
        BasicItem GetItem(Guid id);

        /// <summary>
        /// Gets the initial folders from the MediaBrowser startup screen
        /// </summary>
        /// <returns></returns>
        UriTemplate = "/startup"
        BasicCollectionItem GetStartUpFolders();

        /// <summary>
        /// Gets a collection/folder from the MediaBrowser library
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        UriTemplate = "/collection?id={id}"
        BasicCollectionItem GetCollection(Guid id);
        
        /// <summary>
        /// Plays a specific item given its Id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        UriTemplate = "/play?id={id}"
        bool PlayItem(Guid id);

        /// <summary>
        /// Gets an object representing what is currently playing in Media Center
        /// </summary>
        /// <param name="waitForUpdate"></param>
        /// <returns></returns>
        UriTemplate = "/nowplaying?wait={waitForUpdate}"
        NowPlayingItem GetNowPlaying(bool waitForUpdate);

        /// <summary>
        /// Retrieves an image for a particular item
        /// </summary>
        /// <param name="id">Id of the MediaItem</param>
        /// <param name="imageType">The type of image</param>
        /// <param name="maxHeight">O or int.MaxValue to ignore</param>
        /// <param name="maxWidth">O or int.MaxValue to ignore</param>
        /// <returns></returns>
        UriTemplate = "/image?id={id}&imagetype={imageType}&maxheight={maxHeight}&maxwidth={maxWidth}"
        PictureItem GetImage(Guid id, ImageTypes imageType, int maxHeight, int maxWidth);

        /// <summary>
        /// Sends a command for Media Center to perform
        /// </summary>
        /// <param name="command"></param>
        UriTemplate="/command?type={command}")]
        void SendCommand(CommandTypes command);

        /// <summary>
        /// Seeks to a specific time (in seconds) for the currently playing item
        /// </summary>
        /// <param name="seconds">Time in seconds</param>
        UriTemplate = "/seek?duration={seconds}")]
        void Seek(int seconds);

        /// <summary>
        /// Tells media Center to go to a specific screen
        /// </summary>
        /// <param name="screenType">The screen to go to</param>
        /// <param name="extraInfo">Any extra information for the screen in question</param>
        UriTemplate = "/screen?type={screenType}&params={extraInfo}")]
        void GoToScreen(ScreenType screenType, string extraInfo);

        /// <summary>
        /// Retrieves a MetadataItem from MediaBrowser given an Id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        UriTemplate = "/metadata?id={id}"
        MetadataItem GetMetadata(Guid id);

        /// Gets a list of available trailers and their source
        /// </summary>
        /// <param name="id">The id of the library to get trailers for</param>
        /// <returns></returns>
        UriTemplate = "/trailers?id={id}"
        TrailerInfo[] GetTrailers(Guid id);

        /// <summary>
        /// Plays a given library item on the host PC
        /// </summary>
        /// <param name="trailer"></param>
        Method = "POST", UriTemplate = "/playtrailer", RequestFormat = WebMessageFormat.Json
        void PlayTrailer(TrailerInfo trailer);
}

 

The ‘GetNowPlaying’ method takes in a parameter of type bool for ‘waitForUpdate’ – this is using the COMET style logic for http ‘push’ notification of events firing on the host machine. (Though this functionality is currently not working)

Last edited Sep 6, 2010 at 7:40 PM by evorgevol, version 4

Comments

No comments yet.