The Free Software Media System - Server Backend & API
Fix NextUp
Shadowghost46ad25f47dbe
diff --git a/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs b/Jellyfin.Server.Implementations/Item/BaseItemRepository.csindex 76769c33e7..f31fef6a19 100644--- a/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs+++ b/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs@@ -788,14 +788,23 @@ public sealed class BaseItemRepository}).ToList();- var allNextPlayedCandidates = allCandidatesWithPlayedStatus- .Where(c => includeWatchedForRewatching)+ // For regular NextUp: unplayed episodes+ var allNextUpCandidates = allCandidatesWithPlayedStatus+ .Where(c => !c.IsPlayed).Select(c => new { c.Id, c.SeriesPresentationUniqueKey, c.ParentIndexNumber, c.EpisodeNumber }).ToList();+ // For rewatching: played episodes (only used when includeWatchedForRewatching is true)+ var allNextPlayedCandidates = includeWatchedForRewatching+ ? allCandidatesWithPlayedStatus+ .Where(c => c.IsPlayed)+ .Select(c => new { c.Id, c.SeriesPresentationUniqueKey, c.ParentIndexNumber, c.EpisodeNumber })+ .ToList()+ : [];+foreach (var seriesKey in seriesKeys){- var candidates = allNextPlayedCandidates+ var candidates = allNextUpCandidates.Where(c => c.SeriesPresentationUniqueKey == seriesKey);if (lastWatchedInfo.TryGetValue(seriesKey, out var lwId) && lwId != Guid.Empty)