diff options
Diffstat (limited to 'Jellyfin.Api')
| -rw-r--r-- | Jellyfin.Api/Controllers/SearchController.cs | 6 | ||||
| -rw-r--r-- | Jellyfin.Api/Controllers/TvShowsController.cs | 7 | ||||
| -rw-r--r-- | Jellyfin.Api/Helpers/ProgressiveFileStream.cs | 16 | ||||
| -rw-r--r-- | Jellyfin.Api/Helpers/TranscodingJobHelper.cs | 2 | ||||
| -rw-r--r-- | Jellyfin.Api/Jellyfin.Api.csproj | 2 |
5 files changed, 18 insertions, 15 deletions
diff --git a/Jellyfin.Api/Controllers/SearchController.cs b/Jellyfin.Api/Controllers/SearchController.cs index 26acb4cdcc..6fcd2ae402 100644 --- a/Jellyfin.Api/Controllers/SearchController.cs +++ b/Jellyfin.Api/Controllers/SearchController.cs @@ -121,11 +121,7 @@ namespace Jellyfin.Api.Controllers IsSports = isSports }); - return new SearchHintResult - { - TotalRecordCount = result.TotalRecordCount, - SearchHints = result.Items.Select(GetSearchHintResult).ToArray() - }; + return new SearchHintResult(result.Items.Select(GetSearchHintResult).ToArray(), result.TotalRecordCount); } /// <summary> diff --git a/Jellyfin.Api/Controllers/TvShowsController.cs b/Jellyfin.Api/Controllers/TvShowsController.cs index 9425fe5196..5d39d906f4 100644 --- a/Jellyfin.Api/Controllers/TvShowsController.cs +++ b/Jellyfin.Api/Controllers/TvShowsController.cs @@ -68,6 +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> /// <returns>A <see cref="QueryResult{BaseItemDto}"/> with the next up episodes.</returns> [HttpGet("NextUp")] [ProducesResponseType(StatusCodes.Status200OK)] @@ -84,7 +85,8 @@ namespace Jellyfin.Api.Controllers [FromQuery] bool? enableUserData, [FromQuery] DateTime? nextUpDateCutoff, [FromQuery] bool enableTotalRecordCount = true, - [FromQuery] bool disableFirstEpisode = false) + [FromQuery] bool disableFirstEpisode = false, + [FromQuery] bool rewatching = false) { var options = new DtoOptions { Fields = fields } .AddClientFields(Request) @@ -100,7 +102,8 @@ namespace Jellyfin.Api.Controllers UserId = userId ?? Guid.Empty, EnableTotalRecordCount = enableTotalRecordCount, DisableFirstEpisode = disableFirstEpisode, - NextUpDateCutoff = nextUpDateCutoff ?? DateTime.MinValue + NextUpDateCutoff = nextUpDateCutoff ?? DateTime.MinValue, + Rewatching = rewatching }, options); diff --git a/Jellyfin.Api/Helpers/ProgressiveFileStream.cs b/Jellyfin.Api/Helpers/ProgressiveFileStream.cs index 3fa07720ae..6f5b64ea8b 100644 --- a/Jellyfin.Api/Helpers/ProgressiveFileStream.cs +++ b/Jellyfin.Api/Helpers/ProgressiveFileStream.cs @@ -83,10 +83,10 @@ namespace Jellyfin.Api.Helpers int totalBytesRead = 0; var stopwatch = Stopwatch.StartNew(); - while (KeepReading(stopwatch.ElapsedMilliseconds)) + while (true) { totalBytesRead += _stream.Read(buffer); - if (totalBytesRead > 0) + if (StopReading(totalBytesRead, stopwatch.ElapsedMilliseconds)) { break; } @@ -109,10 +109,10 @@ namespace Jellyfin.Api.Helpers int totalBytesRead = 0; var stopwatch = Stopwatch.StartNew(); - while (KeepReading(stopwatch.ElapsedMilliseconds)) + while (true) { totalBytesRead += await _stream.ReadAsync(buffer, cancellationToken).ConfigureAwait(false); - if (totalBytesRead > 0) + if (StopReading(totalBytesRead, stopwatch.ElapsedMilliseconds)) { break; } @@ -172,10 +172,12 @@ namespace Jellyfin.Api.Helpers } } - private bool KeepReading(long elapsed) + private bool StopReading(int bytesRead, long elapsed) { - // If the job is null it's a live stream and will require user action to close, but don't keep it open indefinitely - return !_job?.HasExited ?? elapsed < _timeoutMs; + // It should stop reading when anything has been successfully read or if the job has exited + // If the job is null, however, it's a live stream and will require user action to close, + // but don't keep it open indefinitely if it isn't reading anything + return bytesRead > 0 || (_job?.HasExited ?? elapsed >= _timeoutMs); } } } diff --git a/Jellyfin.Api/Helpers/TranscodingJobHelper.cs b/Jellyfin.Api/Helpers/TranscodingJobHelper.cs index 3526d56c66..56a54fb1d1 100644 --- a/Jellyfin.Api/Helpers/TranscodingJobHelper.cs +++ b/Jellyfin.Api/Helpers/TranscodingJobHelper.cs @@ -753,6 +753,8 @@ namespace Jellyfin.Api.Helpers job.HasExited = true; job.ExitCode = process.ExitCode; + ReportTranscodingProgress(job, state, null, null, null, null, null); + _logger.LogDebug("Disposing stream resources"); state.Dispose(); diff --git a/Jellyfin.Api/Jellyfin.Api.csproj b/Jellyfin.Api/Jellyfin.Api.csproj index 3a7d393651..c5b240e925 100644 --- a/Jellyfin.Api/Jellyfin.Api.csproj +++ b/Jellyfin.Api/Jellyfin.Api.csproj @@ -17,7 +17,7 @@ </PropertyGroup> <ItemGroup> - <PackageReference Include="Microsoft.AspNetCore.Authorization" Version="6.0.1" /> + <PackageReference Include="Microsoft.AspNetCore.Authorization" Version="6.0.2" /> <PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" /> <PackageReference Include="Swashbuckle.AspNetCore.ReDoc" Version="6.2.3" /> |
