From ad084cdf917d1f84d967be01b09891fe5d19653b Mon Sep 17 00:00:00 2001 From: Bogdan Date: Mon, 16 Dec 2024 16:25:58 +0200 Subject: [PATCH] Fixed: Parse FLAC 24-bit/24_bit/24.bit as FLAC 24bit --- src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs | 3 +++ src/NzbDrone.Core/Parser/QualityParser.cs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs index d2a0b1858..f2e6039c6 100644 --- a/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs @@ -126,6 +126,9 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("Green_Day-Father_Of_All-24-44-WEB-FLAC-2020-OBZEN", null, 0, 0)] [TestCase("", "Flac Audio", 5057, 24)] [TestCase("[TR24][OF] Good Charlotte - Generation Rx - 2018 (Pop-Punk | Alternative Rock)", null, 0, 0)] + [TestCase("Green Day - Father Of All [FLAC (M4A) 24-bit Lossless]", null, 0, 0)] + [TestCase("Green_Day-Father_Of_All_FLAC_M4A_24_bit_Lossless", null, 0, 0)] + [TestCase("Green.Day-Father.Of.All.FLAC.M4A.24.bit.Lossless", null, 0, 0)] public void should_parse_flac_24bit_quality(string title, string desc, int bitrate, int sampleSize) { ParseAndVerifyQuality(title, desc, bitrate, Quality.FLAC_24, sampleSize); diff --git a/src/NzbDrone.Core/Parser/QualityParser.cs b/src/NzbDrone.Core/Parser/QualityParser.cs index 9b3c2d6c9..32b7e7542 100644 --- a/src/NzbDrone.Core/Parser/QualityParser.cs +++ b/src/NzbDrone.Core/Parser/QualityParser.cs @@ -36,7 +36,7 @@ namespace NzbDrone.Core.Parser (?V2[ ]?kbps|V2|[\[\(].*V2.*[\]\)]))\b", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace); - private static readonly Regex SampleSizeRegex = new (@"\b(?:(?24[ ]?bit|tr24|24-(?:44|48|96|192)|[\[\(].*24bit.*[\]\)]))\b", RegexOptions.Compiled); + private static readonly Regex SampleSizeRegex = new (@"\b(?:(?24[-._ ]?bit|tr24|24-(?:44|48|96|192)|[\[\(].*24bit.*[\]\)]))\b", RegexOptions.Compiled); private static readonly Regex CodecRegex = new (@"\b(?:(?MPEG Version \d(.5)? Audio, Layer 1|MP1)|(?MPEG Version \d(.5)? Audio, Layer 2|MP2)|(?MP3.*VBR|MPEG Version \d(.5)? Audio, Layer 3 vbr)|(?MP3|MPEG Version \d(.5)? Audio, Layer 3)|(?(web)?flac|TR24)|(?wavpack|wv)|(?alac)|(?WMA\d?)|(?WAV|PCM)|(?M4A|M4P|M4B|AAC|mp4a|MPEG-4 Audio(?!.*alac))|(?OGG|OGA|Vorbis))\b|(?monkey's audio|[\[|\(].*\bape\b.*[\]|\)])|(?Opus Version \d(.5)? Audio|[\[|\(].*\bopus\b.*[\]|\)])", RegexOptions.Compiled | RegexOptions.IgnoreCase);