use of ar.rulosoft.mimanganu.componentes.Chapter in project MiMangaNu by raulhaag.
the class SubManga method loadChapters.
@Override
public void loadChapters(Manga manga, boolean forceReload) throws Exception {
if (manga.getChapters().isEmpty() || forceReload) {
String data = getNavigatorAndFlushParameters().get((manga.getPath() + "/completa"));
Pattern p = Pattern.compile("<tr[^>]*><td[^>]*><a href=\"http://submanga.com/([^\"|#]+)\">(.+?)</a>", Pattern.DOTALL);
Matcher m = p.matcher(data);
while (m.find()) {
String web = HOST + "/c" + m.group(1).substring(m.group(1).lastIndexOf("/"));
manga.addChapterFirst(new Chapter(m.group(2), web));
}
}
}
use of ar.rulosoft.mimanganu.componentes.Chapter in project MiMangaNu by raulhaag.
the class Taadd method loadMangaInformation.
@Override
public void loadMangaInformation(Manga manga, boolean forceReload) throws Exception {
if (manga.getChapters().isEmpty() || forceReload) {
String source = getNavigatorAndFlushParameters().get(manga.getPath() + "?waring=1");
// Cover
if (manga.getImages() == null || manga.getImages().isEmpty()) {
String img = getFirstMatchDefault("src=\"(http://pic\\.taadd\\.com/files/img/logo/[^\"]+)\"", source, "");
manga.setImages(img);
}
// Summary
String summary = getFirstMatchDefault("Summary(.+?)</td>", source, context.getString(R.string.nodisponible));
manga.setSynopsis(summary);
// Status
manga.setFinished(source.contains(">Completed</a>"));
// Author
manga.setAuthor(getFirstMatchDefault("author-(.+?).html\">", source, context.getString(R.string.nodisponible)));
// Genre
manga.setGenre(getFirstMatchDefault("Categories:(.+?)</a>[^<]*</td>", source, context.getString(R.string.nodisponible)).replaceAll("<img[^>]+>", "").replaceAll(" ", "").replaceAll("</a>", ","));
// Chapters
Pattern p = Pattern.compile("href=\"(/chapter/[^-\"]+?)\">(.+?)</a>", Pattern.DOTALL);
Matcher matcher = p.matcher(source);
while (matcher.find()) {
manga.addChapterFirst(new Chapter(matcher.group(2), HOST + matcher.group(1)));
}
}
}
use of ar.rulosoft.mimanganu.componentes.Chapter in project MiMangaNu by raulhaag.
the class TuMangaOnline method getChaptersJsonArray.
private ArrayList<Chapter> getChaptersJsonArray(JSONArray jsonArray, String mid) {
ArrayList<Chapter> result = new ArrayList<>();
for (int i = 0; i < jsonArray.length(); i++) {
try {
JSONObject object = jsonArray.getJSONObject(i);
Chapter c = new Chapter("CapĂtulo " + object.getString("numCapitulo") + " " + (object.getString("nombre").equalsIgnoreCase("null") ? "" : object.getString("nombre")), getServerID() + "_" + mid + "_" + object.getString("numCapitulo"));
c.setExtra("https://www.tumangaonline.com/api/v1/imagenes?idManga=" + mid + "&idScanlation=" + object.getJSONArray("subidas").getJSONObject(0).getString("idScan") + "&numeroCapitulo=" + object.getString("numCapitulo") + "&visto=false");
result.add(0, c);
} catch (JSONException e) {
e.printStackTrace();
}
}
return result;
}
use of ar.rulosoft.mimanganu.componentes.Chapter in project MiMangaNu by raulhaag.
the class TuMangaOnline method searchForNewChapters.
@Override
public int searchForNewChapters(int id, Context context, boolean fast) throws Exception {
// TODO FAST
int returnValue;
Manga mangaDb = Database.getFullManga(context, id);
Manga manga = new Manga(mangaDb.getServerId(), mangaDb.getTitle(), mangaDb.getPath(), false);
manga.setId(mangaDb.getId());
this.loadMangaInformation(manga, true);
loadChapters(manga, false, true);
manga.getChapters().removeAll(mangaDb.getChapters());
for (Chapter chapter : manga.getChapters()) {
chapter.setMangaID(mangaDb.getId());
chapter.setReadStatus(Chapter.NEW);
Database.addChapter(context, chapter, mangaDb.getId());
}
if (manga.getChapters().size() > 0) {
Database.updateMangaRead(context, mangaDb.getId());
Database.updateNewMangas(context, mangaDb, manga.getChapters().size());
}
returnValue = manga.getChapters().size();
if (returnValue > 0)
new CreateGroupByMangaNotificationsTask(manga.getChapters(), manga, context).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
boolean changes = false;
if (!mangaDb.getAuthor().equals(manga.getAuthor()) && manga.getAuthor().length() > 2) {
mangaDb.setAuthor(manga.getAuthor());
changes = true;
}
if (!mangaDb.getImages().equals(manga.getImages()) && manga.getImages().length() > 2) {
mangaDb.setImages(manga.getImages());
changes = true;
}
if (!mangaDb.getSynopsis().equals(manga.getSynopsis()) && manga.getSynopsis().length() > 2) {
mangaDb.setSynopsis(manga.getSynopsis());
changes = true;
}
if (!mangaDb.getGenre().equals(manga.getGenre()) && manga.getGenre().length() > 2) {
mangaDb.setGenre(manga.getGenre());
changes = true;
}
if (mangaDb.isFinished() != manga.isFinished()) {
mangaDb.setFinished(manga.isFinished());
changes = true;
}
if (changes)
Database.updateManga(context, mangaDb, false);
return returnValue;
}
use of ar.rulosoft.mimanganu.componentes.Chapter in project MiMangaNu by raulhaag.
the class MangaPanda method loadMangaInformation.
@Override
public void loadMangaInformation(Manga manga, boolean forceReload) throws Exception {
if (manga.getChapters().isEmpty() || forceReload) {
String data = getNavigatorAndFlushParameters().get(manga.getPath());
Pattern p = Pattern.compile(PATTERN_FRAG_CHAPTER, Pattern.DOTALL);
Matcher m = p.matcher(data);
if (m.find()) {
manga.getChapters().clear();
Pattern p1 = Pattern.compile(PATTERN_CHAPTER, Pattern.DOTALL);
Matcher m1 = p1.matcher(m.group(1));
while (m1.find()) {
String web = m1.group(1);
if (web.matches(PATTERN_CHAPTER_WEB)) {
Pattern p2 = Pattern.compile(PATTERN_CHAPTER_WEB, Pattern.DOTALL);
Matcher m2 = p2.matcher(web);
if (m2.find())
web = m2.group(1) + "/" + m2.group(2);
}
String chName = m1.group(2);
if (!m1.group(3).trim().isEmpty()) {
chName += " :" + m1.group(3);
}
manga.addChapterLast(new Chapter(chName, HOST + web));
}
}
// Summary
manga.setSynopsis(getFirstMatchDefault("<p>(.+)</p>", data, context.getString(R.string.nodisponible)));
// Cover
manga.setImages(getFirstMatchDefault("mangaimg\"><img src=\"([^\"]+)", data, ""));
// Status
manga.setFinished(data.contains("<td>Completed</td>"));
// Genre
manga.setGenre(getFirstMatchDefault("Genre:</td>[^<]*<td>(.+?)</td>", data, context.getString(R.string.nodisponible)).replace("a> <a", "a>, <a"));
assert manga.getGenre() != null;
if (manga.getGenre().isEmpty()) {
manga.setGenre(context.getString(R.string.nodisponible));
}
// Author
manga.setAuthor(getFirstMatchDefault("Author:</td>[^<]*<td>([^<]+)", data, context.getString(R.string.nodisponible)));
}
}
Aggregations