Пример #1
0
        private void CreateMovieHtmlContent(StringBuilder sb, MovieResponseDto info)
        {
            AddImageInsideTable(sb, $"https://image.tmdb.org/t/p/original{info.PosterPath}");

            sb.Append("<tr>");
            TableData(sb);

            Href(sb, $"https://www.imdb.com/title/{info.ImdbId}/");
            var releaseDate = string.Empty;

            try
            {
                releaseDate = $"({DateTime.Parse(info.ReleaseDate).Year})";
            }
            catch (Exception)
            {
                // Swallow, couldn't parse the date
            }
            Header(sb, 3, $"{info.Title} {releaseDate}");
            EndTag(sb, "a");

            if (info.Genres.Any())
            {
                AddParagraph(sb,
                             $"Genre: {string.Join(", ", info.Genres.Select(x => x.Name.ToString()).ToArray())}");
            }

            AddParagraph(sb, info.Overview);
        }
Пример #2
0
        private void CreateMovieHtmlContent(StringBuilder sb, MovieResponseDto info, string mediaurl)
        {
            AddBackgroundInsideTable(sb, $"https://image.tmdb.org/t/p/w1280/{info.BackdropPath}");
            AddPosterInsideTable(sb, $"https://image.tmdb.org/t/p/original{info.PosterPath}");

            AddMediaServerUrl(sb, mediaurl, $"https://image.tmdb.org/t/p/original{info.PosterPath}");
            AddInfoTable(sb);

            var releaseDate = string.Empty;

            try
            {
                releaseDate = $"({DateTime.Parse(info.ReleaseDate).Year})";
            }
            catch (Exception)
            {
                // Swallow, couldn't parse the date
            }

            AddTitle(sb, $"https://www.imdb.com/title/{info.ImdbId}/", $"{info.Title} {releaseDate}");

            var summary = info.Overview;

            if (summary.Length > 280)
            {
                summary = summary.Remove(280);
                summary = summary + "...</p>";
            }
            AddParagraph(sb, summary);

            if (info.Genres.Any())
            {
                AddGenres(sb,
                          $"Genres: {string.Join(", ", info.Genres.Select(x => x.Name.ToString()).ToArray())}");
            }
        }
Пример #3
0
        private void CreateMovieHtmlContent(MovieResponseDto info, string mediaurl)
        {
            AddBackgroundInsideTable($"https://image.tmdb.org/t/p/w1280/{info.BackdropPath}");
            AddPosterInsideTable($"https://image.tmdb.org/t/p/original{info.PosterPath}");

            AddMediaServerUrl(mediaurl, $"https://image.tmdb.org/t/p/original{info.PosterPath}");
            AddInfoTable();

            var releaseDate = string.Empty;

            try
            {
                releaseDate = $"({DateTime.Parse(info.ReleaseDate).Year})";
            }
#pragma warning disable RCS1075 // Avoid empty catch clause that catches System.Exception.
            catch (Exception)
#pragma warning restore RCS1075 // Avoid empty catch clause that catches System.Exception.
            {
                // Swallow, couldn't parse the date
            }

            AddTitle($"https://www.imdb.com/title/{info.ImdbId}/", $"{info.Title} {releaseDate}");

            var summary = info.Overview;
            if (summary.Length > 280)
            {
                summary = summary.Remove(280);
                summary = summary + "...</p>";
            }
            AddParagraph(summary);

            if (info.Genres.Any())
            {
                AddGenres($"{Texts.GenresLabel} {string.Join(", ", info.Genres.Select(x => x.Name.ToString()).ToArray())}");
            }
        }