diff options
| author | Tim Eisele <Ghost_of_Stone@web.de> | 2025-04-26 17:36:17 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-26 09:36:17 -0600 |
| commit | 9092130350024331a1c3b34cd4f9d3932a1348c7 (patch) | |
| tree | 713e407cc9b3f8e7ea9ba449cc383e4b08b7ea16 /MediaBrowser.MediaEncoding | |
| parent | a0b3b7335fccf028701e94af31028184bfd4e6cb (diff) | |
Optimize migrations (#13855)
Diffstat (limited to 'MediaBrowser.MediaEncoding')
| -rw-r--r-- | MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs b/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs index 89291c73b..1f2bc2403 100644 --- a/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs +++ b/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs @@ -133,19 +133,13 @@ namespace MediaBrowser.MediaEncoding.Attachments var outputFolder = _pathManager.GetAttachmentFolderPath(mediaSource.Id); using (await _semaphoreLocks.LockAsync(outputFolder, cancellationToken).ConfigureAwait(false)) { - if (!Directory.Exists(outputFolder)) + Directory.CreateDirectory(outputFolder); + var fileNames = Directory.GetFiles(outputFolder, "*", SearchOption.TopDirectoryOnly).Select(f => Path.GetFileName(f)); + var missingFiles = mediaSource.MediaAttachments.Where(a => !fileNames.Contains(a.FileName) && !string.Equals(a.Codec, "mjpeg", StringComparison.OrdinalIgnoreCase)); + if (!missingFiles.Any()) { - Directory.CreateDirectory(outputFolder); - } - else - { - var fileNames = Directory.GetFiles(outputFolder, "*", SearchOption.TopDirectoryOnly).Select(f => Path.GetFileName(f)); - var missingFiles = mediaSource.MediaAttachments.Where(a => !fileNames.Contains(a.FileName) && !string.Equals(a.Codec, "mjpeg", StringComparison.OrdinalIgnoreCase)); - if (!missingFiles.Any()) - { - // Skip extraction if all files already exist - return; - } + // Skip extraction if all files already exist + return; } var processArgs = string.Format( |
