use of ar.rulosoft.mimanganu.componentes.Chapter in project MiMangaNu by raulhaag.
the class MangaKawaii method loadMangaInformation.
@Override
public void loadMangaInformation(Manga manga, boolean forceReload) throws Exception {
if (manga.getChapters().isEmpty() || forceReload) {
String source = getNavigatorAndFlushParameters().get(manga.getPath());
// Cover
if (manga.getImages() == null || manga.getImages().isEmpty()) {
String img = getFirstMatchDefault("src='(https://www.mangakawaii.com/uploads/manga/[^\"]+?)'", source, "");
manga.setImages(img);
}
// Summary
manga.setSynopsis(getFirstMatchDefault("id=\"synopsis\">[\\s]*<p>(.+?)</p>", source, context.getString(R.string.nodisponible)));
// Status
manga.setFinished(!getFirstMatchDefault("Statut(.+?)</span>", source, "").contains("En Cours"));
// Author
manga.setAuthor(getFirstMatchDefault("author/.+?\">(.+?)</a>", source, context.getString(R.string.nodisponible)));
// Genre
manga.setGenre(getFirstMatchDefault("Genres</span>(.+?)</span>", source, context.getString(R.string.nodisponible)));
// Chapters
Pattern p = Pattern.compile("href=\"(https://www\\.mangakawaii\\.com/manga/[^\"]+?)\">([^\"]+?)</a>", Pattern.DOTALL);
Matcher matcher = p.matcher(source);
ArrayList<String> tmpChapterList = new ArrayList<>();
while (matcher.find()) {
if (!tmpChapterList.contains(matcher.group(1))) {
manga.addChapterFirst(new Chapter(matcher.group(2), matcher.group(1)));
tmpChapterList.add(matcher.group(1));
}
}
}
}
use of ar.rulosoft.mimanganu.componentes.Chapter in project MiMangaNu by raulhaag.
the class MangaStream method loadMangaInformation.
@Override
public void loadMangaInformation(Manga manga, boolean forceReload) throws Exception {
if (manga.getChapters().isEmpty() || forceReload) {
String source = getNavigatorAndFlushParameters().get(manga.getPath());
// no Summary
manga.setSynopsis(context.getString(R.string.nodisponible));
// no Status
manga.setFinished(true);
// no Authors
manga.setAuthor(context.getString(R.string.nodisponible));
// no Genres
manga.setGenre(context.getString(R.string.nodisponible));
// Chapters
Pattern p = Pattern.compile(PATTERN_CHAPTER, Pattern.DOTALL);
Matcher matcher = p.matcher(source);
while (matcher.find()) {
manga.addChapterFirst(new Chapter(matcher.group(2), HOST + matcher.group(1)));
}
// Cover - use first image of latest chapter (if present)
ArrayList<Chapter> chapters = manga.getChapters();
manga.setImages("");
if (!chapters.isEmpty()) {
source = getNavigatorAndFlushParameters().get(chapters.get(chapters.size() - 1).getPath());
String image = getFirstMatchDefault(PATTERN_IMAGE, source, "");
if (!image.isEmpty()) {
manga.setImages("http:" + image);
}
}
}
}
use of ar.rulosoft.mimanganu.componentes.Chapter in project MiMangaNu by raulhaag.
the class MangaTown method loadChapters.
@Override
public void loadChapters(Manga manga, boolean forceReload) throws Exception {
if (manga.getChapters().isEmpty() || forceReload) {
String data = getNavigatorAndFlushParameters().get(manga.getPath());
// cover image
manga.setImages(getFirstMatchDefault(PATTERN_COVER, data, ""));
// summary
manga.setSynopsis(getFirstMatchDefault(PATTERN_SUMMARY, data, context.getString(R.string.nodisponible)));
// ongoing or completed
manga.setFinished(data.contains(PATTERN_COMPLETED));
// author
manga.setAuthor(getFirstMatchDefault(PATTERN_AUTHOR, data, context.getString(R.string.nodisponible)));
// genre
manga.setGenre(getFirstMatchDefault(PATTERN_GENRE, data, context.getString(R.string.nodisponible)));
// chapter
Pattern p = Pattern.compile(PATTERN_CHAPTER, Pattern.DOTALL);
Matcher m = p.matcher(data);
while (m.find()) {
manga.addChapterFirst(new Chapter(m.group(2), "http:" + m.group(1)));
}
}
}
use of ar.rulosoft.mimanganu.componentes.Chapter in project MiMangaNu by raulhaag.
the class MyMangaIo method loadChapters.
@Override
public void loadChapters(Manga manga, boolean forceReload) throws Exception {
if (manga.getChapters().isEmpty() || forceReload) {
String data = getNavigatorWithNeededHeader().get(manga.getPath());
// Cover
manga.setImages(HOST + getFirstMatchDefault("<img src=\"(images/mangas_thumb/.+?)\"", data, ""));
// Summary
manga.setSynopsis(getFirstMatchDefault("Synopsis</h1>\\s+<p><[^>]+>(.+?)</p>", data, context.getString(R.string.nodisponible)));
// Status
manga.setFinished(!data.contains("en cours</a>"));
// Author
manga.setAuthor(getFirstMatchDefault("Auteur\\s*:\\s*(.+?)</tr>", data, context.getString(R.string.nodisponible)));
// Genre
manga.setGenre(getFirstMatchDefault("Sous-Genres\\s*:\\s*(.+?)</tr>", data, context.getString(R.string.nodisponible)));
// Chapter
Pattern p = Pattern.compile("href=\"([^\"]+)\"[^>]+title=\"Li.+?<span class=\"chapter\">(.+?)<", Pattern.DOTALL);
Matcher m = p.matcher(data);
while (m.find()) {
manga.addChapterFirst(new Chapter(m.group(2).trim(), m.group(1)));
}
}
}
use of ar.rulosoft.mimanganu.componentes.Chapter in project MiMangaNu by raulhaag.
the class FromFolder method loadChapters.
@Override
public void loadChapters(Manga manga, boolean forceReload) throws Exception {
manga.setImages(manga.getPath() + "cover.jpg");
ArrayList<String> folders = Util.getInstance().dirList(manga.getPath());
ArrayList<Chapter> chapters = new ArrayList<>();
// remove "."
folders.remove(0);
for (String folder : folders) {
Chapter chapter = new Chapter(folder, manga.getPath() + folder + "/");
chapter.setDownloaded(true);
chapters.add(chapter);
}
Chapter.Comparators.setManga_title(manga.getTitle());
Collections.sort(chapters, Chapter.Comparators.NUMBERS_ASC);
manga.setChapters(chapters);
manga.setAuthor(context.getString(R.string.nodisponible));
manga.setGenre(context.getString(R.string.nodisponible));
manga.setSynopsis(context.getString(R.string.nodisponible));
manga.setFinished(true);
}
Aggregations