include all content ratings in xmltv (#256)

This commit is contained in:
Jason Dove
2021-06-12 11:14:27 -05:00
committed by GitHub
parent 0750a0712f
commit fc59c9c284
5 changed files with 20 additions and 9 deletions
+2
View File
@@ -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
@@ -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);
+11 -5
View File
@@ -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
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);
}
}
@@ -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
View File
@@ -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>