Exemplo n.º 1
0
        private ShowSummaryData.ShowSummarySeasonData getSeasonDetails(ShowItem si, SeriesInfo ser, int snum)
        {
            int           epCount      = 0;
            int           epGotCount   = 0;
            int           epAiredCount = 0;
            DirFilesCache dfc          = new DirFilesCache();

            Season season = null;

            Dictionary <int, Season> seasons = si.DVDOrder ? ser.DVDSeasons : ser.AiredSeasons;

            if ((snum >= 0) && (seasons.ContainsKey(snum)))
            {
                season = seasons[snum];

                List <ProcessedEpisode> eis;

                if (si.SeasonEpisodes.ContainsKey(snum))
                {
                    eis = si.SeasonEpisodes[snum]; // use processed episodes if they are available
                }
                else
                {
                    eis = ShowItem.ProcessedListFromEpisodes(season.Episodes, si);
                }

                foreach (ProcessedEpisode ei in eis)
                {
                    epCount++;

                    // if has air date and has been aired in the past
                    if (ei.FirstAired != null && ei.FirstAired < DateTime.Now)
                    {
                        epAiredCount++;
                    }

                    List <Alphaleonis.Win32.Filesystem.FileInfo> fl = TVDoc.FindEpOnDisk(dfc, ei, false);
                    if (fl != null)
                    {
                        if (fl.Count != 0)
                        {
                            epGotCount++;
                        }
                    }
                }
            }
            return(new ShowSummaryData.ShowSummarySeasonData(snum, epCount, epAiredCount, epGotCount, season));
        }
Exemplo n.º 2
0
        public static string GetSeasonImagesHtmlOverview([NotNull] this ShowItem si, [NotNull] Season s)
        {
            SeriesInfo ser  = s.TheSeries;
            int        snum = s.SeasonNumber;
            string     body = "";

            List <ProcessedEpisode> eis = si.SeasonEpisodes.ContainsKey(snum)
                ? si.SeasonEpisodes[snum]
                : ShowItem.ProcessedListFromEpisodes(s.Episodes.Values, si);

            string seasText = Season.UIFullSeasonWord(snum);

            if ((eis.Count > 0) && (eis[0].SeasonId > 0))
            {
                seasText = " - <A HREF=\"" + TheTVDB.Instance.WebsiteUrl(si.TvdbCode, eis[0].SeasonId, false) + "\">" +
                           seasText + "</a>";
            }
            else
            {
                seasText = " - " + seasText;
            }

            body += "<h1><A HREF=\"" + TheTVDB.Instance.WebsiteUrl(si.TvdbCode, -1, true) + "\">" + si.ShowName +
                    "</A>" + seasText + "</h1>";

            if (TVSettings.Instance.NeedToDownloadBannerFile())
            {
                body += ImageSection("Series Banner", 758, 140, ser.GetSeasonWideBannerPath(snum));
                body += ImageSection("Series Poster", 350, 500, ser.GetSeasonBannerPath(snum));
            }
            else
            {
                body +=
                    "<h2>Images are not being downloaded for this series. Please see Options -> Preferences -> Media Center to reconfigure.</h2>";
            }

            return(body);
        }
Exemplo n.º 3
0
        private ShowSummaryData.ShowSummarySeasonData getSeasonDetails([NotNull] ShowItem si, [NotNull] SeriesInfo ser, int snum)
        {
            int           epCount      = 0;
            int           epGotCount   = 0;
            int           epAiredCount = 0;
            DirFilesCache dfc          = new DirFilesCache();
            Season        season       = null;

            Dictionary <int, Season> seasons = si.DvdOrder ? ser.DvdSeasons : ser.AiredSeasons;

            if (snum >= 0 && seasons.ContainsKey(snum))
            {
                season = seasons[snum];

                List <ProcessedEpisode> eis = si.SeasonEpisodes.ContainsKey(snum)
                    ? si.SeasonEpisodes[snum] // use processed episodes if they are available
                    : ShowItem.ProcessedListFromEpisodes(season.Episodes.Values, si);

                foreach (ProcessedEpisode ei in eis)
                {
                    epCount++;

                    // if has air date and has been aired in the past
                    if (ei.FirstAired != null && ei.FirstAired < DateTime.Now)
                    {
                        epAiredCount++;
                    }

                    List <FileInfo> fl = dfc.FindEpOnDisk(ei, false);
                    if (fl.Count != 0)
                    {
                        epGotCount++;
                    }
                }
            }
            return(new ShowSummaryData.ShowSummarySeasonData(snum, epCount, epAiredCount, epGotCount, season, si.IgnoreSeasons.Contains(snum)));
        }
Exemplo n.º 4
0
        public static string GetSeasonHtmlOverviewOffline([NotNull] this ShowItem si, [NotNull] Season s)
        {
            SeriesInfo ser  = s.TheSeries;
            int        snum = s.SeasonNumber;
            string     body = "";

            if (!string.IsNullOrEmpty(ser.GetSeriesWideBannerPath()) &&
                !string.IsNullOrEmpty(TheTVDB.GetImageURL(ser.GetSeriesWideBannerPath())))
            {
                body += "<img width=758 height=140 src=\"" + TheTVDB.GetImageURL(ser.GetSeriesWideBannerPath()) +
                        "\"><br/>";
            }

            List <ProcessedEpisode> eis = si.SeasonEpisodes.ContainsKey(snum) ?
                                          si.SeasonEpisodes[snum] :
                                          ShowItem.ProcessedListFromEpisodes(s.Episodes.Values, si);

            string seasText = SeasonName(si, snum);

            if ((eis.Count > 0) && (eis[0].SeasonId > 0))
            {
                seasText = " - <A HREF=\"" + TheTVDB.Instance.WebsiteUrl(ser.TvdbCode, eis[0].SeasonId, false) + "\">" +
                           seasText + "</a>";
            }
            else
            {
                seasText = " - " + seasText;
            }

            body += "<h1><A HREF=\"" + TheTVDB.Instance.WebsiteUrl(si.TvdbCode, -1, true) + "\">" + si.ShowName +
                    "</A>" + seasText + "</h1>";

            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 += "<A href=\"" + episodeUrl + "\" name=\"ep" + epl + "\">"; // anchor
                if (si.DvdOrder && snum == 0)
                {
                    body += "<b>" + ei.Name + "</b>";
                }
                else
                {
                    body += "<b>" + HttpUtility.HtmlEncode(CustomEpisodeName.NameForNoExt(ei, CustomEpisodeName.OldNStyle(6))) +
                            "</b>";
                }

                body += "</A>"; // anchor
                if (si.UseSequentialMatch && (ei.OverallNumber != -1))
                {
                    body += " (#" + ei.OverallNumber + ")";
                }

                List <FileInfo> fl = dfc.FindEpOnDisk(ei);
                if (fl.Count > 0)
                {
                    foreach (FileInfo fi in fl)
                    {
                        string urlFilename = HttpUtility.UrlEncode(fi.FullName);
                        body += $" <A HREF=\"watch://{urlFilename}\" class=\"search\">Watch</A>";
                        body += $" <A HREF=\"explore://{urlFilename}\" class=\"search\">Show in Explorer</A>";
                    }
                }
                else
                {
                    body += " <A HREF=\"" + TVSettings.Instance.BTSearchURL(ei) + "\" class=\"search\">Search</A>";
                }

                DateTime?dt = ei.GetAirDateDt(true);
                if ((dt != null) && (dt.Value.CompareTo(DateTime.MaxValue) != 0))
                {
                    body += "<p>" + dt.Value.ToShortDateString() + " (" + ei.HowLong() + ")";
                }

                body += "<p><p>";

                if ((TVSettings.Instance.ShowEpisodePictures) ||
                    (TVSettings.Instance.HideMyShowsSpoilers && ei.HowLong() != "Aired"))
                {
                    body += "<table><tr>";
                    body += "<td width=100% valign=top>" + GetOverview(ei) + "</td><td width=300 height=225>";
                    // 300x168 / 300x225
                    if (!string.IsNullOrEmpty(ei.Filename))
                    {
                        body += "<img src=" + TheTVDB.GetImageURL(ei.Filename) + ">";
                    }

                    body += "</td></tr></table>";
                }
                else
                {
                    body += GetOverview(ei);
                }

                body += "<p><hr><p>";
            } // for each episode in this season

            return(body);
        }
Exemplo n.º 5
0
 private static IEnumerable <ProcessedEpisode> GetBestEpisodes([NotNull] ShowItem si, [NotNull] Season s)
 {
     return(si.SeasonEpisodes.ContainsKey(s.SeasonNumber)
         ? si.SeasonEpisodes[s.SeasonNumber]
         : ShowItem.ProcessedListFromEpisodes(s.Episodes.Values, si));
 }
Exemplo n.º 6
0
 private static List <ProcessedEpisode> GetBestEpisodes(ShowItem si, Season s)
 {
     return(si.SeasonEpisodes.ContainsKey(s.SeasonNumber)
         ? si.SeasonEpisodes[s.SeasonNumber]
         : ShowItem.ProcessedListFromEpisodes(s.Episodes.Values, si));
 }