mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-09 07:10:34 +02:00
avoid completely empty next up view
This commit is contained in:
parent
7d980fee45
commit
6a5684c2f5
|
@ -119,12 +119,29 @@ namespace MediaBrowser.Server.Implementations.TV
|
|||
// Avoid implicitly captured closure
|
||||
var currentUser = user;
|
||||
|
||||
return series
|
||||
var allNextUp = series
|
||||
.Select(i => GetNextUp(i, currentUser))
|
||||
.Where(i => i.Item1 != null)
|
||||
// Include if an episode was found, and either the series is not unwatched or the specific series was requested
|
||||
.Where(i => i.Item1 != null && (!i.Item3 || !string.IsNullOrWhiteSpace(request.SeriesId)))
|
||||
.OrderByDescending(i => i.Item2)
|
||||
.ThenByDescending(i => i.Item1.PremiereDate ?? DateTime.MinValue)
|
||||
.ToList();
|
||||
|
||||
// If viewing all next up for all series, remove first episodes
|
||||
if (string.IsNullOrWhiteSpace(request.SeriesId))
|
||||
{
|
||||
var withoutFirstEpisode = allNextUp
|
||||
.Where(i => !i.Item3)
|
||||
.ToList();
|
||||
|
||||
// But if that returns empty, keep those first episodes (avoid completely empty view)
|
||||
if (withoutFirstEpisode.Count > 0)
|
||||
{
|
||||
allNextUp = withoutFirstEpisode;
|
||||
}
|
||||
}
|
||||
|
||||
return allNextUp
|
||||
.Select(i => i.Item1)
|
||||
.Take(request.Limit ?? int.MaxValue);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue