mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-07-09 03:04:19 -04:00
Implemented the ability to parse some volume and chapter keywords for chinese. (#1285)
This commit is contained in:
parent
1247f450e2
commit
a9a1ec02ca
@ -66,6 +66,9 @@ namespace API.Tests.Parser
|
|||||||
[InlineData("Hentai Ouji to Warawanai Neko. - Vol. 06 Ch. 034.5", "6")]
|
[InlineData("Hentai Ouji to Warawanai Neko. - Vol. 06 Ch. 034.5", "6")]
|
||||||
[InlineData("The 100 Girlfriends Who Really, Really, Really, Really, Really Love You - Vol. 03 Ch. 023.5 - Volume 3 Extras.cbz", "3")]
|
[InlineData("The 100 Girlfriends Who Really, Really, Really, Really, Really Love You - Vol. 03 Ch. 023.5 - Volume 3 Extras.cbz", "3")]
|
||||||
[InlineData("The 100 Girlfriends Who Really, Really, Really, Really, Really Love You - Vol. 03.5 Ch. 023.5 - Volume 3 Extras.cbz", "3.5")]
|
[InlineData("The 100 Girlfriends Who Really, Really, Really, Really, Really Love You - Vol. 03.5 Ch. 023.5 - Volume 3 Extras.cbz", "3.5")]
|
||||||
|
[InlineData("幽游白书完全版 第03卷 天下", "3")]
|
||||||
|
[InlineData("阿衰online 第1册", "1")]
|
||||||
|
[InlineData("【TFO汉化&Petit汉化】迷你偶像漫画卷2第25话", "2")]
|
||||||
public void ParseVolumeTest(string filename, string expected)
|
public void ParseVolumeTest(string filename, string expected)
|
||||||
{
|
{
|
||||||
Assert.Equal(expected, API.Parser.Parser.ParseVolume(filename));
|
Assert.Equal(expected, API.Parser.Parser.ParseVolume(filename));
|
||||||
@ -246,6 +249,8 @@ namespace API.Tests.Parser
|
|||||||
[InlineData("Harrison, Kim - The Good, The Bad, and the Undead - Hollows Vol 2.5.epub", "0")]
|
[InlineData("Harrison, Kim - The Good, The Bad, and the Undead - Hollows Vol 2.5.epub", "0")]
|
||||||
[InlineData("Kaiju No. 8 036 (2021) (Digital)", "36")]
|
[InlineData("Kaiju No. 8 036 (2021) (Digital)", "36")]
|
||||||
[InlineData("Samurai Jack Vol. 01 - The threads of Time", "0")]
|
[InlineData("Samurai Jack Vol. 01 - The threads of Time", "0")]
|
||||||
|
[InlineData("【TFO汉化&Petit汉化】迷你偶像漫画第25话", "25")]
|
||||||
|
[InlineData("【TFO汉化&Petit汉化】迷你偶像漫画卷2第25话", "25")]
|
||||||
public void ParseChaptersTest(string filename, string expected)
|
public void ParseChaptersTest(string filename, string expected)
|
||||||
{
|
{
|
||||||
Assert.Equal(expected, API.Parser.Parser.ParseChapter(filename));
|
Assert.Equal(expected, API.Parser.Parser.ParseChapter(filename));
|
||||||
|
@ -102,6 +102,14 @@ namespace API.Parser
|
|||||||
new Regex(
|
new Regex(
|
||||||
@"(vol_)(?<Volume>\d+(\.\d)?)",
|
@"(vol_)(?<Volume>\d+(\.\d)?)",
|
||||||
MatchOptions, RegexTimeout),
|
MatchOptions, RegexTimeout),
|
||||||
|
// Chinese Volume: 第n卷 -> Volume n, 第n册 -> Volume n, 幽游白书完全版 第03卷 天下 or 阿衰online 第1册
|
||||||
|
new Regex(
|
||||||
|
@"第(?<Volume>\d+)(卷|册)",
|
||||||
|
MatchOptions, RegexTimeout),
|
||||||
|
// Chinese Volume: 卷n -> Volume n, 册n -> Volume n
|
||||||
|
new Regex(
|
||||||
|
@"(卷|册)(?<Volume>\d+)",
|
||||||
|
MatchOptions, RegexTimeout),
|
||||||
};
|
};
|
||||||
|
|
||||||
private static readonly Regex[] MangaSeriesRegex = new[]
|
private static readonly Regex[] MangaSeriesRegex = new[]
|
||||||
@ -449,6 +457,10 @@ namespace API.Parser
|
|||||||
new Regex(
|
new Regex(
|
||||||
@"(?<Volume>((vol|volume|v))?(\s|_)?\.?\d+)(\s|_)(Chp|Chapter)\.?(\s|_)?(?<Chapter>\d+)",
|
@"(?<Volume>((vol|volume|v))?(\s|_)?\.?\d+)(\s|_)(Chp|Chapter)\.?(\s|_)?(?<Chapter>\d+)",
|
||||||
MatchOptions, RegexTimeout),
|
MatchOptions, RegexTimeout),
|
||||||
|
// Chinese Chapter: 第n话 -> Chapter n, 【TFO汉化&Petit汉化】迷你偶像漫画第25话
|
||||||
|
new Regex(
|
||||||
|
@"第(?<Chapter>\d+)话",
|
||||||
|
MatchOptions, RegexTimeout),
|
||||||
|
|
||||||
};
|
};
|
||||||
private static readonly Regex[] MangaEditionRegex = {
|
private static readonly Regex[] MangaEditionRegex = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user