ReaderFront: add Scylla Scans (#9750)
This commit is contained in:
parent
65a2d4eeb0
commit
4cd3753393
|
@ -9,7 +9,7 @@ class RavensScansFactory : SourceFactory {
|
||||||
RavensScans("en", 2)
|
RavensScans("en", 2)
|
||||||
)
|
)
|
||||||
|
|
||||||
class RavensScans(override val lang: String, override val langId: Int) :
|
class RavensScans(override val lang: String, override val langId: Int) :
|
||||||
ReaderFront("Ravens Scans", "https://ravens-scans.com/", lang, langId) {
|
ReaderFront("Ravens Scans", "https://ravens-scans.com/", lang, langId) {
|
||||||
override fun getImageCDN(path: String, width: Int) =
|
override fun getImageCDN(path: String, width: Int) =
|
||||||
"https://i${(0..2).random()}.wp.com/img-cdn1.ravens-scans.com" +
|
"https://i${(0..2).random()}.wp.com/img-cdn1.ravens-scans.com" +
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 8.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
Binary file not shown.
After Width: | Height: | Size: 43 KiB |
Binary file not shown.
After Width: | Height: | Size: 234 KiB |
|
@ -0,0 +1,9 @@
|
||||||
|
package eu.kanade.tachiyomi.extension.en.scyllascans
|
||||||
|
|
||||||
|
import eu.kanade.tachiyomi.multisrc.readerfront.ReaderFront
|
||||||
|
|
||||||
|
class ScyllaScans : ReaderFront("Scylla Scans", "https://scyllascans.org/", "en", 2) {
|
||||||
|
override fun getImageCDN(path: String, width: Int) =
|
||||||
|
"https://i${(0..2).random()}.wp.com/api.scyllascans.org" +
|
||||||
|
"$path?strip=all&quality=100&w=$width"
|
||||||
|
}
|
|
@ -16,7 +16,6 @@ import kotlinx.serialization.json.jsonObject
|
||||||
import kotlinx.serialization.json.jsonPrimitive
|
import kotlinx.serialization.json.jsonPrimitive
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
import java.util.Locale
|
|
||||||
|
|
||||||
abstract class ReaderFront(
|
abstract class ReaderFront(
|
||||||
override val name: String,
|
override val name: String,
|
||||||
|
@ -73,7 +72,7 @@ abstract class ReaderFront(
|
||||||
append(it.demographic_name!!)
|
append(it.demographic_name!!)
|
||||||
if (it.genres!!.isNotEmpty()) {
|
if (it.genres!!.isNotEmpty()) {
|
||||||
append(", ")
|
append(", ")
|
||||||
it.genres.joinTo(this, transform = ::capitalize)
|
it.genres.joinTo(this) { it.genre }
|
||||||
}
|
}
|
||||||
append(", ")
|
append(", ")
|
||||||
append(it.type!!)
|
append(it.type!!)
|
||||||
|
@ -117,9 +116,6 @@ abstract class ReaderFront(
|
||||||
}
|
}
|
||||||
}!!
|
}!!
|
||||||
|
|
||||||
private fun capitalize(name: Name) =
|
|
||||||
name.split('_').joinToString(" ") { it.capitalize(Locale(lang)) }
|
|
||||||
|
|
||||||
private inline fun <reified T> Response.parse(name: String) =
|
private inline fun <reified T> Response.parse(name: String) =
|
||||||
json.parseToJsonElement(body!!.string()).jsonObject.run {
|
json.parseToJsonElement(body!!.string()).jsonObject.run {
|
||||||
if (containsKey("errors")) {
|
if (containsKey("errors")) {
|
||||||
|
|
|
@ -84,6 +84,9 @@ data class People(val role: Int, private val people: Name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class Name(private val name: String) : CharSequence by name {
|
data class Name(private val name: String) {
|
||||||
|
val genre: String // TODO: replace with a localized genre map
|
||||||
|
get() = name.split('_').joinToString(" ") { it.capitalize(Locale.ROOT) }
|
||||||
|
|
||||||
override fun toString() = name
|
override fun toString() = name
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package eu.kanade.tachiyomi.multisrc.readerfront
|
package eu.kanade.tachiyomi.multisrc.readerfront
|
||||||
|
|
||||||
import generator.ThemeSourceData.MultiLang
|
import generator.ThemeSourceData.MultiLang
|
||||||
|
import generator.ThemeSourceData.SingleLang
|
||||||
import generator.ThemeSourceGenerator
|
import generator.ThemeSourceGenerator
|
||||||
|
|
||||||
class ReaderFrontGenerator : ThemeSourceGenerator {
|
class ReaderFrontGenerator : ThemeSourceGenerator {
|
||||||
|
@ -12,6 +13,7 @@ class ReaderFrontGenerator : ThemeSourceGenerator {
|
||||||
|
|
||||||
override val sources = listOf(
|
override val sources = listOf(
|
||||||
MultiLang("Ravens Scans", "https://ravens-scans.com/", listOf("es", "en"), true),
|
MultiLang("Ravens Scans", "https://ravens-scans.com/", listOf("es", "en"), true),
|
||||||
|
SingleLang("Scylla Scans", "https://scyllascans.org/", "en"),
|
||||||
)
|
)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
Loading…
Reference in New Issue