Update TMO / Lector (#2178)

Update TMO / Lector
This commit is contained in:
happywillow0 2020-02-04 07:19:30 -05:00 committed by GitHub
parent f10a30c73c
commit 3308ca3363
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 58 additions and 9 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: LectorManga'
pkgNameSuffix = 'es.lectormanga'
extClass = '.LectorManga'
extVersionCode = 5
extVersionCode = 6
libVersion = '1.2'
}

View File

@ -270,13 +270,15 @@ class LectorManga : ConfigurableSource, ParsedHttpSource() {
}
val newurl = getBuilder(geturl,getHeaders,formBody,method)
val url = if (newurl.contains("paginated")) {
val url = if (getPageMethod()=="cascade" && newurl.contains("paginated")) {
newurl.substringBefore("paginated") + "cascade"
} else if (getPageMethod()=="paginated" && newurl.contains("cascade")) {
newurl.substringBefore("cascade") + "paginated"
} else newurl
val headers = headersBuilder()
.add("User-Agent", userAgent)
.add("Referer", "$baseUrl/library/manga/")
.add("Referer", newurl)
.build()
// Get /cascade instead of /paginate to get all pages at once
@ -284,12 +286,21 @@ class LectorManga : ConfigurableSource, ParsedHttpSource() {
}
override fun pageListParse(document: Document): List<Page> = mutableListOf<Page>().apply {
document.select("div#viewer-container > div.viewer-image-container > img.viewer-image")?.forEach {
if (getPageMethod()=="cascade") {
val style = document.select("style:containsData(height)").html()
document.select( "img[id]").filterNot { it.attr("id") in style }.forEach {
add(Page(size, "", it.attr("src")))
}
} else {
val pageList = document.select("#viewer-pages-select").first().select("option").map { it.attr("value").toInt() }
val url = document.baseUri().substringBefore("/paginated") //Accounts for url ending in number "/paginated/1"
pageList.forEach {
add(Page(it, "$url/paginated/$it"))
}
}
}
override fun imageUrlParse(document: Document) = throw UnsupportedOperationException("Not used")
override fun imageUrlParse(document: Document): String = document.select("img.viewer-image").attr("src")
private class Types : UriPartFilter("Tipo", arrayOf(
Pair("Ver todo", ""),
@ -412,6 +423,7 @@ class LectorManga : ConfigurableSource, ParsedHttpSource() {
}
// Preferences Code
override fun setupPreferenceScreen(screen: androidx.preference.PreferenceScreen) {
val deduppref = androidx.preference.ListPreference(screen.context).apply {
key = DEDUP_PREF_Title
@ -427,7 +439,23 @@ class LectorManga : ConfigurableSource, ParsedHttpSource() {
preferences.edit().putString(DEDUP_PREF, entry).commit()
}
}
val pageMethod = androidx.preference.ListPreference(screen.context).apply {
key = PAGEGET_PREF_Title
title = PAGEGET_PREF_Title
entries = arrayOf("Cascada", "Paginada")
entryValues = arrayOf("cascade", "paginated")
summary = "%s"
setOnPreferenceChangeListener { _, newValue ->
val selected = newValue as String
val index = this.findIndexOfValue(selected)
val entry = entryValues.get(index) as String
preferences.edit().putString(PAGEGET_PREF, entry).commit()
}
}
screen.addPreference(deduppref)
screen.addPreference(pageMethod)
}
override fun setupPreferenceScreen(screen: PreferenceScreen) {
@ -445,14 +473,34 @@ class LectorManga : ConfigurableSource, ParsedHttpSource() {
preferences.edit().putString(DEDUP_PREF, entry).commit()
}
}
val pageMethod = ListPreference(screen.context).apply {
key = PAGEGET_PREF_Title
title = PAGEGET_PREF_Title
entries = arrayOf("Cascada", "Paginada")
entryValues = arrayOf("cascade", "paginated")
summary = "%s"
setOnPreferenceChangeListener { _, newValue ->
val selected = newValue as String
val index = this.findIndexOfValue(selected)
val entry = entryValues.get(index) as String
preferences.edit().putString(PAGEGET_PREF, entry).commit()
}
}
screen.addPreference(deduppref)
screen.addPreference(pageMethod)
}
private fun getduppref() = preferences.getString(DEDUP_PREF, "all")
private fun getPageMethod() = preferences.getString(PAGEGET_PREF, "cascade")
companion object {
private const val DEDUP_PREF_Title = "Chapter List Scanlator Preference"
private const val DEDUP_PREF = "deduppref"
private const val PAGEGET_PREF_Title = "Método para obtener imágenes"
private const val PAGEGET_PREF = "pagemethodpref"
}
}

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: TuMangaOnline'
pkgNameSuffix = 'es.tumangaonline'
extClass = '.TuMangaOnline'
extVersionCode = 21
extVersionCode = 22
libVersion = '1.2'
}

View File

@ -72,7 +72,7 @@ class TuMangaOnline : ConfigurableSource, ParsedHttpSource() {
override fun latestUpdatesSelector() = "div.upload-file-row"
//override fun latestUpdatesSelector() = popularMangaSelector()
override fun popularMangaRequest(page: Int) = GET("$baseUrl/library?order_item=likes_count&order_dir=desc&type=&filter_by=title&page=$page", headers)
override fun popularMangaRequest(page: Int) = GET("$baseUrl/library?order_item=likes_count&order_dir=desc&filter_by=title&_title=search&page=$page", headers)
//override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/library?order_item=creation&order_dir=desc&type=&filter_by=title&page=$page", headers)
override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/latest_uploads?page=$page&uploads_mode=thumbnail", headers)
@ -134,6 +134,7 @@ class TuMangaOnline : ConfigurableSource, ParsedHttpSource() {
url.addQueryParameter("title", query)
url.addQueryParameter("page", page.toString())
url.addQueryParameter("_title", "search")
filters.forEach { filter ->
when (filter) {