Revert "Don't return first episodes in next up"

This commit is contained in:
crobibero 2021-01-15 15:06:11 -07:00
parent 549160b9b9
commit 3d754fa5bf
1 changed files with 19 additions and 1 deletions

View File

@ -143,10 +143,28 @@ namespace Emby.Server.Implementations.TV
var allNextUp = seriesKeys
.Select(i => GetNextUp(i, currentUser, dtoOptions));
// allNextUp = allNextUp.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)
var alwaysEnableFirstEpisode = !string.IsNullOrEmpty(request.SeriesId);
var anyFound = false;
return allNextUp
.Where(i =>
{
return i.Item1 != DateTime.MinValue;
if (alwaysEnableFirstEpisode || i.Item1 != DateTime.MinValue)
{
anyFound = true;
return true;
}
if (!anyFound && i.Item1 == DateTime.MinValue)
{
return true;
}
return false;
})
.Select(i => i.Item2())
.Where(i => i != null);