1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-22 07:42:28 +00:00

Fixed: Parse FLAC 24-bit/24_bit/24.bit as FLAC 24bit

This commit is contained in:
Bogdan 2024-12-16 16:25:58 +02:00
parent 4bcdc49777
commit ad084cdf91
2 changed files with 4 additions and 1 deletions

View file

@ -126,6 +126,9 @@ public void should_parse_flac_quality(string title, string desc, int bitrate)
[TestCase("Green_Day-Father_Of_All-24-44-WEB-FLAC-2020-OBZEN", null, 0, 0)] [TestCase("Green_Day-Father_Of_All-24-44-WEB-FLAC-2020-OBZEN", null, 0, 0)]
[TestCase("", "Flac Audio", 5057, 24)] [TestCase("", "Flac Audio", 5057, 24)]
[TestCase("[TR24][OF] Good Charlotte - Generation Rx - 2018 (Pop-Punk | Alternative Rock)", null, 0, 0)] [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) public void should_parse_flac_24bit_quality(string title, string desc, int bitrate, int sampleSize)
{ {
ParseAndVerifyQuality(title, desc, bitrate, Quality.FLAC_24, sampleSize); ParseAndVerifyQuality(title, desc, bitrate, Quality.FLAC_24, sampleSize);

View file

@ -36,7 +36,7 @@ public class QualityParser
(?<VBRV2>V2[ ]?kbps|V2|[\[\(].*V2.*[\]\)]))\b", (?<VBRV2>V2[ ]?kbps|V2|[\[\(].*V2.*[\]\)]))\b",
RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace); RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
private static readonly Regex SampleSizeRegex = new (@"\b(?:(?<S24>24[ ]?bit|tr24|24-(?:44|48|96|192)|[\[\(].*24bit.*[\]\)]))\b", RegexOptions.Compiled); private static readonly Regex SampleSizeRegex = new (@"\b(?:(?<S24>24[-._ ]?bit|tr24|24-(?:44|48|96|192)|[\[\(].*24bit.*[\]\)]))\b", RegexOptions.Compiled);
private static readonly Regex CodecRegex = new (@"\b(?:(?<MP1>MPEG Version \d(.5)? Audio, Layer 1|MP1)|(?<MP2>MPEG Version \d(.5)? Audio, Layer 2|MP2)|(?<MP3VBR>MP3.*VBR|MPEG Version \d(.5)? Audio, Layer 3 vbr)|(?<MP3CBR>MP3|MPEG Version \d(.5)? Audio, Layer 3)|(?<FLAC>(web)?flac|TR24)|(?<WAVPACK>wavpack|wv)|(?<ALAC>alac)|(?<WMA>WMA\d?)|(?<WAV>WAV|PCM)|(?<AAC>M4A|M4P|M4B|AAC|mp4a|MPEG-4 Audio(?!.*alac))|(?<OGG>OGG|OGA|Vorbis))\b|(?<APE>monkey's audio|[\[|\(].*\bape\b.*[\]|\)])|(?<OPUS>Opus Version \d(.5)? Audio|[\[|\(].*\bopus\b.*[\]|\)])", private static readonly Regex CodecRegex = new (@"\b(?:(?<MP1>MPEG Version \d(.5)? Audio, Layer 1|MP1)|(?<MP2>MPEG Version \d(.5)? Audio, Layer 2|MP2)|(?<MP3VBR>MP3.*VBR|MPEG Version \d(.5)? Audio, Layer 3 vbr)|(?<MP3CBR>MP3|MPEG Version \d(.5)? Audio, Layer 3)|(?<FLAC>(web)?flac|TR24)|(?<WAVPACK>wavpack|wv)|(?<ALAC>alac)|(?<WMA>WMA\d?)|(?<WAV>WAV|PCM)|(?<AAC>M4A|M4P|M4B|AAC|mp4a|MPEG-4 Audio(?!.*alac))|(?<OGG>OGG|OGA|Vorbis))\b|(?<APE>monkey's audio|[\[|\(].*\bape\b.*[\]|\)])|(?<OPUS>Opus Version \d(.5)? Audio|[\[|\(].*\bopus\b.*[\]|\)])",
RegexOptions.Compiled | RegexOptions.IgnoreCase); RegexOptions.Compiled | RegexOptions.IgnoreCase);