aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2021-10-06 10:48:32 +0200
committerGitHub <noreply@github.com>2021-10-06 10:48:32 +0200
commitc5285cee1c1819a45a6f6ce240eb6e1c108d3f7e (patch)
treee686fd0d0deac7e6056f8dbfa037bdf477c6585b
parenta1246ba3a080cc20ff1c8e64b39a501065cc39b0 (diff)
parent7abdf71c49b271281b5500c3cbbebc7ead06f0e2 (diff)
Merge pull request #6664 from cvium/subtitle_refresh
-rw-r--r--Jellyfin.Api/Controllers/SubtitleController.cs2
-rw-r--r--MediaBrowser.Providers/Subtitles/SubtitleManager.cs14
2 files changed, 7 insertions, 9 deletions
diff --git a/Jellyfin.Api/Controllers/SubtitleController.cs b/Jellyfin.Api/Controllers/SubtitleController.cs
index 1849dd047..8fb85c732 100644
--- a/Jellyfin.Api/Controllers/SubtitleController.cs
+++ b/Jellyfin.Api/Controllers/SubtitleController.cs
@@ -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();
}
diff --git a/MediaBrowser.Providers/Subtitles/SubtitleManager.cs b/MediaBrowser.Providers/Subtitles/SubtitleManager.cs
index 772e617ab..78ca76e4b 100644
--- a/MediaBrowser.Providers/Subtitles/SubtitleManager.cs
+++ b/MediaBrowser.Providers/Subtitles/SubtitleManager.cs
@@ -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);