Example #1
0
        private static void AppendSeason(this StringBuilder sb, Season s, [CanBeNull] ShowItem si, Color backgroundColour, bool includeDirectoryLinks)
        {
            if (si is null)
            {
                return;
            }

            string seasonLink  = TheTVDB.API.WebsiteSeasonUrl(s);
            string showLink    = TheTVDB.API.WebsiteShowUrl(si);
            string urlFilename = Uri.EscapeDataString(si.GetBestFolderLocationToOpen(s));

            string explorerButton = includeDirectoryLinks
                ? CreateButton($"{UI.EXPLORE_PROXY}{urlFilename}", "<i class=\"far fa-folder-open\"></i>", "Open Containing Folder")
                : string.Empty;
            string tvdbButton  = CreateButton(seasonLink, "TVDB.com", "View on TVDB");
            string episodeText = s.Episodes.Count > 0 ? $"<br/><small class=\"text-muted\">{s.Episodes.Count} Episodes</small>" :string.Empty;

            sb.AppendLine($@"<div class=""card card-body"" style=""background-color:{backgroundColour.HexColour()}"">
				{s.CreateHorizontalBannerHtml()}
				<br/>
                <div class=""row"">
                    <div class=""col-8""><h1><A HREF=""{showLink}"">{si.ShowName}</A> - <A HREF=""{seasonLink}"">{SeasonName(si, s.SeasonNumber)}</a></h1></div>
                    <div class=""col-4 text-right"">
                        {explorerButton}
                        {tvdbButton}
                        {episodeText}
                    </div>
                </div>
				</div>"                );
        }
Example #2
0
        private static void AppendSeason(this StringBuilder sb, Season s, [CanBeNull] ShowItem si, Color backgroundColour, bool includeDirectoryLinks)
        {
            if (si is null)
            {
                return;
            }

            SeriesInfo ser         = s.TheSeries;
            string     seasonLink  = TheTVDB.Instance.WebsiteUrl(ser.TvdbCode, s.SeasonId, false);
            string     showLink    = TheTVDB.Instance.WebsiteUrl(si.TvdbCode, -1, true);
            string     urlFilename = Uri.EscapeDataString(si.GetBestFolderLocationToOpen(s));

            string explorerButton = includeDirectoryLinks
                ? CreateButton($"{UI.EXPLORE_PROXY}{urlFilename}", "<i class=\"far fa-folder-open\"></i>", "Open Containing Folder")
                : string.Empty;
            string tvdbButton = CreateButton(seasonLink, "TVDB.com", "View on TVDB");

            sb.AppendLine($@"<div class=""card card-body"" style=""background-color:{backgroundColour.HexColour()}"">
				{s.CreateHorizontalBannerHtml()}
				<br/>
                <div class=""row"">
                    <div class=""col-8""><h1><A HREF=""{showLink}"">{ser.Name}</A> - <A HREF=""{seasonLink}"">{SeasonName(si, s.SeasonNumber)}</a></h1></div>
                    <div class=""col-4"">
                        {explorerButton}
                        {tvdbButton}
                    </div>
                </div>
				</div>"                );
        }
Example #3
0
        private static void AppendShow(this StringBuilder sb, ShowItem si, Color backgroundColour)
        {
            if (si == null)
            {
                return;
            }

            SeriesInfo ser = si.TheSeries();
            string     horizontalBanner = CreateHorizontalBannerHtml(ser);
            string     poster           = CreatePosterHtml(ser);
            int        minYear          = si.TheSeries().MinYear();
            int        maxYear          = si.TheSeries().MaxYear();
            string     yearRange        = (minYear == maxYear) ? minYear.ToString() : minYear + "-" + maxYear;
            string     episodeSummary   = si.TheSeries().AiredSeasons.Sum(pair => pair.Value.Episodes.Count).ToString();
            string     stars            = StarRating(si.TheSeries().GetSiteRating());
            string     genreIcons       = string.Join("&nbsp;", si.TheSeries().GetGenres().Select(GenreIconHtml));
            bool       ratingIsNumber   = float.TryParse(si.TheSeries().GetSiteRating(), NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite, CultureInfo.CreateSpecificCulture("en-US"), out float rating);
            string     siteRating       = ratingIsNumber && rating > 0 ? rating + "/10" : "";
            string     runTimeHtml      = string.IsNullOrWhiteSpace(ser.GetRuntime()) ? string.Empty : $"<br/> {ser.GetRuntime()} min";
            string     actorLinks       = string.Join(", ", si.TheSeries().GetActors().Select(ActorLinkHtml));
            string     tvdbLink         = TheTVDB.Instance.WebsiteUrl(si.TvdbCode, -1, true);
            string     airsTime         = ParseAirsTime(ser);
            string     airsDay          = ser.GetAirsDay();
            string     dayTime          = $"{airsDay} {airsTime}";

            string tvLink   = string.IsNullOrWhiteSpace(ser.GetSeriesId()) ? string.Empty : "http://www.tv.com/show/" + ser.GetSeriesId() + "/summary.html";
            string imdbLink = string.IsNullOrWhiteSpace(ser.GetImdb()) ? string.Empty : "http://www.imdb.com/title/" + ser.GetImdb();

            string urlFilename    = HttpUtility.UrlEncode(si.GetBestFolderLocationToOpen());
            string explorerButton = CreateButton($"{UI.EXPLORE_PROXY}{urlFilename}", "<i class=\"far fa-folder-open\"></i>", "Open Containing Folder");

            sb.AppendLine($@"<div class=""card card-body"" style=""background-color:{backgroundColour.HexColour()}"">
                <div class=""text-center"">
	             {horizontalBanner}
                  <div class=""row"">
                   <div class=""col-md-4"">
                    {poster}
                   </div>
                   <div class=""col-md-8 d-flex flex-column"">
                    <div class=""row"">
                     <div class=""col-md-8""><h1>{ser.Name}</h1></div>
                     <div class=""col-md-4 text-right""><h6>{yearRange} ({si.TheSeries().GetStatus()})</h6><small class=""text-muted"">{episodeSummary} Episodes{runTimeHtml}</small></div>
                    </div>
                    <div><p class=""lead"">{ser.GetOverview()}</p></div>
			        <div><blockquote>{actorLinks}</blockquote></div> 
		            <div>
                     {explorerButton}
			         {CreateButton(tvdbLink, "TVDB.com", "View on TVDB")}
			         {CreateButton(imdbLink, "IMDB.com", "View on IMDB")}
			         {CreateButton(tvLink, "TV.com", "View on TV.com")}
			        </div>
		            <div class=""row align-items-bottom flex-grow-1"">
                     <div class=""col-md-4 align-self-end"">{stars}<br>{siteRating}{AddRatingCount(ser.GetSiteRatingVotes())}</div>
                     <div class=""col-md-4 align-self-end text-center"">{si.TheSeries().GetContentRating()}<br>{si.TheSeries().GetNetwork()}, {dayTime}</div>
                     <div class=""col-md-4 align-self-end text-right"">{genreIcons}<br>{string.Join(", ", si.TheSeries().GetGenres())}</div>
                    </div>
                   </div>
                  </div>
                 </div>");
        }
Example #4
0
        private static void AppendShow(this StringBuilder sb, [CanBeNull] ShowItem si, Color backgroundColour, bool includeDirectoryLinks)
        {
            SeriesInfo ser = si?.TheSeries();

            if (ser is null)
            {
                return;
            }
            string horizontalBanner = CreateHorizontalBannerHtml(ser);
            string poster           = CreatePosterHtml(ser);
            string yearRange        = YearRange(ser);
            string episodeSummary   = ser.AiredSeasons.Sum(pair => pair.Value.Episodes.Count).ToString();
            string stars            = StarRating(ser.SiteRating / 2);
            string genreIcons       = string.Join("&nbsp;", ser.Genres().Select(GenreIconHtml));
            string siteRating       = ser.SiteRating > 0 ? ser.SiteRating + "/10" : "";
            string runTimeHtml      = string.IsNullOrWhiteSpace(ser.Runtime) ? string.Empty : $"<br/> {ser.Runtime} min";
            string actorLinks       = string.Join(", ", ser.GetActors().Select(ActorLinkHtml));
            string tvdbLink         = TheTVDB.Instance.WebsiteUrl(si.TvdbCode, -1, true);
            string airsTime         = ParseAirsTime(ser);
            string airsDay          = ser.AirsDay;
            string dayTime          = $"{airsDay} {airsTime}";

            string tvLink   = string.IsNullOrWhiteSpace(ser.SeriesId) ? string.Empty : "http://www.tv.com/show/" + ser.SeriesId + "/summary.html";
            string imdbLink = string.IsNullOrWhiteSpace(ser.Imdb) ? string.Empty : "http://www.imdb.com/title/" + ser.Imdb;

            string urlFilename = includeDirectoryLinks
                ? Uri.EscapeDataString(si.GetBestFolderLocationToOpen())
                : string.Empty;
            string explorerButton = includeDirectoryLinks
                ? CreateButton($"{UI.EXPLORE_PROXY}{urlFilename}", "<i class=\"far fa-folder-open\"></i>", "Open Containing Folder")
                : string.Empty;

            sb.AppendLine($@"<div class=""card card-body"" style=""background-color:{backgroundColour.HexColour()}"">
                <div class=""text-center"">
	             {horizontalBanner}
                </div>
                  <div class=""row"">
                   <div class=""col-md-4"">
                    {poster}
                   </div>
                   <div class=""col-md-8 d-flex flex-column"">
                    <div class=""row"">
                     <div class=""col-md-8""><h1>{ser.Name}</h1></div>
                     <div class=""col-md-4 text-right""><h6>{yearRange} ({ser.Status})</h6><small class=""text-muted"">{episodeSummary} Episodes{runTimeHtml}</small></div>
                    </div>
                    <div><p class=""lead"">{ser.Overview}</p></div>
			        <div><blockquote>{actorLinks}</blockquote></div> 
		            <div>
                     {explorerButton}
			         {CreateButton(tvdbLink, "TVDB.com", "View on TVDB")}
			         {CreateButton(imdbLink, "IMDB.com", "View on IMDB")}
			         {CreateButton(tvLink, "TV.com", "View on TV.com")}
			        </div>
		            <div>
                        &nbsp;
			        </div>
		            <div class=""row align-items-bottom"">
                     <div class=""col-md-4 align-self-end"">{stars}<br>{siteRating}{AddRatingCount(ser.SiteRatingVotes)}</div>
                     <div class=""col-md-4 align-self-end text-center"">{ser.ContentRating}<br>{ser.Network}, {dayTime}</div>
                     <div class=""col-md-4 align-self-end text-right"">{genreIcons}<br>{string.Join(", ", ser.Genres())}</div>
                    </div>
                   </div>
                  </div>
                 </div>");
            //Ideally we'd have <div class=""row align-items-bottom flex-grow-1""> in there as it looks better, but a bug in IE prevents it from looking correct
        }