xmltv category improvements (#604)

This commit is contained in:
Jason Dove
2022-01-30 10:56:53 -06:00
committed by GitHub
parent 17bc988b49
commit b972947747
3 changed files with 41 additions and 10 deletions
+3
View File
@@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased]
### Added
- Include `Series` category tag for all episodes in XMLTV
- Include movie, episode (show) genres as `category` tags in XMLTV
## [0.4.0-alpha] - 2022-01-29
### Fixed
+26 -10
View File
@@ -9,7 +9,6 @@ using ErsatzTV.Core.Domain.Filler;
using ErsatzTV.Core.Emby;
using ErsatzTV.Core.Jellyfin;
using LanguageExt;
using LanguageExt.UnsafeValueAccess;
using Serilog;
using static LanguageExt.Prelude;
@@ -158,15 +157,20 @@ namespace ErsatzTV.Core.Iptv
xml.WriteString(metadata.Year.Value.ToString());
xml.WriteEndElement(); // date
}
}
xml.WriteStartElement("category");
xml.WriteAttributeString("lang", "en");
xml.WriteString("Movie");
xml.WriteEndElement(); // category
xml.WriteStartElement("category");
xml.WriteAttributeString("lang", "en");
xml.WriteString("Movie");
xml.WriteEndElement(); // category
foreach (Genre genre in Optional(metadata.Genres).Flatten())
{
xml.WriteStartElement("category");
xml.WriteAttributeString("lang", "en");
xml.WriteString(genre.Name);
xml.WriteEndElement(); // category
}
foreach (MovieMetadata metadata in movie.MovieMetadata.HeadOrNone())
{
string poster = Optional(metadata.Artwork).Flatten()
.Filter(a => a.ArtworkKind == ArtworkKind.Poster)
.HeadOrNone()
@@ -241,9 +245,21 @@ namespace ErsatzTV.Core.Iptv
{
Option<ShowMetadata> maybeMetadata =
Optional(episode.Season?.Show?.ShowMetadata.HeadOrNone()).Flatten();
if (maybeMetadata.IsSome)
foreach (ShowMetadata metadata in maybeMetadata)
{
ShowMetadata metadata = maybeMetadata.ValueUnsafe();
xml.WriteStartElement("category");
xml.WriteAttributeString("lang", "en");
xml.WriteString("Series");
xml.WriteEndElement(); // category
foreach (Genre genre in Optional(metadata.Genres).Flatten())
{
xml.WriteStartElement("category");
xml.WriteAttributeString("lang", "en");
xml.WriteString(genre.Name);
xml.WriteEndElement(); // category
}
string artwork = Optional(metadata.Artwork).Flatten()
.Filter(a => a.ArtworkKind == ArtworkKind.Thumbnail)
.HeadOrNone()
@@ -70,11 +70,23 @@ namespace ErsatzTV.Infrastructure.Data.Repositories
.Include(c => c.Playouts)
.ThenInclude(p => p.Items)
.ThenInclude(i => i.MediaItem)
.ThenInclude(i => (i as Episode).Season)
.ThenInclude(s => s.Show)
.ThenInclude(s => s.ShowMetadata)
.ThenInclude(em => em.Genres)
.Include(c => c.Playouts)
.ThenInclude(p => p.Items)
.ThenInclude(i => i.MediaItem)
.ThenInclude(i => (i as Movie).MovieMetadata)
.ThenInclude(mm => mm.Artwork)
.Include(c => c.Playouts)
.ThenInclude(p => p.Items)
.ThenInclude(i => i.MediaItem)
.ThenInclude(i => (i as Movie).MovieMetadata)
.ThenInclude(mm => mm.Genres)
.Include(c => c.Playouts)
.ThenInclude(p => p.Items)
.ThenInclude(i => i.MediaItem)
.ThenInclude(i => (i as MusicVideo).MusicVideoMetadata)
.ThenInclude(mm => mm.Artwork)
.Include(c => c.Playouts)