The Free Software Media System - Server Backend & API
Improve code
Nils Fürnißb4bb82b6d753
diff --git a/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs b/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.csindex eb58dd9e24..00aafa1262 100644--- a/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs+++ b/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs@@ -89,12 +89,12 @@ namespace MediaBrowser.MediaEncoding.Attachmentsstring outputPath,CancellationToken cancellationToken){- if (!Directory.Exists(outputPath))- {- var semaphore = _semaphoreLocks.GetOrAdd(outputPath, key => new SemaphoreSlim(1, 1));+ var semaphore = _semaphoreLocks.GetOrAdd(outputPath, key => new SemaphoreSlim(1, 1));- await semaphore.WaitAsync(cancellationToken).ConfigureAwait(false);+ await semaphore.WaitAsync(cancellationToken).ConfigureAwait(false);+ if (!Directory.Exists(outputPath))+ {try{await ExtractAllAttachmentsInternal(@@ -116,12 +116,12 @@ namespace MediaBrowser.MediaEncoding.Attachmentsstring outputPath,CancellationToken cancellationToken){- if (!File.Exists(Path.Join(outputPath, id)))- {- var semaphore = _semaphoreLocks.GetOrAdd(outputPath, key => new SemaphoreSlim(1, 1));+ var semaphore = _semaphoreLocks.GetOrAdd(outputPath, key => new SemaphoreSlim(1, 1));- await semaphore.WaitAsync(cancellationToken).ConfigureAwait(false);+ await semaphore.WaitAsync(cancellationToken).ConfigureAwait(false);+ if (!File.Exists(Path.Join(outputPath, id)))+ {try{await ExtractAllAttachmentsInternal(@@ -158,10 +158,7 @@ namespace MediaBrowser.MediaEncoding.Attachmentsthrow new ArgumentNullException(nameof(outputPath));}- if (!Directory.Exists(outputPath))- {- Directory.CreateDirectory(outputPath);- }+ Directory.CreateDirectory(outputPath);var processArgs = string.Format(CultureInfo.InvariantCulture,