Include played and unplayed results in the same next up request

This commit is contained in:
Bill Thornton 2022-03-01 00:49:29 -05:00
parent 7c9aa63382
commit 055c63bdee
3 changed files with 14 additions and 6 deletions

View File

@ -140,7 +140,15 @@ namespace Emby.Server.Implementations.TV
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)

View File

@ -68,7 +68,7 @@ namespace Jellyfin.Api.Controllers
/// <param name="nextUpDateCutoff">Optional. Starting date of shows to show in Next Up section.</param>
/// <param name="enableTotalRecordCount">Whether to enable the total records count. Defaults to true.</param>
/// <param name="disableFirstEpisode">Whether to disable sending the first episode in a series as next up.</param>
/// <param name="rewatching">Whether to get a rewatching next up instead of standard next up.</param>
/// <param name="enableRewatching">Whether to include watched episode in next up results.</param>
/// <returns>A <see cref="QueryResult{BaseItemDto}"/> with the next up episodes.</returns>
[HttpGet("NextUp")]
[ProducesResponseType(StatusCodes.Status200OK)]
@ -86,7 +86,7 @@ namespace Jellyfin.Api.Controllers
[FromQuery] DateTime? nextUpDateCutoff,
[FromQuery] bool enableTotalRecordCount = true,
[FromQuery] bool disableFirstEpisode = false,
[FromQuery] bool rewatching = false)
[FromQuery] bool enableRewatching = false)
{
var options = new DtoOptions { Fields = fields }
.AddClientFields(Request)
@ -103,7 +103,7 @@ namespace Jellyfin.Api.Controllers
EnableTotalRecordCount = enableTotalRecordCount,
DisableFirstEpisode = disableFirstEpisode,
NextUpDateCutoff = nextUpDateCutoff ?? DateTime.MinValue,
Rewatching = rewatching
EnableRewatching = enableRewatching
},
options);

View File

@ -14,7 +14,7 @@ namespace MediaBrowser.Model.Querying
EnableTotalRecordCount = true;
DisableFirstEpisode = false;
NextUpDateCutoff = DateTime.MinValue;
Rewatching = false;
EnableRewatching = false;
}
/// <summary>
@ -86,6 +86,6 @@ namespace MediaBrowser.Model.Querying
/// <summary>
/// Gets or sets a value indicating whether getting rewatching next up list.
/// </summary>
public bool Rewatching { get; set; }
public bool EnableRewatching { get; set; }
}
}