Browse Source

Include music video thumbnail in epg (#443)

* include music video thumbnail in epg

* update changelog
pull/444/head
Jason Dove 5 years ago committed by GitHub
parent
commit
4cf44616a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      CHANGELOG.md
  2. 33
      ErsatzTV.Core/Iptv/ChannelGuide.cs

3
CHANGELOG.md

@ -12,6 +12,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). @@ -12,6 +12,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix bug with `Duration` mode scheduling when media items are too long to fit in the requested duration
- Fix bug with `Duration` mode scheduling with `Filler` tail mode where other duration items in the schedule would be skipped
### Added
- Include music video thumbnails in channel guide (xmltv)
### Changed
- Automatically find working Plex address on startup
- Change default log level from `Debug` to `Information`

33
ErsatzTV.Core/Iptv/ChannelGuide.cs

@ -175,6 +175,39 @@ namespace ErsatzTV.Core.Iptv @@ -175,6 +175,39 @@ namespace ErsatzTV.Core.Iptv
}
}
if (!hasCustomTitle && startItem.MediaItem is MusicVideo musicVideo)
{
foreach (MusicVideoMetadata metadata in musicVideo.MusicVideoMetadata.HeadOrNone())
{
if (metadata.Year.HasValue)
{
xml.WriteStartElement("date");
xml.WriteString(metadata.Year.Value.ToString());
xml.WriteEndElement(); // date
}
}
xml.WriteStartElement("category");
xml.WriteAttributeString("lang", "en");
xml.WriteString("Music");
xml.WriteEndElement(); // category
foreach (MusicVideoMetadata metadata in musicVideo.MusicVideoMetadata.HeadOrNone())
{
string thumbnail = Optional(metadata.Artwork).Flatten()
.Filter(a => a.ArtworkKind == ArtworkKind.Thumbnail)
.HeadOrNone()
.Match(a => GetArtworkUrl(a, ArtworkKind.Thumbnail), () => string.Empty);
if (!string.IsNullOrWhiteSpace(thumbnail))
{
xml.WriteStartElement("icon");
xml.WriteAttributeString("src", thumbnail);
xml.WriteEndElement(); // icon
}
}
}
if (startItem.MediaItem is Episode episode && (!hasCustomTitle || isSameCustomShow))
{
Option<ShowMetadata> maybeMetadata =

Loading…
Cancel
Save