mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-18 15:07:30 +01:00
Fix chapter recognition. Improve initial requests to fetch chapters from source
This commit is contained in:
@@ -10,7 +10,7 @@ import eu.kanade.mangafeed.data.database.models.Manga;
|
||||
|
||||
public class ChapterRecognition {
|
||||
|
||||
private static Pattern p1 = Pattern.compile("ch.?(\\d+[\\.,]?\\d*)");
|
||||
private static Pattern p1 = Pattern.compile("Ch[^0-9]?\\s*(\\d+[\\.,]?\\d*)");
|
||||
private static Pattern p2 = Pattern.compile("(\\d+[\\.,]?\\d*)");
|
||||
private static Pattern p3 = Pattern.compile("(\\d+[\\.,]?\\d*:)");
|
||||
|
||||
@@ -19,7 +19,7 @@ public class ChapterRecognition {
|
||||
return;
|
||||
|
||||
// Remove spaces and convert to lower case
|
||||
String name = replaceIrrelevantCharacters(chapter.name);
|
||||
String name = chapter.name;
|
||||
Matcher matcher;
|
||||
|
||||
// Safest option, the chapter has a token prepended
|
||||
@@ -29,6 +29,8 @@ public class ChapterRecognition {
|
||||
return;
|
||||
}
|
||||
|
||||
name = replaceIrrelevantCharacters(name);
|
||||
|
||||
List<Float> occurences;
|
||||
|
||||
// If there's only one number, use it
|
||||
@@ -71,7 +73,7 @@ public class ChapterRecognition {
|
||||
Matcher m = p2.matcher(text);
|
||||
if (m.find()) {
|
||||
try {
|
||||
Float value = Float.parseFloat(m.group());
|
||||
Float value = Float.parseFloat(m.group(1));
|
||||
if (!occurences.contains(value)) {
|
||||
occurences.add(value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user