Update Kotlin, coroutines, kolinter (#4363)
* Update kolinter, address some build warnings * Update to Kotlin 1.4.10, coroutines 1.3.9
This commit is contained in:
@ -4,6 +4,10 @@ import android.annotation.SuppressLint
|
||||
import android.annotation.TargetApi
|
||||
import android.os.Build
|
||||
import com.google.gson.Gson
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import org.jsoup.Jsoup
|
||||
import org.jsoup.nodes.Document
|
||||
import java.io.File
|
||||
import java.io.PrintWriter
|
||||
import java.security.cert.CertificateException
|
||||
@ -13,10 +17,6 @@ import java.util.concurrent.TimeUnit
|
||||
import javax.net.ssl.SSLContext
|
||||
import javax.net.ssl.TrustManager
|
||||
import javax.net.ssl.X509TrustManager
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import org.jsoup.Jsoup
|
||||
import org.jsoup.nodes.Document
|
||||
|
||||
/**
|
||||
* This class generates the sources for MMRCMS.
|
||||
@ -195,21 +195,23 @@ class Generator {
|
||||
|
||||
@Throws(Exception::class)
|
||||
private fun getOkHttpClient(): OkHttpClient {
|
||||
val trustAllCerts = arrayOf<TrustManager>(object : X509TrustManager {
|
||||
@SuppressLint("TrustAllX509TrustManager")
|
||||
@Throws(CertificateException::class)
|
||||
override fun checkClientTrusted(chain: Array<java.security.cert.X509Certificate>, authType: String) {
|
||||
}
|
||||
val trustAllCerts = arrayOf<TrustManager>(
|
||||
object : X509TrustManager {
|
||||
@SuppressLint("TrustAllX509TrustManager")
|
||||
@Throws(CertificateException::class)
|
||||
override fun checkClientTrusted(chain: Array<java.security.cert.X509Certificate>, authType: String) {
|
||||
}
|
||||
|
||||
@SuppressLint("TrustAllX509TrustManager")
|
||||
@Throws(CertificateException::class)
|
||||
override fun checkServerTrusted(chain: Array<java.security.cert.X509Certificate>, authType: String) {
|
||||
}
|
||||
@SuppressLint("TrustAllX509TrustManager")
|
||||
@Throws(CertificateException::class)
|
||||
override fun checkServerTrusted(chain: Array<java.security.cert.X509Certificate>, authType: String) {
|
||||
}
|
||||
|
||||
override fun getAcceptedIssuers(): Array<java.security.cert.X509Certificate> {
|
||||
return arrayOf()
|
||||
override fun getAcceptedIssuers(): Array<java.security.cert.X509Certificate> {
|
||||
return arrayOf()
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
// Install the all-trusting trust manager
|
||||
|
||||
@ -272,61 +274,62 @@ class Generator {
|
||||
SourceData("fr", "Op-VF", "https://www.op-vf.com"),
|
||||
SourceData("fr", "FR Scan", "https://www.frscan.me"),
|
||||
// NOTE: THIS SOURCE CONTAINS A CUSTOM LANGUAGE SYSTEM (which will be ignored)!
|
||||
SourceData("other", "HentaiShark", "https://www.hentaishark.com", true))
|
||||
// Changed CMS
|
||||
// SourceData("en", "MangaTreat Scans", "http://www.mangatreat.com"),
|
||||
// SourceData("en", "Chibi Manga Reader", "https://www.cmreader.info"),
|
||||
// SourceData("tr", "Epikmanga", "https://www.epikmanga.com"),
|
||||
// SourceData("en", "Hatigarm Scans", "https://hatigarmscans.net"),
|
||||
// Went offline
|
||||
// SourceData("en", "Mangawww Reader", "https://mangawww.club"),
|
||||
// SourceData("ru", "Anigai clan", "http://anigai.ru"),
|
||||
// SourceData("en", "ZXComic", "http://zxcomic.com"),
|
||||
// SourceData("es", "SOS Scanlation", "https://sosscanlation.com"),
|
||||
// SourceData("es", "MangaCasa", "https://mangacasa.com"))
|
||||
// SourceData("ja", "RAW MANGA READER", "https://rawmanga.site"),
|
||||
// SourceData("ar", "Manga FYI", "http://mangafyi.com/manga/arabic"),
|
||||
// SourceData("en", "MangaRoot", "http://mangaroot.com"),
|
||||
// SourceData("en", "MangaForLife", "http://manga4ever.com"),
|
||||
// SourceData("en", "Manga Spoil", "http://mangaspoil.com"),
|
||||
// SourceData("en", "MangaBlue", "http://mangablue.com"),
|
||||
// SourceData("en", "Manga Forest", "https://mangaforest.com"),
|
||||
// SourceData("en", "DManga", "http://dmanga.website"),
|
||||
// SourceData("en", "DB Manga", "http://dbmanga.com"),
|
||||
// SourceData("en", "Mangacox", "http://mangacox.com"),
|
||||
// SourceData("en", "GO Manhwa", "http://gomanhwa.xyz"),
|
||||
// SourceData("en", "KoManga", "https://komanga.net"),
|
||||
// SourceData("en", "Manganimecan", "http://manganimecan.com"),
|
||||
// SourceData("en", "Hentai2Manga", "http://hentai2manga.com"),
|
||||
// SourceData("en", "4 Manga", "http://4-manga.com"),
|
||||
// SourceData("en", "XYXX.INFO", "http://xyxx.info"),
|
||||
// SourceData("en", "Isekai Manga Reader", "https://isekaimanga.club"),
|
||||
// SourceData("fa", "TrinityReader", "http://trinityreader.pw"),
|
||||
// SourceData("fr", "Manga-LEL", "https://www.manga-lel.com"),
|
||||
// SourceData("fr", "Manga Etonnia", "https://www.etonnia.com"),
|
||||
// SourceData("fr", "ScanFR.com"), "http://scanfr.com"),
|
||||
// SourceData("fr", "Manga FYI", "http://mangafyi.com/manga/french"),
|
||||
// SourceData("fr", "scans-manga", "http://scans-manga.com"),
|
||||
// SourceData("fr", "Henka no Kaze", "http://henkanokazelel.esy.es/upload"),
|
||||
// SourceData("fr", "Tous Vos Scans", "http://www.tous-vos-scans.com"),
|
||||
// SourceData("id", "Manga Desu", "http://mangadesu.net"),
|
||||
// SourceData("id", "Komik Mangafire.ID", "http://go.mangafire.id"),
|
||||
// SourceData("id", "MangaOnline", "https://mangaonline.web.id"),
|
||||
// SourceData("id", "MangaNesia", "https://manganesia.com"),
|
||||
// SourceData("id", "MangaID", "https://mangaid.me"
|
||||
// SourceData("id", "Manga Seru", "http://www.mangaseru.top"
|
||||
// SourceData("id", "Manga FYI", "http://mangafyi.com/manga/indonesian"
|
||||
// SourceData("id", "Bacamangaku", "http://www.bacamangaku.com"),
|
||||
// SourceData("id", "Indo Manga Reader", "http://indomangareader.com"),
|
||||
// SourceData("it", "Kingdom Italia Reader", "http://kireader.altervista.org"),
|
||||
// SourceData("ja", "IchigoBook", "http://ichigobook.com"),
|
||||
// SourceData("ja", "Mangaraw Online", "http://mangaraw.online"
|
||||
// SourceData("ja", "Mangazuki RAWS", "https://raws.mangazuki.co"),
|
||||
// SourceData("ja", "MangaRAW", "https://www.mgraw.com"),
|
||||
// SourceData("ja", "マンガ/漫画 マガジン/雑誌 raw", "http://netabare-manga-raw.com"),
|
||||
// SourceData("ru", "NAKAMA", "http://nakama.ru"),
|
||||
// SourceData("tr", "MangAoi", "http://mangaoi.com"),
|
||||
// SourceData("tr", "ManhuaTR", "http://www.manhua-tr.com"),
|
||||
SourceData("other", "HentaiShark", "https://www.hentaishark.com", true)
|
||||
)
|
||||
// Changed CMS
|
||||
// SourceData("en", "MangaTreat Scans", "http://www.mangatreat.com"),
|
||||
// SourceData("en", "Chibi Manga Reader", "https://www.cmreader.info"),
|
||||
// SourceData("tr", "Epikmanga", "https://www.epikmanga.com"),
|
||||
// SourceData("en", "Hatigarm Scans", "https://hatigarmscans.net"),
|
||||
// Went offline
|
||||
// SourceData("en", "Mangawww Reader", "https://mangawww.club"),
|
||||
// SourceData("ru", "Anigai clan", "http://anigai.ru"),
|
||||
// SourceData("en", "ZXComic", "http://zxcomic.com"),
|
||||
// SourceData("es", "SOS Scanlation", "https://sosscanlation.com"),
|
||||
// SourceData("es", "MangaCasa", "https://mangacasa.com"))
|
||||
// SourceData("ja", "RAW MANGA READER", "https://rawmanga.site"),
|
||||
// SourceData("ar", "Manga FYI", "http://mangafyi.com/manga/arabic"),
|
||||
// SourceData("en", "MangaRoot", "http://mangaroot.com"),
|
||||
// SourceData("en", "MangaForLife", "http://manga4ever.com"),
|
||||
// SourceData("en", "Manga Spoil", "http://mangaspoil.com"),
|
||||
// SourceData("en", "MangaBlue", "http://mangablue.com"),
|
||||
// SourceData("en", "Manga Forest", "https://mangaforest.com"),
|
||||
// SourceData("en", "DManga", "http://dmanga.website"),
|
||||
// SourceData("en", "DB Manga", "http://dbmanga.com"),
|
||||
// SourceData("en", "Mangacox", "http://mangacox.com"),
|
||||
// SourceData("en", "GO Manhwa", "http://gomanhwa.xyz"),
|
||||
// SourceData("en", "KoManga", "https://komanga.net"),
|
||||
// SourceData("en", "Manganimecan", "http://manganimecan.com"),
|
||||
// SourceData("en", "Hentai2Manga", "http://hentai2manga.com"),
|
||||
// SourceData("en", "4 Manga", "http://4-manga.com"),
|
||||
// SourceData("en", "XYXX.INFO", "http://xyxx.info"),
|
||||
// SourceData("en", "Isekai Manga Reader", "https://isekaimanga.club"),
|
||||
// SourceData("fa", "TrinityReader", "http://trinityreader.pw"),
|
||||
// SourceData("fr", "Manga-LEL", "https://www.manga-lel.com"),
|
||||
// SourceData("fr", "Manga Etonnia", "https://www.etonnia.com"),
|
||||
// SourceData("fr", "ScanFR.com"), "http://scanfr.com"),
|
||||
// SourceData("fr", "Manga FYI", "http://mangafyi.com/manga/french"),
|
||||
// SourceData("fr", "scans-manga", "http://scans-manga.com"),
|
||||
// SourceData("fr", "Henka no Kaze", "http://henkanokazelel.esy.es/upload"),
|
||||
// SourceData("fr", "Tous Vos Scans", "http://www.tous-vos-scans.com"),
|
||||
// SourceData("id", "Manga Desu", "http://mangadesu.net"),
|
||||
// SourceData("id", "Komik Mangafire.ID", "http://go.mangafire.id"),
|
||||
// SourceData("id", "MangaOnline", "https://mangaonline.web.id"),
|
||||
// SourceData("id", "MangaNesia", "https://manganesia.com"),
|
||||
// SourceData("id", "MangaID", "https://mangaid.me"
|
||||
// SourceData("id", "Manga Seru", "http://www.mangaseru.top"
|
||||
// SourceData("id", "Manga FYI", "http://mangafyi.com/manga/indonesian"
|
||||
// SourceData("id", "Bacamangaku", "http://www.bacamangaku.com"),
|
||||
// SourceData("id", "Indo Manga Reader", "http://indomangareader.com"),
|
||||
// SourceData("it", "Kingdom Italia Reader", "http://kireader.altervista.org"),
|
||||
// SourceData("ja", "IchigoBook", "http://ichigobook.com"),
|
||||
// SourceData("ja", "Mangaraw Online", "http://mangaraw.online"
|
||||
// SourceData("ja", "Mangazuki RAWS", "https://raws.mangazuki.co"),
|
||||
// SourceData("ja", "MangaRAW", "https://www.mgraw.com"),
|
||||
// SourceData("ja", "マンガ/漫画 マガジン/雑誌 raw", "http://netabare-manga-raw.com"),
|
||||
// SourceData("ru", "NAKAMA", "http://nakama.ru"),
|
||||
// SourceData("tr", "MangAoi", "http://mangaoi.com"),
|
||||
// SourceData("tr", "ManhuaTR", "http://www.manhua-tr.com"),
|
||||
|
||||
val relativePath = System.getProperty("user.dir") + "/src/all/mmrcms/src/eu/kanade/tachiyomi/extension/all/mmrcms/GeneratedSources.kt"
|
||||
|
||||
|
@ -18,16 +18,16 @@ import eu.kanade.tachiyomi.source.model.SChapter
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.source.online.HttpSource
|
||||
import eu.kanade.tachiyomi.util.asJsoup
|
||||
import java.net.URLDecoder
|
||||
import java.text.ParseException
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Locale
|
||||
import java.util.concurrent.TimeUnit
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import okhttp3.Response
|
||||
import org.jsoup.nodes.Element
|
||||
import rx.Observable
|
||||
import java.net.URLDecoder
|
||||
import java.text.ParseException
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Locale
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
open class MyMangaReaderCMSSource(
|
||||
final override val lang: String,
|
||||
@ -114,17 +114,20 @@ open class MyMangaReaderCMSSource(
|
||||
val jsonArray = jsonParser.parse(response.body()!!.string()).let {
|
||||
if (name == "Mangas.pw") it.array else it["suggestions"].array
|
||||
}
|
||||
MangasPage(jsonArray
|
||||
.map {
|
||||
SManga.create().apply {
|
||||
val segment = it["data"].string
|
||||
url = getUrlWithoutBaseUrl(itemUrl + segment)
|
||||
title = it["value"].string
|
||||
MangasPage(
|
||||
jsonArray
|
||||
.map {
|
||||
SManga.create().apply {
|
||||
val segment = it["data"].string
|
||||
url = getUrlWithoutBaseUrl(itemUrl + segment)
|
||||
title = it["value"].string
|
||||
|
||||
// Guess thumbnails
|
||||
// thumbnail_url = "$baseUrl/uploads/manga/$segment/cover/cover_250x350.jpg"
|
||||
}
|
||||
}, false)
|
||||
// Guess thumbnails
|
||||
// thumbnail_url = "$baseUrl/uploads/manga/$segment/cover/cover_250x350.jpg"
|
||||
}
|
||||
},
|
||||
false
|
||||
)
|
||||
} else {
|
||||
internalMangaParse(response)
|
||||
}
|
||||
@ -184,27 +187,30 @@ open class MyMangaReaderCMSSource(
|
||||
"Utsukushii" -> "div.content div.col-sm-6"
|
||||
else -> "div[class^=col-sm], div.col-xs-6"
|
||||
}
|
||||
return MangasPage(document.select(internalMangaSelector).map {
|
||||
SManga.create().apply {
|
||||
val urlElement = it.getElementsByClass("chart-title")
|
||||
if (urlElement.size == 0) {
|
||||
url = getUrlWithoutBaseUrl(it.select("a").attr("href"))
|
||||
title = it.select("div.caption").text()
|
||||
it.select("div.caption div").text().let { if (it.isNotEmpty()) title = title.substringBefore(it) } // To clean submanga's titles without breaking hentaishark's
|
||||
} else {
|
||||
url = getUrlWithoutBaseUrl(urlElement.attr("href"))
|
||||
title = urlElement.text().trim()
|
||||
}
|
||||
return MangasPage(
|
||||
document.select(internalMangaSelector).map {
|
||||
SManga.create().apply {
|
||||
val urlElement = it.getElementsByClass("chart-title")
|
||||
if (urlElement.size == 0) {
|
||||
url = getUrlWithoutBaseUrl(it.select("a").attr("href"))
|
||||
title = it.select("div.caption").text()
|
||||
it.select("div.caption div").text().let { if (it.isNotEmpty()) title = title.substringBefore(it) } // To clean submanga's titles without breaking hentaishark's
|
||||
} else {
|
||||
url = getUrlWithoutBaseUrl(urlElement.attr("href"))
|
||||
title = urlElement.text().trim()
|
||||
}
|
||||
|
||||
it.select("img").let { img ->
|
||||
thumbnail_url = when {
|
||||
it.hasAttr("data-background-image") -> it.attr("data-background-image") // Utsukushii
|
||||
img.hasAttr("data-src") -> coverGuess(img.attr("abs:data-src"), url)
|
||||
else -> coverGuess(img.attr("abs:src"), url)
|
||||
it.select("img").let { img ->
|
||||
thumbnail_url = when {
|
||||
it.hasAttr("data-background-image") -> it.attr("data-background-image") // Utsukushii
|
||||
img.hasAttr("data-src") -> coverGuess(img.attr("abs:data-src"), url)
|
||||
else -> coverGuess(img.attr("abs:src"), url)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, document.select(".pagination a[rel=next]").isNotEmpty())
|
||||
},
|
||||
document.select(".pagination a[rel=next]").isNotEmpty()
|
||||
)
|
||||
}
|
||||
|
||||
// Guess thumbnails on broken websites
|
||||
@ -364,39 +370,43 @@ open class MyMangaReaderCMSSource(
|
||||
}
|
||||
|
||||
override fun pageListParse(response: Response) = response.asJsoup().select("#all > .img-responsive")
|
||||
.mapIndexed { i, e ->
|
||||
var url = (if (e.hasAttr("data-src")) e.attr("abs:data-src") else e.attr("abs:src")).trim()
|
||||
.mapIndexed { i, e ->
|
||||
var url = (if (e.hasAttr("data-src")) e.attr("abs:data-src") else e.attr("abs:src")).trim()
|
||||
|
||||
// Mangas.pw encodes some of their urls, decode them
|
||||
if (name.contains("Mangas.pw") && !url.contains(".")) {
|
||||
url = Base64.decode(url.substringAfter("//"), Base64.DEFAULT).toString(Charsets.UTF_8).substringBefore("=")
|
||||
url = URLDecoder.decode(url, "UTF-8")
|
||||
}
|
||||
|
||||
Page(i, "", url)
|
||||
// Mangas.pw encodes some of their urls, decode them
|
||||
if (name.contains("Mangas.pw") && !url.contains(".")) {
|
||||
url = Base64.decode(url.substringAfter("//"), Base64.DEFAULT).toString(Charsets.UTF_8).substringBefore("=")
|
||||
url = URLDecoder.decode(url, "UTF-8")
|
||||
}
|
||||
|
||||
Page(i, "", url)
|
||||
}
|
||||
|
||||
override fun imageUrlParse(response: Response) = throw UnsupportedOperationException("Unused method called!")
|
||||
|
||||
private fun getInitialFilterList() = listOf<Filter<*>>(
|
||||
Filter.Header("NOTE: Ignored if using text search!"),
|
||||
Filter.Separator(),
|
||||
AuthorFilter(),
|
||||
UriSelectFilter("Category",
|
||||
"cat",
|
||||
arrayOf("" to "Any",
|
||||
*categoryMappings.toTypedArray()
|
||||
)
|
||||
),
|
||||
UriSelectFilter("Begins with",
|
||||
"alpha",
|
||||
arrayOf("" to "Any",
|
||||
*"#ABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray().map {
|
||||
Pair(it.toString(), it.toString())
|
||||
}.toTypedArray()
|
||||
)
|
||||
),
|
||||
SortFilter()
|
||||
Filter.Header("NOTE: Ignored if using text search!"),
|
||||
Filter.Separator(),
|
||||
AuthorFilter(),
|
||||
UriSelectFilter(
|
||||
"Category",
|
||||
"cat",
|
||||
arrayOf(
|
||||
"" to "Any",
|
||||
*categoryMappings.toTypedArray()
|
||||
)
|
||||
),
|
||||
UriSelectFilter(
|
||||
"Begins with",
|
||||
"alpha",
|
||||
arrayOf(
|
||||
"" to "Any",
|
||||
*"#ABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray().map {
|
||||
Pair(it.toString(), it.toString())
|
||||
}.toTypedArray()
|
||||
)
|
||||
),
|
||||
SortFilter()
|
||||
)
|
||||
|
||||
/**
|
||||
@ -406,11 +416,16 @@ open class MyMangaReaderCMSSource(
|
||||
return when {
|
||||
name == "Mangas.pw" -> FilterList()
|
||||
tagMappings != null -> {
|
||||
FilterList(getInitialFilterList() + UriSelectFilter("Tag",
|
||||
"tag",
|
||||
arrayOf("" to "Any",
|
||||
*tagMappings.toTypedArray()
|
||||
)))
|
||||
FilterList(
|
||||
getInitialFilterList() + UriSelectFilter(
|
||||
"Tag",
|
||||
"tag",
|
||||
arrayOf(
|
||||
"" to "Any",
|
||||
*tagMappings.toTypedArray()
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
else -> FilterList(getInitialFilterList())
|
||||
}
|
||||
@ -429,7 +444,7 @@ open class MyMangaReaderCMSSource(
|
||||
private val firstIsUnspecified: Boolean = true,
|
||||
defaultValue: Int = 0
|
||||
) :
|
||||
Filter.Select<String>(displayName, vals.map { it.second }.toTypedArray(), defaultValue), UriFilter {
|
||||
Filter.Select<String>(displayName, vals.map { it.second }.toTypedArray(), defaultValue), UriFilter {
|
||||
override fun addToUri(uri: Uri.Builder) {
|
||||
if (state != 0 || !firstIsUnspecified)
|
||||
uri.appendQueryParameter(uriParam, vals[state].first)
|
||||
@ -442,9 +457,13 @@ open class MyMangaReaderCMSSource(
|
||||
}
|
||||
}
|
||||
|
||||
class SortFilter : Filter.Sort("Sort",
|
||||
class SortFilter :
|
||||
Filter.Sort(
|
||||
"Sort",
|
||||
sortables.map { it.second }.toTypedArray(),
|
||||
Selection(0, true)), UriFilter {
|
||||
Selection(0, true)
|
||||
),
|
||||
UriFilter {
|
||||
override fun addToUri(uri: Uri.Builder) {
|
||||
uri.appendQueryParameter("sortBy", sortables[state!!.index].first)
|
||||
uri.appendQueryParameter("asc", state!!.ascending.toString())
|
||||
@ -452,9 +471,9 @@ open class MyMangaReaderCMSSource(
|
||||
|
||||
companion object {
|
||||
private val sortables = arrayOf(
|
||||
"name" to "Name",
|
||||
"views" to "Popularity",
|
||||
"last_release" to "Last update"
|
||||
"name" to "Name",
|
||||
"views" to "Popularity",
|
||||
"last_release" to "Last update"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user