fix covers (#493)
This commit is contained in:
parent
4dd1719cfc
commit
c338b9adc9
|
@ -5,8 +5,8 @@ ext {
|
||||||
appName = 'Tachiyomi: My Manga Reader CMS (Many sources)'
|
appName = 'Tachiyomi: My Manga Reader CMS (Many sources)'
|
||||||
pkgNameSuffix = 'all.mmrcms'
|
pkgNameSuffix = 'all.mmrcms'
|
||||||
extClass = '.MyMangaReaderCMSSources'
|
extClass = '.MyMangaReaderCMSSources'
|
||||||
extVersionCode = 8
|
extVersionCode = 9
|
||||||
extVersionSuffix = 8
|
extVersionSuffix = 9
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ class MyMangaReaderCMSSource(override val lang: String,
|
||||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||||
//Query overrides everything
|
//Query overrides everything
|
||||||
val url: Uri.Builder
|
val url: Uri.Builder
|
||||||
if(query.isNotBlank()) {
|
if (query.isNotBlank()) {
|
||||||
url = Uri.parse("$baseUrl/search")!!.buildUpon()
|
url = Uri.parse("$baseUrl/search")!!.buildUpon()
|
||||||
url.appendQueryParameter("query", query)
|
url.appendQueryParameter("query", query)
|
||||||
} else {
|
} else {
|
||||||
|
@ -41,11 +41,12 @@ class MyMangaReaderCMSSource(override val lang: String,
|
||||||
}
|
}
|
||||||
return GET(url.toString())
|
return GET(url.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/filterList?page=$page&sortBy=last_release&asc=false")
|
override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/filterList?page=$page&sortBy=last_release&asc=false")
|
||||||
|
|
||||||
override fun popularMangaParse(response: Response) = internalMangaParse(response)
|
override fun popularMangaParse(response: Response) = internalMangaParse(response)
|
||||||
override fun searchMangaParse(response: Response): MangasPage {
|
override fun searchMangaParse(response: Response): MangasPage {
|
||||||
return if(response.request().url().queryParameter("query")?.isNotBlank() == true) {
|
return if (response.request().url().queryParameter("query")?.isNotBlank() == true) {
|
||||||
//If a search query was specified, use search instead!
|
//If a search query was specified, use search instead!
|
||||||
MangasPage(jsonParser
|
MangasPage(jsonParser
|
||||||
.parse(response.body()!!.string())["suggestions"].array
|
.parse(response.body()!!.string())["suggestions"].array
|
||||||
|
@ -63,6 +64,7 @@ class MyMangaReaderCMSSource(override val lang: String,
|
||||||
internalMangaParse(response)
|
internalMangaParse(response)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun latestUpdatesParse(response: Response) = internalMangaParse(response)
|
override fun latestUpdatesParse(response: Response) = internalMangaParse(response)
|
||||||
|
|
||||||
private fun internalMangaParse(response: Response): MangasPage {
|
private fun internalMangaParse(response: Response): MangasPage {
|
||||||
|
@ -75,7 +77,7 @@ class MyMangaReaderCMSSource(override val lang: String,
|
||||||
thumbnail_url = it.select(".media-left img").attr("src")
|
thumbnail_url = it.select(".media-left img").attr("src")
|
||||||
|
|
||||||
// Guess thumbnails on broken websites
|
// Guess thumbnails on broken websites
|
||||||
if (thumbnail_url?.isBlank() != false || thumbnail_url?.endsWith("no-image.png") != false) {
|
if (thumbnail_url?.isBlank() != false || thumbnail_url?.endsWith("no-image.png") != false || thumbnail_url?.startsWith("//") != false) {
|
||||||
thumbnail_url = "$baseUrl/uploads/manga/${url.substringAfterLast('/')}/cover/cover_250x350.jpg"
|
thumbnail_url = "$baseUrl/uploads/manga/${url.substringAfterLast('/')}/cover/cover_250x350.jpg"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,8 +88,8 @@ class MyMangaReaderCMSSource(override val lang: String,
|
||||||
val parsedNewUrl = Uri.parse(newUrl)
|
val parsedNewUrl = Uri.parse(newUrl)
|
||||||
val newPathSegments = parsedNewUrl.pathSegments.toMutableList()
|
val newPathSegments = parsedNewUrl.pathSegments.toMutableList()
|
||||||
|
|
||||||
for(i in parsedBaseUrl.pathSegments) {
|
for (i in parsedBaseUrl.pathSegments) {
|
||||||
if(i.trim().equals(newPathSegments.first(), true)) {
|
if (i.trim().equals(newPathSegments.first(), true)) {
|
||||||
newPathSegments.removeAt(0)
|
newPathSegments.removeAt(0)
|
||||||
} else break
|
} else break
|
||||||
}
|
}
|
||||||
|
@ -104,17 +106,17 @@ class MyMangaReaderCMSSource(override val lang: String,
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mangaDetailsParse(response:Response) = SManga.create().apply {
|
override fun mangaDetailsParse(response: Response) = SManga.create().apply {
|
||||||
val document = response.asJsoup()
|
val document = response.asJsoup()
|
||||||
title = document.getElementsByClass("widget-title").text().trim()
|
title = document.getElementsByClass("widget-title").text().trim()
|
||||||
thumbnail_url = document.select(".row .img-responsive").attr("src")
|
thumbnail_url = document.select(".row .img-responsive").attr("src")
|
||||||
description = document.select(".row .well p").text().trim()
|
description = document.select(".row .well p").text().trim()
|
||||||
|
|
||||||
var cur: String? = null
|
var cur: String? = null
|
||||||
for(element in document.select(".row .dl-horizontal").select("dt,dd")) {
|
for (element in document.select(".row .dl-horizontal").select("dt,dd")) {
|
||||||
when(element.tagName()) {
|
when (element.tagName()) {
|
||||||
"dt" -> cur = element.text().trim().toLowerCase()
|
"dt" -> cur = element.text().trim().toLowerCase()
|
||||||
"dd" -> when(cur) {
|
"dd" -> when (cur) {
|
||||||
"author(s)",
|
"author(s)",
|
||||||
"autor(es)",
|
"autor(es)",
|
||||||
"auteur(s)",
|
"auteur(s)",
|
||||||
|
@ -155,7 +157,7 @@ class MyMangaReaderCMSSource(override val lang: String,
|
||||||
"状態",
|
"状態",
|
||||||
"durum",
|
"durum",
|
||||||
"الحالة",
|
"الحالة",
|
||||||
"статус" -> status = when(element.text().trim().toLowerCase()) {
|
"статус" -> status = when (element.text().trim().toLowerCase()) {
|
||||||
"complete",
|
"complete",
|
||||||
"مكتملة",
|
"مكتملة",
|
||||||
"complet" -> SManga.COMPLETED
|
"complet" -> SManga.COMPLETED
|
||||||
|
@ -218,13 +220,12 @@ class MyMangaReaderCMSSource(override val lang: String,
|
||||||
return chapter
|
return chapter
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun pageListParse(response: Response)
|
override fun pageListParse(response: Response) = response.asJsoup().select("#all > .img-responsive")
|
||||||
= response.asJsoup().select("#all > .img-responsive")
|
|
||||||
.mapIndexed { i, e ->
|
.mapIndexed { i, e ->
|
||||||
var url = e.attr("data-src")
|
var url = e.attr("data-src")
|
||||||
|
|
||||||
if(url.isBlank()) {
|
if (url.isBlank()) {
|
||||||
url = e.attr("src")
|
url = e.attr("src")
|
||||||
}
|
}
|
||||||
|
|
||||||
url = url.trim()
|
url = url.trim()
|
||||||
|
@ -232,8 +233,7 @@ class MyMangaReaderCMSSource(override val lang: String,
|
||||||
Page(i, url, url)
|
Page(i, url, url)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun imageUrlParse(response: Response)
|
override fun imageUrlParse(response: Response) = throw UnsupportedOperationException("Unused method called!")
|
||||||
= throw UnsupportedOperationException("Unused method called!")
|
|
||||||
|
|
||||||
private fun getInitialFilterList() = listOf<Filter<*>>(
|
private fun getInitialFilterList() = listOf<Filter<*>>(
|
||||||
Filter.Header("NOTE: Ignored if using text search!"),
|
Filter.Header("NOTE: Ignored if using text search!"),
|
||||||
|
@ -260,12 +260,12 @@ class MyMangaReaderCMSSource(override val lang: String,
|
||||||
* Returns the list of filters for the source.
|
* Returns the list of filters for the source.
|
||||||
*/
|
*/
|
||||||
override fun getFilterList() = FilterList(
|
override fun getFilterList() = FilterList(
|
||||||
if(tagMappings != null)
|
if (tagMappings != null)
|
||||||
(getInitialFilterList() + UriSelectFilter("Tag",
|
(getInitialFilterList() + UriSelectFilter("Tag",
|
||||||
"tag",
|
"tag",
|
||||||
arrayOf("" to "Any",
|
arrayOf("" to "Any",
|
||||||
*tagMappings.toTypedArray()
|
*tagMappings.toTypedArray()
|
||||||
)))
|
)))
|
||||||
else getInitialFilterList()
|
else getInitialFilterList()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -285,13 +285,13 @@ class MyMangaReaderCMSSource(override val lang: String,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class AuthorFilter: Filter.Text("Author"), UriFilter {
|
class AuthorFilter : Filter.Text("Author"), UriFilter {
|
||||||
override fun addToUri(uri: Uri.Builder) {
|
override fun addToUri(uri: Uri.Builder) {
|
||||||
uri.appendQueryParameter("author", state)
|
uri.appendQueryParameter("author", state)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class SortFilter: Filter.Sort("Sort",
|
class SortFilter : Filter.Sort("Sort",
|
||||||
sortables.map { it.second }.toTypedArray(),
|
sortables.map { it.second }.toTypedArray(),
|
||||||
Filter.Sort.Selection(0, true)), UriFilter {
|
Filter.Sort.Selection(0, true)), UriFilter {
|
||||||
override fun addToUri(uri: Uri.Builder) {
|
override fun addToUri(uri: Uri.Builder) {
|
||||||
|
|
Loading…
Reference in New Issue