Fixes for MangasProject and MangaLivre (#725)
Fixes for MangasProject and MangaLivre
This commit is contained in:
parent
45fece1104
commit
17c20fc9ac
|
@ -5,7 +5,7 @@ ext {
|
||||||
appName = 'Tachiyomi: Mangá Livre'
|
appName = 'Tachiyomi: Mangá Livre'
|
||||||
pkgNameSuffix = 'pt.mangalivre'
|
pkgNameSuffix = 'pt.mangalivre'
|
||||||
extClass = '.MangaLivre'
|
extClass = '.MangaLivre'
|
||||||
extVersionCode = 2
|
extVersionCode = 3
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -140,41 +140,25 @@ class MangaLivre : HttpSource() {
|
||||||
val isCompleted = document.select("div#series-data span.series-author i.complete-series").first() != null
|
val isCompleted = document.select("div#series-data span.series-author i.complete-series").first() != null
|
||||||
val cGenre = document.select("div#series-data ul.tags li").joinToString { it!!.text() }
|
val cGenre = document.select("div#series-data ul.tags li").joinToString { it!!.text() }
|
||||||
|
|
||||||
val seriesAuthor = if (isCompleted) {
|
val seriesAuthor = document.select("div#series-data span.series-author").text()
|
||||||
document.select("div#series-data span.series-author").first()!!.nextSibling().toString().substringBeforeLast("+")
|
.substringAfter("Completo").substringBefore("+")
|
||||||
} else {
|
|
||||||
document.select("div#series-data span.series-author").first()!!.text().substringBeforeLast("+")
|
|
||||||
}
|
|
||||||
|
|
||||||
val authors = seriesAuthor.split("&")
|
val authors = seriesAuthor.split("&")
|
||||||
.map { it.trim() }
|
.map { it.trim() }
|
||||||
|
|
||||||
val cAuthor = authors.filter { !it.contains("(Arte)") }
|
val cAuthor = authors.filter { !it.contains("(Arte)") }
|
||||||
.map { author ->
|
.map { it.split(", ").reversed().joinToString(" ") }
|
||||||
if (author.contains(", ")) {
|
|
||||||
val authorSplit = author.split(", ")
|
|
||||||
authorSplit[1] + " " + authorSplit[0]
|
|
||||||
} else {
|
|
||||||
author
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val cArtist = authors.filter { it.contains("(Arte)") }
|
val cArtist = authors.filter { it.contains("(Arte)") }
|
||||||
.map { it.replace("\\(Arte\\)".toRegex(), "").trim() }
|
.map { it.replace("\\(Arte\\)".toRegex(), "").trim() }
|
||||||
.map { author ->
|
.map { it.split(", ").reversed().joinToString(" ") }
|
||||||
if (author.contains(", ")) {
|
|
||||||
val authorSplit = author.split(", ")
|
|
||||||
authorSplit[1] + " " + authorSplit[0]
|
|
||||||
} else {
|
|
||||||
author
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if the manga was removed by the publisher.
|
// Check if the manga was removed by the publisher.
|
||||||
val cStatus = if (document.select("div.series-blocked-img").first() == null) {
|
var seriesBlocked = document.select("div.series-blocked-img").first()
|
||||||
if (isCompleted) SManga.COMPLETED else SManga.ONGOING
|
val cStatus = when {
|
||||||
} else {
|
seriesBlocked == null && isCompleted -> SManga.COMPLETED
|
||||||
SManga.LICENSED
|
seriesBlocked == null && !isCompleted -> SManga.ONGOING
|
||||||
|
else -> SManga.LICENSED
|
||||||
}
|
}
|
||||||
|
|
||||||
return SManga.create().apply {
|
return SManga.create().apply {
|
||||||
|
@ -243,11 +227,14 @@ class MangaLivre : HttpSource() {
|
||||||
private fun chapterListItemParse(obj: JsonObject): SChapter {
|
private fun chapterListItemParse(obj: JsonObject): SChapter {
|
||||||
val scan = obj["releases"]!!.asJsonObject!!.entrySet().first().value.obj
|
val scan = obj["releases"]!!.asJsonObject!!.entrySet().first().value.obj
|
||||||
val cName = obj["chapter_name"]!!.asString
|
val cName = obj["chapter_name"]!!.asString
|
||||||
|
|
||||||
|
val scanlators = scan["scanlators"]!!.asJsonArray
|
||||||
|
.joinToString { it.asJsonObject["name"].asString }
|
||||||
|
|
||||||
return SChapter.create().apply {
|
return SChapter.create().apply {
|
||||||
name = "Cap. ${obj["number"]!!.asString}" + (if (cName == "") "" else " - $cName")
|
name = "Cap. ${obj["number"]!!.asString}" + (if (cName == "") "" else " - $cName")
|
||||||
date_upload = parseChapterDate(obj["date"].nullString)
|
date_upload = parseChapterDate(obj["date_created"].asString.substring(0, 10))
|
||||||
scanlator = scan["scanlators"]!!.asJsonArray.get(0)!!.asJsonObject["name"].nullString
|
scanlator = scanlators
|
||||||
url = scan["link"]!!.nullString ?: ""
|
url = scan["link"]!!.nullString ?: ""
|
||||||
chapter_number = obj["number"]!!.asString.toFloatOrNull() ?: "1".toFloat()
|
chapter_number = obj["number"]!!.asString.toFloatOrNull() ?: "1".toFloat()
|
||||||
}
|
}
|
||||||
|
@ -255,7 +242,7 @@ class MangaLivre : HttpSource() {
|
||||||
|
|
||||||
private fun parseChapterDate(date: String?) : Long {
|
private fun parseChapterDate(date: String?) : Long {
|
||||||
return try {
|
return try {
|
||||||
SimpleDateFormat("dd/MM/yy", Locale.ENGLISH).parse(date).time
|
SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH).parse(date).time
|
||||||
} catch (e: ParseException) {
|
} catch (e: ParseException) {
|
||||||
0L
|
0L
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ ext {
|
||||||
appName = 'Tachiyomi: mangásPROJECT'
|
appName = 'Tachiyomi: mangásPROJECT'
|
||||||
pkgNameSuffix = 'pt.mangasproject'
|
pkgNameSuffix = 'pt.mangasproject'
|
||||||
extClass = '.MangasProject'
|
extClass = '.MangasProject'
|
||||||
extVersionCode = 2
|
extVersionCode = 3
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -140,41 +140,25 @@ class MangasProject : HttpSource() {
|
||||||
val isCompleted = document.select("div#series-data span.series-author i.complete-series").first() != null
|
val isCompleted = document.select("div#series-data span.series-author i.complete-series").first() != null
|
||||||
val cGenre = document.select("div#series-data ul.tags li").joinToString { it!!.text() }
|
val cGenre = document.select("div#series-data ul.tags li").joinToString { it!!.text() }
|
||||||
|
|
||||||
val seriesAuthor = if (isCompleted) {
|
val seriesAuthor = document.select("div#series-data span.series-author").text()
|
||||||
document.select("div#series-data span.series-author").first()!!.nextSibling().toString().substringBeforeLast("+")
|
.substringAfter("Completo").substringBefore("+")
|
||||||
} else {
|
|
||||||
document.select("div#series-data span.series-author").first()!!.text().substringBeforeLast("+")
|
|
||||||
}
|
|
||||||
|
|
||||||
val authors = seriesAuthor.split("&")
|
val authors = seriesAuthor.split("&")
|
||||||
.map { it.trim() }
|
.map { it.trim() }
|
||||||
|
|
||||||
val cAuthor = authors.filter { !it.contains("(Arte)") }
|
val cAuthor = authors.filter { !it.contains("(Arte)") }
|
||||||
.map { author ->
|
.map { it.split(", ").reversed().joinToString(" ") }
|
||||||
if (author.contains(", ")) {
|
|
||||||
val authorSplit = author.split(", ")
|
|
||||||
authorSplit[1] + " " + authorSplit[0]
|
|
||||||
} else {
|
|
||||||
author
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val cArtist = authors.filter { it.contains("(Arte)") }
|
val cArtist = authors.filter { it.contains("(Arte)") }
|
||||||
.map { it.replace("\\(Arte\\)".toRegex(), "").trim() }
|
.map { it.replace("\\(Arte\\)".toRegex(), "").trim() }
|
||||||
.map { author ->
|
.map { it.split(", ").reversed().joinToString(" ") }
|
||||||
if (author.contains(", ")) {
|
|
||||||
val authorSplit = author.split(", ")
|
|
||||||
authorSplit[1] + " " + authorSplit[0]
|
|
||||||
} else {
|
|
||||||
author
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if the manga was removed by the publisher.
|
// Check if the manga was removed by the publisher.
|
||||||
val cStatus = if (document.select("div.series-blocked-img").first() == null) {
|
var seriesBlocked = document.select("div.series-blocked-img").first()
|
||||||
if (isCompleted) SManga.COMPLETED else SManga.ONGOING
|
val cStatus = when {
|
||||||
} else {
|
seriesBlocked == null && isCompleted -> SManga.COMPLETED
|
||||||
SManga.LICENSED
|
seriesBlocked == null && !isCompleted -> SManga.ONGOING
|
||||||
|
else -> SManga.LICENSED
|
||||||
}
|
}
|
||||||
|
|
||||||
return SManga.create().apply {
|
return SManga.create().apply {
|
||||||
|
@ -243,11 +227,14 @@ class MangasProject : HttpSource() {
|
||||||
private fun chapterListItemParse(obj: JsonObject): SChapter {
|
private fun chapterListItemParse(obj: JsonObject): SChapter {
|
||||||
val scan = obj["releases"]!!.asJsonObject!!.entrySet().first().value.obj
|
val scan = obj["releases"]!!.asJsonObject!!.entrySet().first().value.obj
|
||||||
val cName = obj["chapter_name"]!!.asString
|
val cName = obj["chapter_name"]!!.asString
|
||||||
|
|
||||||
|
val scanlators = scan["scanlators"]!!.asJsonArray
|
||||||
|
.joinToString { it.asJsonObject["name"].asString }
|
||||||
|
|
||||||
return SChapter.create().apply {
|
return SChapter.create().apply {
|
||||||
name = "Cap. ${obj["number"]!!.asString}" + (if (cName == "") "" else " - $cName")
|
name = "Cap. ${obj["number"]!!.asString}" + (if (cName == "") "" else " - $cName")
|
||||||
date_upload = parseChapterDate(obj["date"].nullString)
|
date_upload = parseChapterDate(obj["date_created"].asString.substring(0, 10))
|
||||||
scanlator = scan["scanlators"]!!.asJsonArray.get(0)!!.asJsonObject["name"].nullString
|
scanlator = scanlators
|
||||||
url = scan["link"]!!.nullString ?: ""
|
url = scan["link"]!!.nullString ?: ""
|
||||||
chapter_number = obj["number"]!!.asString.toFloatOrNull() ?: "1".toFloat()
|
chapter_number = obj["number"]!!.asString.toFloatOrNull() ?: "1".toFloat()
|
||||||
}
|
}
|
||||||
|
@ -255,7 +242,7 @@ class MangasProject : HttpSource() {
|
||||||
|
|
||||||
private fun parseChapterDate(date: String?) : Long {
|
private fun parseChapterDate(date: String?) : Long {
|
||||||
return try {
|
return try {
|
||||||
SimpleDateFormat("dd/MM/yy", Locale.ENGLISH).parse(date).time
|
SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH).parse(date).time
|
||||||
} catch (e: ParseException) {
|
} catch (e: ParseException) {
|
||||||
0L
|
0L
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue