void PlaybackOperationEnded(bool countAsWatched, VM_AnimeEpisode_User ep) { try { if (ep == null) { return; } if (ep != null) { ep.IncrementEpisodeStats(Shoko.Models.Enums.StatCountType.Stopped); } //save watched status if (countAsWatched || ep.IsWatched()) { //MPTVSeriesLog.Write("This episode counts as watched"); if (countAsWatched) { BaseConfig.MyAnimeLog.Write("Marking episode as watched: " + ep.EpisodeNumberAndNameWithType); MarkEpisodeAsWatched(ep); } } traktScrobbleEnabled = false; TraktScrobble(ScrobblePlayingStatus.Stop); SetGUIProperties(true); // clear GUI Properties } catch (Exception e) { BaseConfig.MyAnimeLog.Write("Error in VideoHandler.PlaybackOperationEnded: {0}", e.ToString()); } }
private void SetEpisode(VM_AnimeEpisode_User ep) { if (ep == null) { return; } /*AniDB_AnimeVM anime = ep.AnimeSeries.AniDB_Anime; * * Dictionary<int, TvDB_Episode> dictTvDBEpisodes = anime.DictTvDBEpisodes; * Dictionary<int, int> dictTvDBSeasons = anime.DictTvDBSeasons; * Dictionary<int, int> dictTvDBSeasonsSpecials = anime.DictTvDBSeasonsSpecials; * CrossRef_AniDB_TvDBVM tvDBCrossRef = anime.CrossRefTvDB; * ep.SetTvDBInfo(dictTvDBEpisodes, dictTvDBSeasons, dictTvDBSeasonsSpecials, tvDBCrossRef);*/ clearGUIProperty("Watching.Series.Title"); clearGUIProperty("Watching.Series.Description"); clearGUIProperty("Watching.Series.LastWatched"); clearGUIProperty("Watching.Series.EpisodesAvailable"); clearGUIProperty("Watching.Episode.Title"); clearGUIProperty("Watching.Episode.AirDate"); clearGUIProperty("Watching.Episode.RunTime"); clearGUIProperty("Watching.Episode.FileInfo"); clearGUIProperty("Watching.Episode.Overview"); clearGUIProperty("Watching.Episode.Image"); clearGUIProperty("Watching.Episode.Logos"); setGUIProperty("Watching.Series.Title", ep.AnimeSeries.SeriesName); setGUIProperty("Watching.Series.Description", ep.AnimeSeries.Description); setGUIProperty("Watching.Series.LastWatched", ep.AnimeSeries.WatchedDate.HasValue ? ep.AnimeSeries.WatchedDate.Value.ToString("dd MMM yy", Globals.Culture) : "-"); setGUIProperty("Watching.Series.EpisodesAvailable", ep.AnimeSeries.UnwatchedEpisodeCount.ToString()); setGUIProperty("Watching.Episode.Title", ep.EpisodeNumberAndNameWithType); setGUIProperty("Watching.Episode.AirDate", ep.AirDateAsString); setGUIProperty("Watching.Episode.RunTime", Utils.FormatSecondsToDisplayTime(ep.AniDB_LengthSeconds)); setGUIProperty("Watching.Series.Poster", ImageAllocator.GetSeriesImageAsFileName(ep.AnimeSeries, GUIFacadeControl.Layout.List)); if (ep.EpisodeImageLocation.Length > 0) { setGUIProperty("Watching.Episode.Image", ep.EpisodeImageLocation); } try { Fanart fanart = new Fanart(ep.AnimeSeries); if (!string.IsNullOrEmpty(fanart.FileName)) { setGUIProperty("Watching.Series.Fanart", fanart.FileName); } else { setGUIProperty("Watching.Series.Fanart", "-"); } } catch (Exception ex) { BaseConfig.MyAnimeLog.Write(ep.AnimeSeries.SeriesName + " - " + ex); } // Overview string overview = ep.EpisodeOverview; if (BaseConfig.Settings.HidePlot) { if (ep.EpisodeOverview.Trim().Length > 0 && ep.IsWatched()) { overview = "*** Hidden to prevent spoilers ***"; } } setGUIProperty("Watching.Episode.Overview", overview); // File Info List <VM_VideoDetailed> filesForEpisode = VM_ShokoServer.Instance.ShokoServices.GetFilesForEpisode(ep.AnimeEpisodeID, VM_ShokoServer.Instance.CurrentUser.JMMUserID).CastList <VM_VideoDetailed>(); string finfo = ""; foreach (VM_VideoDetailed vid in filesForEpisode) { finfo = vid.FileSelectionDisplay; } if (filesForEpisode.Count > 1) { finfo = filesForEpisode.Count + " Files Available"; } setGUIProperty("Watching.Episode.FileInfo", finfo); // Logos string logos = Logos.buildLogoImage(ep); BaseConfig.MyAnimeLog.Write(logos); setGUIProperty("Watching.Episode.Logos", logos); }