Browse Source

include all content ratings in xmltv (#256)

pull/257/head
Jason Dove 5 years ago committed by GitHub
parent
commit
fc59c9c284
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      CHANGELOG.md
  2. 5
      ErsatzTV.Core/Emby/EmbyTelevisionLibraryScanner.cs
  3. 16
      ErsatzTV.Core/Iptv/ChannelGuide.cs
  4. 5
      ErsatzTV.Core/Jellyfin/JellyfinTelevisionLibraryScanner.cs
  5. 1
      ErsatzTV.sln.DotSettings

2
CHANGELOG.md

@ -11,9 +11,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). @@ -11,9 +11,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Changed
- Remove framerate normalization; it caused more problems than it solved
- Include non-US (and unknown) content ratings in XMLTV
### Fixed
- Fix serving channels.m3u with missing content ratings
- Fix percent progress indicator for Jellyfin and Emby show library scans
## [0.0.44-prealpha] - 2021-06-09
### Added

5
ErsatzTV.Core/Emby/EmbyTelevisionLibraryScanner.cs

@ -115,9 +115,10 @@ namespace ErsatzTV.Core.Emby @@ -115,9 +115,10 @@ namespace ErsatzTV.Core.Emby
List<EmbyItemEtag> existingShows,
List<EmbyShow> shows)
{
foreach (EmbyShow incoming in shows.OrderBy(s => s.ShowMetadata.Head().Title))
var sortedShows = shows.OrderBy(s => s.ShowMetadata.Head().Title).ToList();
foreach (EmbyShow incoming in sortedShows)
{
decimal percentCompletion = (decimal) shows.IndexOf(incoming) / shows.Count;
decimal percentCompletion = (decimal) sortedShows.IndexOf(incoming) / shows.Count;
await _mediator.Publish(new LibraryScanProgress(library.Id, percentCompletion));
Option<EmbyItemEtag> maybeExisting = existingShows.Find(ie => ie.ItemId == incoming.ItemId);

16
ErsatzTV.Core/Iptv/ChannelGuide.cs

@ -215,7 +215,11 @@ namespace ErsatzTV.Core.Iptv @@ -215,7 +215,11 @@ namespace ErsatzTV.Core.Iptv
foreach (ContentRating rating in contentRating)
{
xml.WriteStartElement("rating");
xml.WriteAttributeString("system", rating.System);
foreach (string system in rating.System)
{
xml.WriteAttributeString("system", system);
}
xml.WriteStartElement("value");
xml.WriteString(rating.Value);
xml.WriteEndElement(); // value
@ -354,15 +358,17 @@ namespace ErsatzTV.Core.Iptv @@ -354,15 +358,17 @@ namespace ErsatzTV.Core.Iptv
first =>
{
string[] split = first.Split(':');
if (split.Length == 2 && split[0].ToLowerInvariant() == "us")
if (split.Length == 2)
{
return new ContentRating(system, split[1].ToUpperInvariant());
return split[0].ToLowerInvariant() == "us"
? new ContentRating(system, split[1].ToUpperInvariant())
: new ContentRating(None, split[1].ToUpperInvariant());
}
return None;
return new ContentRating(None, first);
}).Flatten();
}
private record ContentRating(string System, string Value);
private record ContentRating(Option<string> System, string Value);
}
}

5
ErsatzTV.Core/Jellyfin/JellyfinTelevisionLibraryScanner.cs

@ -115,9 +115,10 @@ namespace ErsatzTV.Core.Jellyfin @@ -115,9 +115,10 @@ namespace ErsatzTV.Core.Jellyfin
List<JellyfinItemEtag> existingShows,
List<JellyfinShow> shows)
{
foreach (JellyfinShow incoming in shows.OrderBy(s => s.ShowMetadata.Head().Title))
var sortedShows = shows.OrderBy(s => s.ShowMetadata.Head().Title).ToList();
foreach (JellyfinShow incoming in sortedShows)
{
decimal percentCompletion = (decimal) shows.IndexOf(incoming) / shows.Count;
decimal percentCompletion = (decimal) sortedShows.IndexOf(incoming) / shows.Count;
await _mediator.Publish(new LibraryScanProgress(library.Id, percentCompletion));
Option<JellyfinItemEtag> maybeExisting = existingShows.Find(ie => ie.ItemId == incoming.ItemId);

1
ErsatzTV.sln.DotSettings

@ -49,5 +49,6 @@ @@ -49,5 +49,6 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=tvshow/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=uniqueid/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Vaapi/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=VCHIP/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=xmltv/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=yadif/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
Loading…
Cancel
Save