From 7e457b1f8e89c1e15396083c7a42a0935a74a14b Mon Sep 17 00:00:00 2001 From: Mark Date: Sun, 12 Aug 2018 00:09:58 +0800 Subject: [PATCH] Fix for Images HTML Page --- TVRename/Forms/UI.cs | 6 +- TVRename/Utility/Helper/ShowHtmlHelper.cs | 206 +--------------------- 2 files changed, 5 insertions(+), 207 deletions(-) diff --git a/TVRename/Forms/UI.cs b/TVRename/Forms/UI.cs index 61e9a2ed4..82d991bd1 100644 --- a/TVRename/Forms/UI.cs +++ b/TVRename/Forms/UI.cs @@ -755,19 +755,19 @@ private void FillEpGuideHtml(ShowItem si, int snum) { Season s = ser.DvdSeasons[snum]; infoPaneBody = si.GetSeasonHtmlOverview(s); - imagesPaneBody = si.GetSeasonImagesHtmlOverview(s); + imagesPaneBody = ShowHtmlHelper.CreateOldPage(si.GetSeasonImagesHtmlOverview(s)); } else if (!si.DvdOrder && snum >= 0 && ser.AiredSeasons.ContainsKey(snum)) { Season s = ser.AiredSeasons[snum]; infoPaneBody = si.GetSeasonHtmlOverview(s); - imagesPaneBody = si.GetSeasonImagesHtmlOverview(s); + imagesPaneBody = ShowHtmlHelper.CreateOldPage(si.GetSeasonImagesHtmlOverview(s)); } else { // no epnum specified, just show an overview infoPaneBody = si.GetShowHtmlOverview(); - imagesPaneBody = si.GetShowImagesHtmlOverview(); + imagesPaneBody = ShowHtmlHelper.CreateOldPage(si.GetShowImagesHtmlOverview()); } TheTVDB.Instance.Unlock("FillEpGuideHTML"); diff --git a/TVRename/Utility/Helper/ShowHtmlHelper.cs b/TVRename/Utility/Helper/ShowHtmlHelper.cs index d9d60d5d2..d6a4eb672 100644 --- a/TVRename/Utility/Helper/ShowHtmlHelper.cs +++ b/TVRename/Utility/Helper/ShowHtmlHelper.cs @@ -30,12 +30,12 @@ public static string CreateOldPage(string body) } public static string GetShowHtmlOverview(this ShowItem si) { - return TVSettings.Instance.IncludeBetaUpdates() ? si.GetShowHtmlOverviewNew() : CreateOldPage(si.GetShowHtmlOverviewOld()); + return si.GetShowHtmlOverviewNew(); } public static string GetSeasonHtmlOverview(this ShowItem si, Season s) { - return TVSettings.Instance.IncludeBetaUpdates() ? si.GetSeasonHtmlOverviewNew(s) : CreateOldPage(si.GetSeasonHtmlOverviewOld(s)); + return si.GetSeasonHtmlOverviewNew(s); } private static string GetShowHtmlOverviewNew(this ShowItem si) @@ -325,94 +325,6 @@ private static string DateDetailsHtml(this ProcessedEpisode ei) return string.Empty; } - private static string GetShowHtmlOverviewOld(this ShowItem si) - { - string body = ""; - SeriesInfo ser = si.TheSeries(); - - List skip = new List - { - "Actors", - "banner", - "Overview", - "overview", - "Airs_Time", - "airsTime", - "Airs_DayOfWeek", - "airsDayOfWeek", - "fanart", - "poster", - "zap2it_id", - "zap2itId", - "id", - "seriesName", - "lastUpdated", - "updatedBy" - }; - - if ((!string.IsNullOrEmpty(ser.GetSeriesWideBannerPath())) && - (!string.IsNullOrEmpty(TheTVDB.GetImageURL(ser.GetSeriesWideBannerPath())))) - body += "
"; - - body += $"

{si.ShowName}

"; - - body += "

Overview

" + ser.GetOverview(); //get overview in either format - - bool first = true; - foreach (string aa in ser.GetActorNames()) - { - if (string.IsNullOrEmpty(aa)) continue; - if (!first) - body += ", "; - else - body += "

Actors

"; - - body += "" + aa + ""; - first = false; - } - - string airsTime = ser.GetAirsTime(); - string airsDay = ser.GetAirsDay(); - if ((!string.IsNullOrEmpty(airsTime)) && (!string.IsNullOrEmpty(airsDay))) - { - body += "

Airs

" + airsTime + " " + airsDay; - string net = ser.GetNetwork(); - if (!string.IsNullOrEmpty(net)) - { - skip.Add("Network"); - skip.Add("network"); - body += ", " + net; - } - } - - bool firstInfo = true; - foreach (KeyValuePair kvp in ser.Items) - { - if (firstInfo) - { - body += "

Information"; - firstInfo = false; - } - - if (skip.Contains(kvp.Key)) continue; - - if (((kvp.Key == "SeriesID") || (kvp.Key == "seriesId")) && (kvp.Value != "")) - body += ""; - else if ((kvp.Key == "IMDB_ID") || (kvp.Key == "imdbId")) - body += ""; - else if (kvp.Value != "") - body += ""; - } - - if (!firstInfo) - body += "
tv.comVisit
imdb.comVisit
" + kvp.Key + "" + kvp.Value + "
"; - - return body; - } - public static string GetShowImagesHtmlOverview(this ShowItem si) { SeriesInfo ser = si.TheSeries(); @@ -435,88 +347,6 @@ private static string ImageSection(string title, int width, int height, string b return string.IsNullOrEmpty(url) ? "" : $"

{title}


"; } - private static string GetSeasonHtmlOverviewOld(this ShowItem si,Season s) - { - SeriesInfo ser = s.TheSeries; - int snum = s.SeasonNumber; - string body = ""; - - if (!string.IsNullOrEmpty(ser.GetSeriesWideBannerPath()) && - !string.IsNullOrEmpty(TheTVDB.GetImageURL(ser.GetSeriesWideBannerPath()))) - body += "
"; - - List eis = GetBestEpisodes(si, s); - - string seasText = SeasonName(si, snum); - - if ((eis.Count > 0) && (eis[0].SeasonId > 0)) - seasText = " - " + - seasText + ""; - else - seasText = " - " + seasText; - - body += "

" + si.ShowName + - "" + seasText + "

"; - - DirFilesCache dfc = new DirFilesCache(); - foreach (ProcessedEpisode ei in eis) - { - string epl = ei.NumsAsString(); - - string episodeUrl = TheTVDB.Instance.WebsiteUrl(ei.SeriesId, ei.SeasonId, ei.EpisodeId); - - body += ""; // anchor - if (si.DvdOrder && snum == 0) - { - body += "" + ei.Name + ""; - } - else - body += "" + HttpUtility.HtmlEncode(CustomEpisodeName.NameForNoExt(ei, CustomEpisodeName.OldNStyle(6))) + - ""; - - body += ""; // anchor - if (si.UseSequentialMatch && (ei.OverallNumber != -1)) - body += " (#" + ei.OverallNumber + ")"; - - List fl = TVDoc.FindEpOnDisk(dfc, ei); - if (fl != null) - { - foreach (FileInfo fi in fl) - { - string urlFilename = HttpUtility.UrlEncode(fi.FullName); - body += $" Watch"; - body += $" Show in Explorer"; - } - } - else body += " Search"; - - DateTime? dt = ei.GetAirDateDT(true); - if ((dt != null) && (dt.Value.CompareTo(DateTime.MaxValue) != 0)) - body += "

" + dt.Value.ToShortDateString() + " (" + ei.HowLong() + ")"; - - body += "

"; - - if ((TVSettings.Instance.ShowEpisodePictures) || - (TVSettings.Instance.HideMyShowsSpoilers && ei.HowLong() != "Aired")) - { - body += ""; - body += "
" + GetOverview(ei) + ""; - // 300x168 / 300x225 - if (!string.IsNullOrEmpty(ei.Filename)) - body += ""; - - body += "
"; - } - else - body += GetOverview(ei); - - body += "


"; - } // for each episode in this season - - return body; - } - private static List GetBestEpisodes(ShowItem si, Season s) { return si.SeasonEpisodes.ContainsKey(s.SeasonNumber) @@ -524,38 +354,6 @@ private static List GetBestEpisodes(ShowItem si, Season s) : ShowItem.ProcessedListFromEpisodes(s.Episodes.Values, si); } - private static string GetOverview(ProcessedEpisode ei) - { - string overviewString = HiddenOverview(ei); - - bool firstInfo = true; - foreach (KeyValuePair kvp in ei.OtherItems()) - { - if (firstInfo) - { - overviewString += ""; - firstInfo = false; - } - - if ((kvp.Value != "") && kvp.Value != "0") - { - if (((kvp.Key == "IMDB_ID") || (kvp.Key == "imdbId"))) - overviewString += ""; - else if (((kvp.Key == "showUrl"))) - overviewString += ""; - else - overviewString += ""; - } - } - - if (!firstInfo) - overviewString += "
imdb.comVisit
LinkVisit
" + kvp.Key + "" + kvp.Value + "
"; - - return overviewString; - } - private static string HiddenOverview(this ProcessedEpisode ei) { string overviewString = ei.Overview;