Update chapterRecognition for readmanga and mintmanga

This commit is contained in:
Evgeny 2016-02-21 18:42:26 +03:00
parent 44d7632002
commit 1836327eb2

View File

@ -7,6 +7,7 @@ import java.util.regex.Pattern;
import eu.kanade.tachiyomi.data.database.models.Chapter;
import eu.kanade.tachiyomi.data.database.models.Manga;
import eu.kanade.tachiyomi.data.source.SourceManager;
public class ChapterRecognition {
@ -30,6 +31,20 @@ public class ChapterRecognition {
String name = chapter.name.toLowerCase();
Matcher matcher;
// for readmanga and mintmanga get chapter number from url
// url example: /fairytail/vol55/464?mature=1
// chapter_number = 55.464
if (manga.source == SourceManager.READMANGA || manga.source == SourceManager.MINTMANGA) {
try {
String[] url_parts = chapter.url.replace("?mature=1", "").split("/");
String vol_number = url_parts[url_parts.length - 2].replace("vol", "");
String chapter_number = url_parts[url_parts.length - 1];
chapter.chapter_number = Float.parseFloat(vol_number + "." + chapter_number);
return;
} catch (Exception e) {
}
}
// Safest option, the chapter has a token prepended and nothing at the end of the number
matcher = cleanWithToken.matcher(name);
if (matcher.find()) {
@ -180,6 +195,7 @@ public class ChapterRecognition {
}
return str2.substring(at);
}
public static int indexOfDifference(String str1, String str2) {
if (str1 == str2) {
return -1;