Browse Source

add episode posters to xmltv

pull/80/head
Jason Dove 5 years ago
parent
commit
e5a9ef6196
  1. 20
      ErsatzTV.Core/Iptv/ChannelGuide.cs
  2. 1
      ErsatzTV.Infrastructure/Data/Repositories/ChannelRepository.cs

20
ErsatzTV.Core/Iptv/ChannelGuide.cs

@ -152,6 +152,26 @@ namespace ErsatzTV.Core.Iptv @@ -152,6 +152,26 @@ namespace ErsatzTV.Core.Iptv
if (playoutItem.MediaItem is Episode episode)
{
Option<ShowMetadata> maybeMetadata =
Optional(episode.Season?.Show?.ShowMetadata.HeadOrNone()).Flatten();
if (maybeMetadata.IsSome)
{
ShowMetadata metadata = maybeMetadata.ValueUnsafe();
string poster = Optional(metadata.Artwork).Flatten()
.Filter(a => a.ArtworkKind == ArtworkKind.Poster)
.HeadOrNone()
.Match(
artwork => $"{_scheme}://{_host}/artwork/posters/{artwork.Path}",
() => string.Empty);
if (!string.IsNullOrWhiteSpace(poster))
{
xml.WriteStartElement("icon");
xml.WriteAttributeString("src", poster);
xml.WriteEndElement(); // icon
}
}
int s = Optional(episode.Season?.SeasonNumber).IfNone(0);
int e = episode.EpisodeNumber;
if (s > 0 && e > 0)

1
ErsatzTV.Infrastructure/Data/Repositories/ChannelRepository.cs

@ -56,6 +56,7 @@ namespace ErsatzTV.Infrastructure.Data.Repositories @@ -56,6 +56,7 @@ namespace ErsatzTV.Infrastructure.Data.Repositories
.ThenInclude(i => (i as Episode).Season)
.ThenInclude(s => s.Show)
.ThenInclude(s => s.ShowMetadata)
.ThenInclude(sm => sm.Artwork)
.Include(c => c.Playouts)
.ThenInclude(p => p.Items)
.ThenInclude(i => i.MediaItem)

Loading…
Cancel
Save