Fixed: Ensure Quality is always initialised in AudioTag.Read (#694)

* Fixed: Ensure Quality is always initialised in AudioTag.Read

* Fixed: Log quality message on fallback quality detection
pull/700/head
ta264 6 years ago committed by GitHub
parent f50b60103c
commit b557f620d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -200,16 +200,20 @@ namespace NzbDrone.Core.MediaFiles
// Log as error so it goes to sentry with correct fingerprint // Log as error so it goes to sentry with correct fingerprint
Logger.Error(ex, "Tag reading failed for {0}", path); Logger.Error(ex, "Tag reading failed for {0}", path);
} }
// make sure these are initialized to avoid errors later on
Quality = QualityParser.ParseQuality(path, null, EstimateBitrate(file, path));
Logger.Debug($"Quality parsed: {Quality}, Source: {Quality.QualityDetectionSource}");
MediaInfo = new MediaInfoModel();
} }
finally finally
{ {
file?.Dispose(); file?.Dispose();
} }
// make sure these are initialized to avoid errors later on
if (Quality == null)
{
Quality = QualityParser.ParseQuality(path, null, EstimateBitrate(file, path));
Logger.Debug($"Unable to parse qulity from tag, Quality parsed from file path: {Quality}, Source: {Quality.QualityDetectionSource}");
}
MediaInfo = MediaInfo ?? new MediaInfoModel();
} }
private int EstimateBitrate(TagLib.File file, string path) private int EstimateBitrate(TagLib.File file, string path)

Loading…
Cancel
Save