ReaderFront: add Scylla Scans (#9750)

This commit is contained in:
ObserverOfTime 2021-11-06 15:14:23 +02:00 committed by GitHub
parent 65a2d4eeb0
commit 4cd3753393
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 17 additions and 7 deletions

View File

@ -9,7 +9,7 @@ class RavensScansFactory : SourceFactory {
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) {
override fun getImageCDN(path: String, width: Int) =
"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

View File

@ -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"
}

View File

@ -16,7 +16,6 @@ import kotlinx.serialization.json.jsonObject
import kotlinx.serialization.json.jsonPrimitive
import okhttp3.Response
import uy.kohesive.injekt.injectLazy
import java.util.Locale
abstract class ReaderFront(
override val name: String,
@ -73,7 +72,7 @@ abstract class ReaderFront(
append(it.demographic_name!!)
if (it.genres!!.isNotEmpty()) {
append(", ")
it.genres.joinTo(this, transform = ::capitalize)
it.genres.joinTo(this) { it.genre }
}
append(", ")
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) =
json.parseToJsonElement(body!!.string()).jsonObject.run {
if (containsKey("errors")) {

View File

@ -84,6 +84,9 @@ data class People(val role: Int, private val people: Name) {
}
@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
}

View File

@ -1,6 +1,7 @@
package eu.kanade.tachiyomi.multisrc.readerfront
import generator.ThemeSourceData.MultiLang
import generator.ThemeSourceData.SingleLang
import generator.ThemeSourceGenerator
class ReaderFrontGenerator : ThemeSourceGenerator {
@ -12,6 +13,7 @@ class ReaderFrontGenerator : ThemeSourceGenerator {
override val sources = listOf(
MultiLang("Ravens Scans", "https://ravens-scans.com/", listOf("es", "en"), true),
SingleLang("Scylla Scans", "https://scyllascans.org/", "en"),
)
companion object {