From 121eb6db16f7ade3d72e225211bda191d868303a Mon Sep 17 00:00:00 2001 From: Qstick Date: Sun, 25 Mar 2018 23:08:05 -0400 Subject: [PATCH] Fixed: Quality Parsing for VBR Fails in many cases Fixes #258 Co-Authored-By: taloth --- src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs | 1 + src/NzbDrone.Core/Parser/QualityParser.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs index 173c8e0e0..8daf0e9f0 100644 --- a/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs @@ -86,6 +86,7 @@ namespace NzbDrone.Core.Test.ParserTests } [TestCase("Sia - This Is Acting (Standard Edition) [2016-Web-MP3-V0(VBR)]", null, 0)] + [TestCase("Mount Eerie - A Crow Looked at Me (2017) [MP3 V0 VBR)]", null, 0)] public void should_parse_mp3_vbr_v0_quality(string title, string desc, int bitrate) { ParseAndVerifyQuality(title, desc, bitrate, Quality.MP3_VBR); diff --git a/src/NzbDrone.Core/Parser/QualityParser.cs b/src/NzbDrone.Core/Parser/QualityParser.cs index 5e58ad934..dd6b1893b 100644 --- a/src/NzbDrone.Core/Parser/QualityParser.cs +++ b/src/NzbDrone.Core/Parser/QualityParser.cs @@ -54,7 +54,7 @@ namespace NzbDrone.Core.Parser private static readonly Regex SampleSizeRegex = new Regex(@"\b(?:(?24[ ]bit|24bit|[\[\(].*24bit.*[\]\)]))"); - private static readonly Regex CodecRegex = new Regex(@"\b(?:(?MP3\S*VBR|MPEG Version 1 Audio, Layer 3 vbr)|(?MP3|MPEG Version \d+ Audio, Layer 3)|(?flac)|(?alac)|(?WMA\d?)|(?WAV|PCM)|(?M4A|AAC|mp4a)|(?OGG|Vorbis))\b", + private static readonly Regex CodecRegex = new Regex(@"\b(?:(?MP3.*VBR|MPEG Version 1 Audio, Layer 3 vbr)|(?MP3|MPEG Version \d+ Audio, Layer 3)|(?flac)|(?alac)|(?WMA\d?)|(?WAV|PCM)|(?M4A|AAC|mp4a)|(?OGG|Vorbis))\b", RegexOptions.Compiled | RegexOptions.IgnoreCase); public static QualityModel ParseQuality(string name, string desc, int fileBitrate, int fileSampleSize = 0)