aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Thornton <billt2006@gmail.com>2022-03-01 00:49:29 -0500
committerBill Thornton <billt2006@gmail.com>2022-03-01 00:50:16 -0500
commit055c63bdeeb257bda1ec45090d6d0797f9e1262a (patch)
tree9a9bdb0caba0b112fea591d1c186b891838ed18f
parent7c9aa63382d3d0e4a3e3285732f469026b98aa07 (diff)
Include played and unplayed results in the same next up request
-rw-r--r--Emby.Server.Implementations/TV/TVSeriesManager.cs10
-rw-r--r--Jellyfin.Api/Controllers/TvShowsController.cs6
-rw-r--r--MediaBrowser.Model/Querying/NextUpQuery.cs4
3 files changed, 14 insertions, 6 deletions
diff --git a/Emby.Server.Implementations/TV/TVSeriesManager.cs b/Emby.Server.Implementations/TV/TVSeriesManager.cs
index a47650a32..c0d8487ce 100644
--- a/Emby.Server.Implementations/TV/TVSeriesManager.cs
+++ b/Emby.Server.Implementations/TV/TVSeriesManager.cs
@@ -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)
diff --git a/Jellyfin.Api/Controllers/TvShowsController.cs b/Jellyfin.Api/Controllers/TvShowsController.cs
index 5d39d906f..636130543 100644
--- a/Jellyfin.Api/Controllers/TvShowsController.cs
+++ b/Jellyfin.Api/Controllers/TvShowsController.cs
@@ -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);
diff --git a/MediaBrowser.Model/Querying/NextUpQuery.cs b/MediaBrowser.Model/Querying/NextUpQuery.cs
index 7c65fda1a..133d6a916 100644
--- a/MediaBrowser.Model/Querying/NextUpQuery.cs
+++ b/MediaBrowser.Model/Querying/NextUpQuery.cs
@@ -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; }
}
}