From 764c08498783865834e607bd41feaaedf69a254a Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 19 Apr 2023 16:05:10 -0700 Subject: [PATCH] New: Don't try to analyze disk image files (iso, img, etc) Closes #5567 --- src/NzbDrone.Core/MediaFiles/MediaFileExtensions.cs | 1 + .../MediaFiles/MediaInfo/VideoFileInfoReader.cs | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/NzbDrone.Core/MediaFiles/MediaFileExtensions.cs b/src/NzbDrone.Core/MediaFiles/MediaFileExtensions.cs index 5b29dbd48..3d59f902f 100644 --- a/src/NzbDrone.Core/MediaFiles/MediaFileExtensions.cs +++ b/src/NzbDrone.Core/MediaFiles/MediaFileExtensions.cs @@ -71,6 +71,7 @@ namespace NzbDrone.Core.MediaFiles } public static HashSet Extensions => new HashSet(_fileExtensions.Keys, StringComparer.OrdinalIgnoreCase); + public static HashSet DiskExtensions => new HashSet(new[] { ".img", ".iso", ".vob" }, StringComparer.OrdinalIgnoreCase); public static Quality GetQualityForExtension(string extension) { diff --git a/src/NzbDrone.Core/MediaFiles/MediaInfo/VideoFileInfoReader.cs b/src/NzbDrone.Core/MediaFiles/MediaInfo/VideoFileInfoReader.cs index da6f44843..7550be637 100644 --- a/src/NzbDrone.Core/MediaFiles/MediaInfo/VideoFileInfoReader.cs +++ b/src/NzbDrone.Core/MediaFiles/MediaInfo/VideoFileInfoReader.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using FFMpegCore; +using FFMpegCore.Enums; using NLog; using NzbDrone.Common.Disk; using NzbDrone.Common.Extensions; @@ -55,6 +56,11 @@ namespace NzbDrone.Core.MediaFiles.MediaInfo throw new FileNotFoundException("Media file does not exist: " + filename); } + if (MediaFileExtensions.DiskExtensions.Contains(Path.GetExtension(filename))) + { + return null; + } + // TODO: Cache media info by path, mtime and length so we don't need to read files multiple times try