private void FetchTV() { var movieInfo= NFOFileReader.ReadMovieOrDefault(this.Item); if (movieInfo != null) { this.title = movieInfo.Title; this.description=movieInfo.Plot; this.duration = movieInfo.Duration; this.actors=movieInfo.Actors; this.director=movieInfo.Director; this.genre=movieInfo.Genres?.FirstOrDefault(); this.isSeries = false; this._MarkMetaDataInitialized(); return; } var episodeInfo = NFOFileReader.ReadEpisodeOrDefault(this.Item); if (episodeInfo != null) { var showInfo = NFOFileReader.ReadShowOrDefault(this.Item.Directory) ?? NFOFileReader.ReadShowOrDefault(this.Item.Directory?.Parent) ?? NFOFileReader.ReadShowOrDefault(this.Item.Directory?.Parent?.Parent); this.title = episodeInfo.Title; this.description = episodeInfo.Plot; this.duration = episodeInfo.Duration; this.actors = showInfo.Actors; this.director = episodeInfo.Director; this.genre = showInfo.Genres?.FirstOrDefault(); this.episode = episodeInfo.Episode; this.season = episodeInfo.Season; this.seriesname = showInfo.Title?? episodeInfo.ShowTitle; this.isSeries = true; this._MarkMetaDataInitialized(); return; } try { if (this.tvshowid == null || this.tvshowid == -1) this.tvshowid = TheTVDB.GetTVShowID(this.Path); var name = Directory.GetParent(this.Path).Name.GetNiceNameOrNull(); if (name == null || name is Formatting.NiceSeriesName seriesName && seriesName.Episode == 0) name = base.Title.GetNiceNameOrNull(); if (name == null) name = this.Item.Name.GetNiceNameOrNull(); TVShowInfo tvinfo = null; if (this.tvshowid != null && this.tvshowid > 0) { tvinfo = TheTVDB.GetTVShowDetails(this.tvshowid.Value); this.Server.UpdateTVCache(tvinfo); this.seriesname = tvinfo.Name; this.isSeries = true; } switch (name) { case Formatting.NiceSeriesName showName: { this.isSeries = true; if (string.IsNullOrEmpty(this.seriesname)) this.seriesname = showName.Name; if (showName.Episode > 0) { this.title = tvinfo != null ? tvinfo.Find(showName.Season, showName.Episode) : $"s{showName.Season}e{showName.Episode}" ; this.season = showName.Season; this.episode = showName.Episode; } else { this.title = base.Title; } if (!string.IsNullOrEmpty(name.Releaser)) this.title = $"{this.title} ({name.Resolution},{name.Releaser})"; break; } case Formatting.MovieName movieName: { this.seriesname = $"{movieName.Name} ({movieName.Year})"; break; } default: this.seriesname = Directory.GetParent(this.Path).Name; break; } } catch (Exception exn) { if (exn is ArgumentNullException) { } else { this.tvshowid = TheTVDB.GetTVShowID(this.Path); } } }
private void FetchTV() { try { if (tvshowid == null || tvshowid == -1) { this.tvshowid = TheTVDB.GetTVShowID(this.Path); } var steszt = (System.IO.Directory.GetParent(base.Path).Name).TryGetName(); if (steszt == null || (steszt is Formatting.NiceSeriesName && (steszt as Formatting.NiceSeriesName).Episode == 0)) { steszt = base.Title.TryGetName(); } if (steszt == null) { steszt = base.Item.Name.TryGetName(); } TVShowInfo tvinfo = null; if (tvshowid != null && tvshowid > 0) { tvinfo = TheTVDB.GetTVShowDetails(this.tvshowid.Value); Server.UpdateTVCache(tvinfo); this.seriesname = tvinfo.Name; isSeries = true; } if (steszt is Utilities.Formatting.NiceSeriesName) { isSeries = true; var steszt2 = steszt as Utilities.Formatting.NiceSeriesName; if (String.IsNullOrEmpty(this.seriesname)) { this.seriesname = steszt2.Name; } if (/*steszt2.Season > 0 &&*/ steszt2.Episode > 0) { if (tvinfo != null) { this.title = tvinfo.Find(steszt2.Season, steszt2.Episode); } else { this.title = String.Format("{0}x{1}", steszt2.Season, steszt2.Episode); } this.season = steszt2.Season; this.episode = steszt2.Episode; } else { this.title = base.Title; } if (!String.IsNullOrEmpty(steszt.Releaser)) { this.title = String.Format("{0} ({1},{2})", this.title, steszt.Resolution, steszt.Releaser); } } else if (steszt is Formatting.MovieName) { var n = steszt as Formatting.MovieName; this.seriesname = String.Format("{0} ({1})", n.Name, n.Year); } else { this.seriesname = System.IO.Directory.GetParent(this.Path).Name; } } catch (Exception exn) { if (exn is System.ArgumentNullException) { } else { this.tvshowid = TheTVDB.GetTVShowID(this.Path); } } }