diff options
| author | Joshua M. Boniface <joshua@boniface.me> | 2022-03-05 14:29:49 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-05 14:29:49 -0500 |
| commit | a123391e7eb0084342d9ad925ef829e5e110d035 (patch) | |
| tree | 6dc6417879c80ffc29b179487eb2b06311623f9d /Emby.Server.Implementations | |
| parent | 9f027bae4193550f0627327e7b9e7f97360f3a28 (diff) | |
| parent | df70d7bdf13b52581873274a16a82a164c1922b2 (diff) | |
Merge pull request #7383 from thornbill/next-up-rewatching
Diffstat (limited to 'Emby.Server.Implementations')
| -rw-r--r-- | Emby.Server.Implementations/TV/TVSeriesManager.cs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/Emby.Server.Implementations/TV/TVSeriesManager.cs b/Emby.Server.Implementations/TV/TVSeriesManager.cs index a47650a32..f8ba85af1 100644 --- a/Emby.Server.Implementations/TV/TVSeriesManager.cs +++ b/Emby.Server.Implementations/TV/TVSeriesManager.cs @@ -126,7 +126,8 @@ namespace Emby.Server.Implementations.TV parentsFolders.ToList()) .Cast<Episode>() .Where(episode => !string.IsNullOrEmpty(episode.SeriesPresentationUniqueKey)) - .Select(GetUniqueSeriesKey); + .Select(GetUniqueSeriesKey) + .ToList(); // Avoid implicitly captured closure var episodes = GetNextUpEpisodes(request, user, items, options); @@ -134,13 +135,21 @@ namespace Emby.Server.Implementations.TV return GetResult(episodes, request); } - public IEnumerable<Episode> GetNextUpEpisodes(NextUpQuery request, User user, IEnumerable<string> seriesKeys, DtoOptions dtoOptions) + public IEnumerable<Episode> GetNextUpEpisodes(NextUpQuery request, User user, IReadOnlyList<string> seriesKeys, DtoOptions dtoOptions) { // Avoid implicitly captured closure var currentUser = user; var allNextUp = seriesKeys - .Select(i => GetNextUp(i, currentUser, dtoOptions, request.Rewatching)); + .Select(i => GetNextUp(i, currentUser, dtoOptions, false)); + + if (request.EnableRewatching) + { + allNextUp = allNextUp.Concat( + seriesKeys.Select(i => GetNextUp(i, currentUser, dtoOptions, true)) + ) + .OrderByDescending(i => i.Item1); + } // If viewing all next up for all series, remove first episodes // But if that returns empty, keep those first episodes (avoid completely empty view) |
