Same case now works for Volumes.
Fixed a bug in the Kavita+ code that wasn't properly parsing out weblinks
This commit is contained in:
parent
0a2604dbd4
commit
7b35990e40
3 changed files with 7 additions and 4 deletions
|
@ -7,6 +7,8 @@ public class ScrobblingServiceTests
|
||||||
{
|
{
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData("https://anilist.co/manga/35851/Byeontaega-Doeja/", 35851)]
|
[InlineData("https://anilist.co/manga/35851/Byeontaega-Doeja/", 35851)]
|
||||||
|
[InlineData("https://anilist.co/manga/30105", 30105)]
|
||||||
|
[InlineData("https://anilist.co/manga/30105/Kekkaishi/", 30105)]
|
||||||
public void CanParseWeblink(string link, long expectedId)
|
public void CanParseWeblink(string link, long expectedId)
|
||||||
{
|
{
|
||||||
Assert.Equal(ScrobblingService.ExtractId<long>(link, ScrobblingService.AniListWeblinkWebsite), expectedId);
|
Assert.Equal(ScrobblingService.ExtractId<long>(link, ScrobblingService.AniListWeblinkWebsite), expectedId);
|
||||||
|
|
|
@ -829,12 +829,12 @@ public class ScrobblingService : IScrobblingService
|
||||||
if (!webLink.StartsWith(website)) continue;
|
if (!webLink.StartsWith(website)) continue;
|
||||||
var tokens = webLink.Split(website)[1].Split('/');
|
var tokens = webLink.Split(website)[1].Split('/');
|
||||||
var value = tokens[index];
|
var value = tokens[index];
|
||||||
if (typeof(T) == typeof(int))
|
if (typeof(T) == typeof(int?))
|
||||||
{
|
{
|
||||||
if (int.TryParse(value, out var intValue))
|
if (int.TryParse(value, out var intValue))
|
||||||
return (T)(object)intValue;
|
return (T)(object)intValue;
|
||||||
}
|
}
|
||||||
else if (typeof(T) == typeof(long))
|
else if (typeof(T) == typeof(long?))
|
||||||
{
|
{
|
||||||
if (long.TryParse(value, out var longValue))
|
if (long.TryParse(value, out var longValue))
|
||||||
return (T)(object)longValue;
|
return (T)(object)longValue;
|
||||||
|
|
|
@ -109,9 +109,9 @@ public static class Parser
|
||||||
new Regex(
|
new Regex(
|
||||||
@"(?<Series>.*)(\b|_)v(?<Volume>\d+-?\d+)( |_)",
|
@"(?<Series>.*)(\b|_)v(?<Volume>\d+-?\d+)( |_)",
|
||||||
MatchOptions, RegexTimeout),
|
MatchOptions, RegexTimeout),
|
||||||
// NEEDLESS_Vol.4_-Simeon_6_v2[SugoiSugoi].rar
|
// Nagasarete Airantou - Vol. 30 Ch. 187.5 - Vol.31 Omake
|
||||||
new Regex(
|
new Regex(
|
||||||
@"(?<Series>.*)(\b|_)(?!\[)(vol\.?)(?<Volume>\d+(-\d+)?)(?!\])",
|
@"^(?<Series>.+?)(\s*Chapter\s*\d+)?(\s|_|\-\s)+(Vol(ume)?\.?(\s|_)?)(?<Volume>\d+(\.\d+)?)(.+?|$)",
|
||||||
MatchOptions, RegexTimeout),
|
MatchOptions, RegexTimeout),
|
||||||
// Historys Strongest Disciple Kenichi_v11_c90-98.zip or Dance in the Vampire Bund v16-17
|
// Historys Strongest Disciple Kenichi_v11_c90-98.zip or Dance in the Vampire Bund v16-17
|
||||||
new Regex(
|
new Regex(
|
||||||
|
@ -137,6 +137,7 @@ public static class 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册
|
// Chinese Volume: 第n卷 -> Volume n, 第n册 -> Volume n, 幽游白书完全版 第03卷 天下 or 阿衰online 第1册
|
||||||
new Regex(
|
new Regex(
|
||||||
@"第(?<Volume>\d+)(卷|册)",
|
@"第(?<Volume>\d+)(卷|册)",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue