Ejemplo n.º 1
0
        private static string CreateHtml(ShowItem si)
        {
            string posterUrl      = TheTVDB.GetImageURL(si.TheSeries().GetImage(TVSettings.FolderJpgIsType.Poster));
            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          = ShowHtmlHelper.StarRating(si.TheSeries().GetSiteRating());
            string genreIcons     = string.Join(" ", si.TheSeries().GetGenres().Select(ShowHtmlHelper.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" : "";

            return($@"<div class=""card card-body"">
            <div class=""row"">
            <div class=""col-md-4"">
                <img class=""show-poster rounded w-100"" src=""{posterUrl}"" alt=""{si.ShowName} Show Poster""></div>
            <div class=""col-md-8 d-flex flex-column"">
                <div class=""row"">
                    <div class=""col-md-8""><h1>{si.ShowName}</h1></div>
                    <div class=""col-md-4 text-right""><h6>{yearRange} ({si.TheSeries().GetStatus()})</h6><small class=""text-muted"">{episodeSummary} Episodes</small></div>
                </div>
            <div><blockquote>{si.TheSeries().GetOverview()}</blockquote></div>
            <div><blockquote>{string.Join(", ", si.TheSeries().GetActorNames())}</blockquote></div>
            <div class=""row align-items-bottom flex-grow-1"">
                <div class=""col-md-4 align-self-end"">{stars}<br>{siteRating}</div>
                <div class=""col-md-4 align-self-end text-center"">{si.TheSeries().GetContentRating()}<br>{si.TheSeries().GetNetwork()}</div>
                <div class=""col-md-4 align-self-end text-right"">{genreIcons}<br>{string.Join(", ", si.TheSeries().GetGenres())}</div>
            </div>
            </div></div></div>");
        }
Ejemplo n.º 2
0
        public override void Run()
        {
            if (!Active())
            {
                return;
            }

            try
            {
                using (System.IO.StreamWriter file = new System.IO.StreamWriter(Location()))
                {
                    file.WriteLine(ShowHtmlHelper.HTMLHeader(8, Color.White));
                    foreach (ShowItem si in Shows)
                    {
                        file.WriteLine(CreateHtml(si));
                    }

                    file.WriteLine(ShowHtmlHelper.HTMLFooter());
                }
            }
            catch (Exception e)
            {
                LOGGER.Error(e);
            }
        }
Ejemplo n.º 3
0
        private static string CreateHtml([NotNull] ShowItem si)
        {
            SeriesInfo series = si.TheSeries();

            if (series is null)
            {
                return(string.Empty);
            }

            string posterUrl      = TheTVDB.GetImageURL(series.GetImage(TVSettings.FolderJpgIsType.Poster));
            string yearRange      = ShowHtmlHelper.YearRange(series);
            string episodeSummary = series.AiredSeasons.Sum(pair => pair.Value.Episodes.Count).ToString();
            string stars          = ShowHtmlHelper.StarRating(series.SiteRating / 2);
            string genreIcons     = string.Join("&nbsp;", series.Genres().Select(ShowHtmlHelper.GenreIconHtml));
            string siteRating     = series.SiteRating > 0 ? series.SiteRating + "/10" : "";

            return($@"<div class=""card card-body"">
            <div class=""row"">
            <div class=""col-md-4"">
                <img class=""show-poster rounded w-100"" src=""{posterUrl}"" alt=""{si.ShowName} Show Poster""></div>
            <div class=""col-md-8 d-flex flex-column"">
                <div class=""row"">
                    <div class=""col-md-8""><h1>{si.ShowName}</h1></div>
                    <div class=""col-md-4 text-right""><h6>{yearRange} ({series.Status})</h6><small class=""text-muted"">{episodeSummary} Episodes</small></div>
                </div>
            <div><blockquote>{series.Overview}</blockquote></div>
            <div><blockquote>{string.Join(", ", series.GetActorNames())}</blockquote></div>
            <div class=""row align-items-bottom flex-grow-1"">
                <div class=""col-md-4 align-self-end"">{stars}<br>{siteRating}</div>
                <div class=""col-md-4 align-self-end text-center"">{series.ContentRating}<br>{series.Network}</div>
                <div class=""col-md-4 align-self-end text-right"">{genreIcons}<br>{string.Join(", ", series.Genres())}</div>
            </div>
            </div></div></div>");
        }
Ejemplo n.º 4
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            Season s = (Season)value;

            if (s is null)
            {
                return("Unknown Season");
            }
            return(ShowHtmlHelper.SeasonName(s));
        }
Ejemplo n.º 5
0
        protected override void Do()
        {
            using (System.IO.StreamWriter file = new System.IO.StreamWriter(Location()))
            {
                file.WriteLine(ShowHtmlHelper.HTMLHeader(8, Color.White));
                foreach (MovieConfiguration si in Shows)
                {
                    try
                    {
                        file.WriteLine(CreateHtml(si));
                    }
                    catch (Exception ex)
                    {
                        LOGGER.Error(ex,
                                     $"Skipped adding {si.ShowName} to the outpur HTML as it is missing some data. Please try checking the settings and doing a force refresh on the show.");
                    }
                }

                file.WriteLine(ShowHtmlHelper.HTMLFooter());
            }
        }
Ejemplo n.º 6
0
        private static string CreateHtml([NotNull] MovieConfiguration si)
        {
            CachedMovieInfo cachedSeries = si.CachedMovie;

            if (cachedSeries is null)
            {
                return(string.Empty);
            }

            string yearRange  = cachedSeries.Year?.ToString() ?? "";
            string stars      = ShowHtmlHelper.StarRating(cachedSeries.SiteRating / 2);
            string genreIcons = string.Join("&nbsp;", cachedSeries.Genres.Select(ShowHtmlHelper.GenreIconHtml));
            string siteRating = cachedSeries.SiteRating > 0 ? cachedSeries.SiteRating + "/10" : "";

            string poster      = ShowHtmlHelper.CreatePosterHtml(cachedSeries);
            string runTimeHtml = string.IsNullOrWhiteSpace(cachedSeries.Runtime) ? string.Empty : $"<br/> {cachedSeries.Runtime} min";

            return($@"<div class=""card card-body"">
            <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>{si.ShowName}</h1><small class=""text-muted"">{cachedSeries.TagLine}</small></div>
                    <div class=""col-md-4 text-right""><h6>{yearRange} ({cachedSeries.Status})</h6>
<small class=""text-muted"">{cachedSeries.ShowLanguage} - {cachedSeries.Type}</small>
                        <small class=""text-muted"">{runTimeHtml}</small></div>
</div>
                
            <div><blockquote>{cachedSeries.Overview}</blockquote></div>
            <div><blockquote>{cachedSeries.GetActorNames().ToCsv()}</blockquote></div>
            <div class=""row align-items-bottom flex-grow-1"">
                <div class=""col-md-4 align-self-end"">{stars}<br>{siteRating}{ShowHtmlHelper.AddRatingCount(cachedSeries.SiteRatingVotes)}</div>
                <div class=""col-md-4 align-self-end text-center"">{cachedSeries.ContentRating}<br>{cachedSeries.Network}</div>
                <div class=""col-md-4 align-self-end text-right"">{genreIcons}<br>{cachedSeries.Genres.ToCsv()}</div>
            </div>
            </div></div></div>");
        }