mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-15 05:27:28 +01:00
Rewrite sources. Implement Batoto and Kissmanga
This commit is contained in:
@@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.util
|
||||
import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
||||
import eu.kanade.tachiyomi.data.database.models.Chapter
|
||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||
import eu.kanade.tachiyomi.data.source.base.OnlineSource
|
||||
import eu.kanade.tachiyomi.data.source.base.Source
|
||||
import java.util.*
|
||||
|
||||
@@ -34,7 +35,9 @@ fun syncChaptersWithSource(db: DatabaseHelper,
|
||||
|
||||
// Recognize number for new chapters.
|
||||
toAdd.forEach {
|
||||
source.parseChapterNumber(it)
|
||||
if (source is OnlineSource) {
|
||||
source.parseChapterNumber(it)
|
||||
}
|
||||
ChapterRecognition.parseChapterNumber(it, manga)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
package eu.kanade.tachiyomi.util;
|
||||
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import org.jsoup.nodes.Element;
|
||||
import org.jsoup.select.Elements;
|
||||
|
||||
public final class Parser {
|
||||
|
||||
private Parser() throws InstantiationException {
|
||||
throw new InstantiationException("This class is not for instantiation");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Element element(Element container, String pattern) {
|
||||
return container.select(pattern).first();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String text(Element container, String pattern) {
|
||||
return text(container, pattern, null);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String text(Element container, String pattern, String defValue) {
|
||||
Element element = container.select(pattern).first();
|
||||
return element != null ? element.text() : defValue;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String allText(Element container, String pattern) {
|
||||
Elements elements = container.select(pattern);
|
||||
return !elements.isEmpty() ? elements.text() : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String attr(Element container, String pattern, String attr) {
|
||||
Element element = container.select(pattern).first();
|
||||
return element != null ? element.attr(attr) : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String href(Element container, String pattern) {
|
||||
return attr(container, pattern, "href");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String src(Element container, String pattern) {
|
||||
return attr(container, pattern, "src");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user