/// <summary> /// Handle an MovingPictures message received from a client /// </summary> /// <param name="message">Message</param> /// <param name="socketServer">Socket server</param> /// <param name="sender">Sender</param> internal static void HandleMovingPicturesMessage(Newtonsoft.Json.Linq.JObject message, SocketServer socketServer, Deusty.Net.AsyncSocket sender) { string action = (string)message["Action"]; if (!string.IsNullOrEmpty(action)) { // Show movie details for this movie if (action == "moviedetails") { string movieName = (string)message["MovieName"]; if (!string.IsNullOrEmpty(movieName)) { int movieId = MovingPicturesHelper.GetMovieIdByName(movieName); MovingPicturesHelper.ShowMovieDetails(movieId); } } // Play a movie with MovingPictures else if (action == "playmovie") { int movieId = (message["MovieId"] != null) ? (int)message["MovieId"] : -1; string movieName = (string)message["MovieName"]; bool resume = (message["AskToResume"] != null) ? (bool)message["AskToResume"] : true; int startPos = (message["StartPosition"] != null) ? (int)message["StartPosition"] : 0; // Play by movie id if (movieId != -1) { MovingPicturesHelper.PlayMovie(movieId, resume, startPos); } else if (!string.IsNullOrEmpty(movieName)) { // Play by name MovingPicturesHelper.PlayMovie(movieName, resume, startPos); } } } }
/// <summary> /// Show the details of a mediaitem on MediaPortal (without actually starting playback) /// </summary> /// <param name="itemId"></param> /// <param name="mediaType"></param> /// <param name="providerId"></param> /// <param name="playInfo"></param> internal static void ShowMediaItem(string itemId, int mediaType, int providerId, Dictionary <string, string> playInfo) { try { MpExtendedProviders provider = (MpExtendedProviders)providerId; MpExtendedMediaTypes type = (MpExtendedMediaTypes)mediaType; switch (provider) { case MpExtendedProviders.MovingPictures: if (WifiRemote.IsAvailableMovingPictures) { MovingPicturesHelper.ShowMovieDetails(Int32.Parse(playInfo["Id"])); } else { WifiRemote.LogMessage("MovingPictures not installed but required!", WifiRemote.LogType.Error); } break; case MpExtendedProviders.MPTvSeries: if (WifiRemote.IsAvailableTVSeries) { if (type == MpExtendedMediaTypes.TVEpisode) { TVSeriesHelper.ShowEpisodeDetails(Int32.Parse(playInfo["ShowId"]), Int32.Parse(playInfo["SeasonIndex"]), Int32.Parse(playInfo["Id"])); } else if (type == MpExtendedMediaTypes.TVSeason) { TVSeriesHelper.ShowSeasonDetails(Int32.Parse(playInfo["ShowId"]), Int32.Parse(playInfo["SeasonIndex"])); } else if (type == MpExtendedMediaTypes.TVShow) { TVSeriesHelper.ShowSeriesDetails(Int32.Parse(playInfo["Id"])); } } else { WifiRemote.LogMessage("MP-TvSeries not installed but required!", WifiRemote.LogType.Error); } break; case MpExtendedProviders.MPMusic: if (type == MpExtendedMediaTypes.MusicTrack) { MpMusicHelper.ShowMusicTrackDetails(Int32.Parse(playInfo["Id"])); } else if (type == MpExtendedMediaTypes.MusicAlbum) { MpMusicHelper.ShowAlbumDetails(playInfo["Artist"], playInfo["Album"]); } else if (type == MpExtendedMediaTypes.MusicArtist) { MpMusicHelper.ShowArtistDetails(playInfo["Artist"]); } break; case MpExtendedProviders.MPVideo: MpVideosHelper.ShowVideoDetails(Int32.Parse(playInfo["Id"])); break; case MpExtendedProviders.MpVideosShare: if (type == MpExtendedMediaTypes.File) { //TODO: fill myvideos db information instead of just playing the file MpVideosHelper.ShowFileDetails(playInfo["Path"]); } else if (type == MpExtendedMediaTypes.Folder) { string[] extensions = playInfo["Extensions"].Split('|'); MpVideosHelper.ShowFolderDetails(playInfo["Path"]); } break; case MpExtendedProviders.MpMusicShare: if (type == MpExtendedMediaTypes.File) { MpMusicHelper.ShowFileDetails(playInfo["Path"]); } else if (type == MpExtendedMediaTypes.Folder) { MpMusicHelper.ShowFolderDetails(playInfo["Path"]); } break; default: //we have no providers (yet) for tv if (type == MpExtendedMediaTypes.Recording) { if (!WifiRemote.IsAvailableTVPlugin) { WifiRemote.LogMessage("No TVPlugin installed: Aborting showrecording", WifiRemote.LogType.Error); return; } MpTvServerHelper.ShowRecordingDetails(Int32.Parse(playInfo["Id"])); } else if (type == MpExtendedMediaTypes.Tv) { if (!WifiRemote.IsAvailableTVPlugin) { WifiRemote.LogMessage("No TVPlugin installed: Aborting showchannel", WifiRemote.LogType.Error); return; } MpTvServerHelper.ShowTvChannelDetails(Int32.Parse(playInfo["Id"])); } else { WifiRemote.LogMessage("Provider not implemented yet", WifiRemote.LogType.Warn); } break; } } catch (Exception ex) { WifiRemote.LogMessage("Error during show of MediaItem: " + ex.ToString(), WifiRemote.LogType.Error); } }