diff options
| author | Bond-009 <bond.009@outlook.com> | 2025-05-04 16:40:34 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-04 08:40:34 -0600 |
| commit | 0c3ba30de214eddcd6118c3b695b08e5482bf7ed (patch) | |
| tree | a862a90f6c78cd61f78e5af7b75611a37f527ccf /MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs | |
| parent | 4096c973c623a72525843d5fe278d1f36fbbc58a (diff) | |
Cleanup file related code (#14023)
Diffstat (limited to 'MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs')
| -rw-r--r-- | MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs b/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs index 1f2bc2403..48a0654bb 100644 --- a/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs +++ b/MediaBrowser.MediaEncoding/Attachments/AttachmentExtractor.cs @@ -133,9 +133,9 @@ namespace MediaBrowser.MediaEncoding.Attachments var outputFolder = _pathManager.GetAttachmentFolderPath(mediaSource.Id); using (await _semaphoreLocks.LockAsync(outputFolder, cancellationToken).ConfigureAwait(false)) { - 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)); + var directory = Directory.CreateDirectory(outputFolder); + var fileNames = directory.GetFiles("*", SearchOption.TopDirectoryOnly).Select(f => f.Name).ToHashSet(); + var missingFiles = mediaSource.MediaAttachments.Where(a => a.FileName is not null && !fileNames.Contains(a.FileName) && !string.Equals(a.Codec, "mjpeg", StringComparison.OrdinalIgnoreCase)); if (!missingFiles.Any()) { // Skip extraction if all files already exist |
