Browse Source

set title, subtitle, category in xmltv (#68)

pull/69/head
Jason Dove 5 years ago committed by GitHub
parent
commit
914d128610
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 28
      ErsatzTV.Core/Iptv/ChannelGuide.cs
  2. 2
      ErsatzTV.Infrastructure/Data/Repositories/ChannelRepository.cs

28
ErsatzTV.Core/Iptv/ChannelGuide.cs

@ -64,11 +64,19 @@ namespace ErsatzTV.Core.Iptv @@ -64,11 +64,19 @@ namespace ErsatzTV.Core.Iptv
{
Movie m => m.MovieMetadata.HeadOrNone().Map(mm => mm.Title ?? string.Empty)
.IfNone("[unknown movie]"),
Episode e => e.EpisodeMetadata.HeadOrNone().Map(em => em.Title ?? string.Empty)
.IfNone("[unknown episode]"),
Episode e => e.Season.Show.ShowMetadata.HeadOrNone().Map(em => em.Title ?? string.Empty)
.IfNone("[unknown show]"),
_ => "[unknown]"
};
string subtitle = playoutItem.MediaItem switch
{
Episode e => e.EpisodeMetadata.HeadOrNone().Match(
em => em.Title ?? string.Empty,
() => string.Empty),
_ => string.Empty
};
string description = playoutItem.MediaItem switch
{
Movie m => m.MovieMetadata.HeadOrNone().Map(mm => mm.Plot ?? string.Empty).IfNone(string.Empty),
@ -89,11 +97,27 @@ namespace ErsatzTV.Core.Iptv @@ -89,11 +97,27 @@ namespace ErsatzTV.Core.Iptv
xml.WriteAttributeString("stop", stop);
xml.WriteAttributeString("channel", channel.Number);
if (playoutItem.MediaItem is Movie)
{
xml.WriteStartElement("category");
xml.WriteAttributeString("lang", "en");
xml.WriteString("Movie");
xml.WriteEndElement(); // category
}
xml.WriteStartElement("title");
xml.WriteAttributeString("lang", "en");
xml.WriteString(title);
xml.WriteEndElement(); // title
if (!string.IsNullOrWhiteSpace(subtitle))
{
xml.WriteStartElement("sub-title");
xml.WriteAttributeString("lang", "en");
xml.WriteString(subtitle);
xml.WriteEndElement(); // subtitle
}
xml.WriteStartElement("previously-shown");
xml.WriteEndElement(); // previously-shown

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

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

Loading…
Cancel
Save