Merge pull request #6664 from cvium/subtitle_refresh

This commit is contained in:
Bond-009 2021-10-06 10:48:32 +02:00 committed by GitHub
commit c5285cee1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 9 deletions

View File

@ -417,6 +417,8 @@ namespace Jellyfin.Api.Controllers
IsForced = body.IsForced,
Stream = memoryStream
}).ConfigureAwait(false);
_providerManager.QueueRefresh(video.Id, new MetadataRefreshOptions(new DirectoryService(_fileSystem)), RefreshPriority.High);
return NoContent();
}

View File

@ -187,8 +187,8 @@ namespace MediaBrowser.Providers.Subtitles
{
var saveInMediaFolder = libraryOptions.SaveSubtitlesWithMedia;
using var stream = response.Stream;
using var memoryStream = new MemoryStream();
await using var stream = response.Stream;
await using var memoryStream = new MemoryStream();
await stream.CopyToAsync(memoryStream).ConfigureAwait(false);
memoryStream.Position = 0;
@ -236,7 +236,7 @@ namespace MediaBrowser.Providers.Subtitles
foreach (var savePath in savePaths)
{
_logger.LogInformation("Saving subtitles to {0}", savePath);
_logger.LogInformation("Saving subtitles to {SavePath}", savePath);
_monitor.ReportFileSystemChangeBeginning(savePath);
@ -254,13 +254,9 @@ namespace MediaBrowser.Providers.Subtitles
{
// Bug in analyzer -- https://github.com/dotnet/roslyn-analyzers/issues/5160
#pragma warning disable CA1508
exs ??= new List<Exception>()
{
ex
};
(exs ??= new List<Exception>()).Add(ex);
#pragma warning restore CA1508
}
}
finally
{
_monitor.ReportFileSystemChangeComplete(savePath, false);