Queue refresh after subtitle upload + minor fixes

This commit is contained in:
cvium 2021-10-04 21:12:09 +02:00
parent 647c080ef7
commit 229917a2f8
2 changed files with 17 additions and 9 deletions

View File

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

View File

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