mirror of
https://github.com/Sonarr/Sonarr
synced 2025-12-06 08:28:37 +01:00
Fixed: Sub group parsing could result in extra brackets being parsed
Closes #7994
This commit is contained in:
parent
1c3c786335
commit
9e3b8230bc
2 changed files with 20 additions and 1 deletions
19
src/NzbDrone.Core.Test/ParserTests/SubGroupParserFixture.cs
Normal file
19
src/NzbDrone.Core.Test/ParserTests/SubGroupParserFixture.cs
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
using FluentAssertions;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Test.ParserTests
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class SubGroupParserFixture : CoreTest
|
||||||
|
{
|
||||||
|
[TestCase("[GHOST][1080p] Series - 25 [BD HEVC 10bit Dual Audio AC3][AE0ADDBA]", "GHOST")]
|
||||||
|
public void should_parse_sub_group_from_title_as_release_group(string title, string expected)
|
||||||
|
{
|
||||||
|
var result = Parser.Parser.ParseTitle(title);
|
||||||
|
|
||||||
|
result.Should().NotBeNull();
|
||||||
|
result.ReleaseGroup.Should().Be(expected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -86,7 +86,7 @@ public static class Parser
|
||||||
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||||
|
|
||||||
// Anime - [SubGroup] Title with trailing 3-digit number and sub title - Absolute Episode Number
|
// Anime - [SubGroup] Title with trailing 3-digit number and sub title - Absolute Episode Number
|
||||||
new Regex(@"^\[(?<subgroup>.+?)\][-_. ]?(?<title>[^]]+?)(?:[-_. ]{3}?(?<absoluteepisode>\d{2}(\.\d{1,2})?(?!-?\d+|-[a-z]+)))+(?:[-_. ]+(?<special>special|ova|ovd))?.*?(?<hash>[(\[]\w{8}[)\]])?(?:$|\.mkv)",
|
new Regex(@"^\[(?<subgroup>[^\]]+?)\][-_. ]?(?<title>[^]]+?)(?:[-_. ]{3}?(?<absoluteepisode>\d{2}(\.\d{1,2})?(?!-?\d+|-[a-z]+)))+(?:[-_. ]+(?<special>special|ova|ovd))?.*?(?<hash>[(\[]\w{8}[)\]])?(?:$|\.mkv)",
|
||||||
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||||
|
|
||||||
// Anime - [SubGroup] Title with trailing number Absolute Episode Number
|
// Anime - [SubGroup] Title with trailing number Absolute Episode Number
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue