Browse Source

more xmltv category improvements (#606)

pull/608/head
Jason Dove 4 years ago committed by GitHub
parent
commit
c9b557f2e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      CHANGELOG.md
  2. 36
      ErsatzTV.Core/Iptv/ChannelGuide.cs
  3. 6
      ErsatzTV.Infrastructure/Data/Repositories/ChannelRepository.cs

2
CHANGELOG.md

@ -9,7 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). @@ -9,7 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Added
- Include `Series` category tag for all episodes in XMLTV
- Include movie, episode (show) genres as `category` tags in XMLTV
- Include movie, episode (show), music video (artist) genres as `category` tags in XMLTV
## [0.4.0-alpha] - 2022-01-29
### Fixed

36
ErsatzTV.Core/Iptv/ChannelGuide.cs

@ -195,15 +195,35 @@ namespace ErsatzTV.Core.Iptv @@ -195,15 +195,35 @@ namespace ErsatzTV.Core.Iptv
xml.WriteString(metadata.Year.Value.ToString());
xml.WriteEndElement(); // date
}
}
xml.WriteStartElement("category");
xml.WriteAttributeString("lang", "en");
xml.WriteString("Music");
xml.WriteEndElement(); // category
xml.WriteStartElement("category");
xml.WriteAttributeString("lang", "en");
xml.WriteString("Music");
xml.WriteEndElement(); // category
// music video genres
foreach (Genre genre in Optional(metadata.Genres).Flatten())
{
xml.WriteStartElement("category");
xml.WriteAttributeString("lang", "en");
xml.WriteString(genre.Name);
xml.WriteEndElement(); // category
}
// artist genres
Option<ArtistMetadata> maybeMetadata =
Optional(musicVideo.Artist?.ArtistMetadata.HeadOrNone()).Flatten();
foreach (ArtistMetadata artistMetadata in maybeMetadata)
{
foreach (Genre genre in Optional(artistMetadata.Genres).Flatten())
{
xml.WriteStartElement("category");
xml.WriteAttributeString("lang", "en");
xml.WriteString(genre.Name);
xml.WriteEndElement(); // category
}
}
foreach (MusicVideoMetadata metadata in musicVideo.MusicVideoMetadata.HeadOrNone())
{
string thumbnail = Optional(metadata.Artwork).Flatten()
.Filter(a => a.ArtworkKind == ArtworkKind.Thumbnail)
.HeadOrNone()
@ -217,7 +237,7 @@ namespace ErsatzTV.Core.Iptv @@ -217,7 +237,7 @@ namespace ErsatzTV.Core.Iptv
}
}
}
if (!hasCustomTitle && displayItem.MediaItem is Song song)
{
xml.WriteStartElement("category");

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

@ -92,8 +92,14 @@ namespace ErsatzTV.Infrastructure.Data.Repositories @@ -92,8 +92,14 @@ namespace ErsatzTV.Infrastructure.Data.Repositories
.Include(c => c.Playouts)
.ThenInclude(p => p.Items)
.ThenInclude(i => i.MediaItem)
.ThenInclude(i => (i as MusicVideo).MusicVideoMetadata)
.ThenInclude(mvm => mvm.Genres)
.Include(c => c.Playouts)
.ThenInclude(p => p.Items)
.ThenInclude(i => i.MediaItem)
.ThenInclude(i => (i as MusicVideo).Artist)
.ThenInclude(a => a.ArtistMetadata)
.ThenInclude(am => am.Genres)
.Include(c => c.Playouts)
.ThenInclude(p => p.Items)
.ThenInclude(i => i.MediaItem)

Loading…
Cancel
Save