mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-07 03:48:06 +02:00
avoid completely empty next up view
This commit is contained in:
parent
7d980fee45
commit
6a5684c2f5
1 changed files with 19 additions and 2 deletions
|
@ -119,12 +119,29 @@ namespace MediaBrowser.Server.Implementations.TV
|
||||||
// Avoid implicitly captured closure
|
// Avoid implicitly captured closure
|
||||||
var currentUser = user;
|
var currentUser = user;
|
||||||
|
|
||||||
return series
|
var allNextUp = series
|
||||||
.Select(i => GetNextUp(i, currentUser))
|
.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
|
// 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)
|
.OrderByDescending(i => i.Item2)
|
||||||
.ThenByDescending(i => i.Item1.PremiereDate ?? DateTime.MinValue)
|
.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)
|
.Select(i => i.Item1)
|
||||||
.Take(request.Limit ?? int.MaxValue);
|
.Take(request.Limit ?? int.MaxValue);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue