Browse Source

improve multi-episode grouping logic (#2744)

pull/2746/head
Jason Dove 1 day ago committed by GitHub
parent
commit
1b72b8491c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      CHANGELOG.md
  2. 10
      ErsatzTV.Core/Scheduling/MultiPartEpisodeGrouper.cs

2
CHANGELOG.md

@ -63,6 +63,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix startup error caused by duplicate smart collection names (and no longer allow duplicate smart collection names) - Fix startup error caused by duplicate smart collection names (and no longer allow duplicate smart collection names)
- Fix erroneous downgrade health check failure with some installations that use MariaDB - Fix erroneous downgrade health check failure with some installations that use MariaDB
- Sequential schedules: fix `count` instruction validation to accept integer (constant) or string (expression) - Sequential schedules: fix `count` instruction validation to accept integer (constant) or string (expression)
- Fix multi-part episode grouping logic so that it does NOT require release date metadata for episodes within a single show
- When **Treat Collections As Shows** is enabled (i.e. for crossover episodes) release date metadata is required for proper grouping
### Changed ### Changed
- No longer round framerate to nearest integer when normalizing framerate - No longer round framerate to nearest integer when normalizing framerate

10
ErsatzTV.Core/Scheduling/MultiPartEpisodeGrouper.cs

@ -40,9 +40,17 @@ public static partial class MultiPartEpisodeGrouper
groups.Add(new GroupedMediaItem(item, null)); groups.Add(new GroupedMediaItem(item, null));
} }
// when treating multiple shows as a single "show" - we need to
// first sort by release date before looking for part 1, part 2, etc. to group
// otherwise, we can simply sort by season, episode number
// which does not require release date metadata
IComparer<MediaItem> comparer = treatCollectionsAsShows
? new ChronologicalMediaComparer()
: new SeasonEpisodeMediaComparer();
IEnumerable<Episode> sortedEpisodes = showId.Match( IEnumerable<Episode> sortedEpisodes = showId.Match(
id => episodes.Filter(e => e.Season.ShowId == id), id => episodes.Filter(e => e.Season.ShowId == id),
() => episodes).OrderBy(identity, new ChronologicalMediaComparer()); () => episodes).OrderBy(identity, comparer);
foreach (Episode episode in sortedEpisodes) foreach (Episode episode in sortedEpisodes)
{ {

Loading…
Cancel
Save