Rewrite sources. Implement Batoto and Kissmanga

This commit is contained in:
len
2016-03-22 19:00:05 +01:00
parent bc3d5dc863
commit dd5692bb2d
36 changed files with 1516 additions and 2571 deletions

View File

@@ -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)
}

View File

@@ -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");
}
}