static public bool SubmitRating(RatingType type, string itemId, int rating) { string account = DBOption.GetOptions(DBOption.cOnlineUserID); if (String.IsNullOrEmpty(account)) { string[] lines = new string[] { Translation.TVDB_INFO_ACCOUNTID_1, Translation.TVDB_INFO_ACCOUNTID_2 }; //TVSeriesPlugin.ShowDialogOk(Translation.TVDB_INFO_TITLE, lines); //trakt.tv also listens to this, also can store ratings locally. MPTVSeriesLog.Write("Cannot submit rating to thetvdb.com, this requires your Account Identifier to be set."); return(false); } if (itemId == "0" || rating < 0 || rating > 10) { MPTVSeriesLog.Write("Cannot submit rating, invalid values...this is most likely a programming error"); return(false); } if (!DBOnlineMirror.IsMirrorsAvailable) { // Server maybe available now. DBOnlineMirror.Init(); if (!DBOnlineMirror.IsMirrorsAvailable) { GUIDialogOK dlgOK = ( GUIDialogOK )GUIWindowManager.GetWindow(( int )GUIWindow.Window.WINDOW_DIALOG_OK); dlgOK.SetHeading(Translation.TVDB_ERROR_TITLE); if (!TVSeriesPlugin.IsNetworkAvailable) { string[] lines = new string[] { Translation.NETWORK_ERROR_UNAVAILABLE_1, Translation.NETWORK_ERROR_UNAVAILABLE_2 }; TVSeriesPlugin.ShowDialogOk(Translation.TVDB_ERROR_TITLE, lines); } else { string[] lines = new string[] { Translation.TVDB_ERROR_UNAVAILABLE_1, Translation.TVDB_ERROR_UNAVAILABLE_2 }; TVSeriesPlugin.ShowDialogOk(Translation.TVDB_ERROR_TITLE, lines); } MPTVSeriesLog.Write("Cannot submit rating, the online database is unavailable"); return(false); } } // ok we're good MPTVSeriesLog.Write(string.Format("Submitting Rating of {2} for {0} {1}", type.ToString(), itemId, rating), MPTVSeriesLog.LogLevel.Debug); Generic(string.Format(apiURIs.SubmitRating, account, type.ToString(), itemId, rating), true, false, Format.NoExtension); return(true); }
protected void LoadPlayList(string strPlayList) { IPlayListIO loader = PlayListFactory.CreateIO(strPlayList); if (loader == null) { return; } PlayList playlist = new PlayList(); if (!loader.Load(playlist, strPlayList)) { TVSeriesPlugin.ShowDialogOk(Translation.Playlist, new string[] { GUILocalizeStrings.Get(477) }); return; } playlistPlayer.CurrentPlaylistName = System.IO.Path.GetFileNameWithoutExtension(strPlayList); if (playlist.Count == 1 && playlistPlayer.PlaylistAutoPlay) { MPTVSeriesLog.Write(string.Format("GUITVSeriesPlaylist: play single playlist item - {0}", playlist[0].FileName)); // If the file is an image file, it should be mounted before playing string filename = playlist[0].FileName; if (Helper.IsImageFile(filename)) { if (!GUIVideoFiles.MountImageFile(GUIWindowManager.ActiveWindow, filename, false)) { return; } } if (g_Player.Play(filename)) { if (MediaPortal.Util.Utils.IsVideo(filename)) { g_Player.ShowFullScreenWindow(); } } return; } // clear current playlist playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_TVSERIES).Clear(); // add each item of the playlist to the playlistplayer for (int i = 0; i < playlist.Count; ++i) { PlayListItem playListItem = playlist[i]; playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_TVSERIES).Add(playListItem); } // if we got a playlist if (playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_TVSERIES).Count > 0) { playlist = playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_TVSERIES); // autoshuffle on load if (playlistPlayer.PlaylistAutoShuffle) { playlist.Shuffle(); } // then get 1st item PlayListItem item = playlist[0]; // and start playing it if (playlistPlayer.PlaylistAutoPlay) { playlistPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_TVSERIES; playlistPlayer.Reset(); playlistPlayer.Play(0); } // and activate the playlist window if its not activated yet if (GetID == GUIWindowManager.ActiveWindow) { GUIWindowManager.ActivateWindow(GetID); } } }