Extended Korean Filename Parsing Support (#1556)

* Added Some Korean Volume Matches

* Fixed Typo And Added Test Cases

* Restore Chapter Decimal Support

* Added Decimal Volume Support to -권, -화, -회 and -장
Merged -권 Pattern to -화, -회, -장 Pattern
Added Decimal Test to ParseVolumeTest

* Grouped Korean Tests

* Fixed Regexp Comment
This commit is contained in:
DeltaLaboratory 2022-09-25 05:40:13 +09:00 committed by GitHub
parent 1415687752
commit 324f3d2d4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 9 deletions

View file

@ -119,9 +119,9 @@ public static class Parser
new Regex(
@"(卷|册)(?<Volume>\d+)",
MatchOptions, RegexTimeout),
// Korean Volume: 제n권 -> Volume n, n권 -> Volume n, 63권#200.zip -> Volume 63 (no chapter, #200 is just files inside)
// Korean Volume: 제n화|권|회|장 -> Volume n, n화|권|회|장 -> Volume n, 63권#200.zip -> Volume 63 (no chapter, #200 is just files inside)
new Regex(
@"제?(?<Volume>\d+)",
@"제?(?<Volume>\d+(\.\d)?)(권|회|화|장)",
MatchOptions, RegexTimeout),
// Korean Season: 시즌n -> Season n,
new Regex(
@ -557,7 +557,7 @@ public static class Parser
MatchOptions, RegexTimeout),
// Korean Chapter: 제n화 -> Chapter n, 가디언즈 오브 갤럭시 죽음의 보석.E0008.7화#44
new Regex(
@"제?(?<Chapter>\d+\.?\d+)(화|장)",
@"제?(?<Chapter>\d+\.?\d+)(회|화|장)",
MatchOptions, RegexTimeout),
// Korean Chapter: 第10話 -> Chapter n, [ハレム]ナナとカオル 高校生のSMごっこ 第1話
new Regex(
@ -698,12 +698,12 @@ public static class Parser
foreach (var regex in MangaVolumeRegex)
{
var matches = regex.Matches(filename);
foreach (Match match in matches)
foreach (var group in matches.Select(match => match.Groups))
{
if (!match.Groups["Volume"].Success || match.Groups["Volume"] == Match.Empty) continue;
if (!group["Volume"].Success || group["Volume"] == Match.Empty) continue;
var value = match.Groups["Volume"].Value;
var hasPart = match.Groups["Part"].Success;
var value = group["Volume"].Value;
var hasPart = group["Part"].Success;
return FormatValue(value, hasPart);
}
}