diff --git a/ErsatzTV.Core/Iptv/ChannelGuide.cs b/ErsatzTV.Core/Iptv/ChannelGuide.cs index b7b342480..9a8fc04a4 100644 --- a/ErsatzTV.Core/Iptv/ChannelGuide.cs +++ b/ErsatzTV.Core/Iptv/ChannelGuide.cs @@ -152,6 +152,26 @@ namespace ErsatzTV.Core.Iptv if (playoutItem.MediaItem is Episode episode) { + Option 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) diff --git a/ErsatzTV.Infrastructure/Data/Repositories/ChannelRepository.cs b/ErsatzTV.Infrastructure/Data/Repositories/ChannelRepository.cs index 5ba814ab1..993118763 100644 --- a/ErsatzTV.Infrastructure/Data/Repositories/ChannelRepository.cs +++ b/ErsatzTV.Infrastructure/Data/Repositories/ChannelRepository.cs @@ -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)