Luscious conversion to multisrc (#6384)

* Create Luscious.kt

* Added icons and Factorys for multilang

* Create LusciousGenerator.kt

* Deleted singel source
This commit is contained in:
Johannes Joens 2021-04-02 04:11:06 +13:00 committed by GitHub
parent a942bdc87a
commit 5e5cdf9418
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 152 additions and 49 deletions

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 78 KiB

View File

@ -0,0 +1,32 @@
package eu.kanade.tachiyomi.extension.all.luscious
import eu.kanade.tachiyomi.multisrc.luscious.Luscious
import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.source.SourceFactory
class LusciousFactory : SourceFactory {
override fun createSources(): List<Source> = listOf(
LusciousEN(),
LusciousJA(),
LusciousES(),
LusciousIT(),
LusciousDE(),
LusciousFR(),
LusciousZH(),
LusciousKO(),
LusciousOTHER(),
LusciousPT(),
LusciousTH(),
)
}
class LusciousEN : Luscious("Luscious", "https://www.luscious.net", "en")
class LusciousJA : Luscious("Luscious", "https://www.luscious.net", "ja")
class LusciousES : Luscious("Luscious", "https://www.luscious.net", "es")
class LusciousIT : Luscious("Luscious", "https://www.luscious.net", "it")
class LusciousDE : Luscious("Luscious", "https://www.luscious.net", "de")
class LusciousFR : Luscious("Luscious", "https://www.luscious.net", "fr")
class LusciousZH : Luscious("Luscious", "https://www.luscious.net", "zh")
class LusciousKO : Luscious("Luscious", "https://www.luscious.net", "ko")
class LusciousOTHER : Luscious("Luscious", "https://www.luscious.net", "other")
class LusciousPT : Luscious("Luscious", "https://www.luscious.net", "pt")
class LusciousTH : Luscious("Luscious", "https://www.luscious.net", "th")

View File

@ -0,0 +1,32 @@
package eu.kanade.tachiyomi.extension.all.lusciousapi
import eu.kanade.tachiyomi.multisrc.luscious.Luscious
import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.source.SourceFactory
class LusciousAPIFactory : SourceFactory {
override fun createSources(): List<Source> = listOf(
LusciousAPIEN(),
LusciousAPIJA(),
LusciousAPIES(),
LusciousAPIIT(),
LusciousAPIDE(),
LusciousAPIFR(),
LusciousAPIZH(),
LusciousAPIKO(),
LusciousAPIOTHER(),
LusciousAPIPT(),
LusciousAPITH(),
)
}
class LusciousAPIEN : Luscious("Luscious (API)", "https://api.luscious.net", "en")
class LusciousAPIJA : Luscious("Luscious (API)", "https://api.luscious.net", "ja")
class LusciousAPIES : Luscious("Luscious (API)", "https://api.luscious.net", "es")
class LusciousAPIIT : Luscious("Luscious (API)", "https://api.luscious.net", "it")
class LusciousAPIDE : Luscious("Luscious (API)", "https://api.luscious.net", "de")
class LusciousAPIFR : Luscious("Luscious (API)", "https://api.luscious.net", "fr")
class LusciousAPIZH : Luscious("Luscious (API)", "https://api.luscious.net", "zh")
class LusciousAPIKO : Luscious("Luscious (API)", "https://api.luscious.net", "ko")
class LusciousAPIOTHER : Luscious("Luscious (API)", "https://api.luscious.net", "other")
class LusciousAPIPT : Luscious("Luscious (API)", "https://api.luscious.net", "pt")
class LusciousAPITH : Luscious("Luscious (API)", "https://api.luscious.net", "th")

View File

@ -0,0 +1,32 @@
package eu.kanade.tachiyomi.extension.all.lusciousmembers
import eu.kanade.tachiyomi.multisrc.luscious.Luscious
import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.source.SourceFactory
class LusciousMembersFactory : SourceFactory {
override fun createSources(): List<Source> = listOf(
LusciousMembersEN(),
LusciousMembersJA(),
LusciousMembersES(),
LusciousMembersIT(),
LusciousMembersDE(),
LusciousMembersFR(),
LusciousMembersZH(),
LusciousMembersKO(),
LusciousMembersOTHER(),
LusciousMembersPT(),
LusciousMembersTH(),
)
}
class LusciousMembersEN : Luscious("Luscious (Members)", "https://members.luscious.net", "en")
class LusciousMembersJA : Luscious("Luscious (Members)", "https://members.luscious.net", "ja")
class LusciousMembersES : Luscious("Luscious (Members)", "https://members.luscious.net", "es")
class LusciousMembersIT : Luscious("Luscious (Members)", "https://members.luscious.net", "it")
class LusciousMembersDE : Luscious("Luscious (Members)", "https://members.luscious.net", "de")
class LusciousMembersFR : Luscious("Luscious (Members)", "https://members.luscious.net", "fr")
class LusciousMembersZH : Luscious("Luscious (Members)", "https://members.luscious.net", "zh")
class LusciousMembersKO : Luscious("Luscious (Members)", "https://members.luscious.net", "ko")
class LusciousMembersOTHER : Luscious("Luscious (Members)", "https://members.luscious.net", "other")
class LusciousMembersPT : Luscious("Luscious (Members)", "https://members.luscious.net", "pt")
class LusciousMembersTH : Luscious("Luscious (Members)", "https://members.luscious.net", "th")

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.extension.all.luscious
package eu.kanade.tachiyomi.multisrc.luscious
import com.github.salomonbrys.kotson.addProperty
import com.github.salomonbrys.kotson.fromJson
@ -28,17 +28,35 @@ import java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale
class Luscious(override val lang: String, private val lusLang: String) : HttpSource() {
abstract class Luscious(
override val name: String,
override val baseUrl: String,
override val lang: String ) : HttpSource() {
//Based on Luscios single source extension form https://github.com/tachiyomiorg/tachiyomi-extensions/commit/aacf56d0c0ddb173372aac69d798ae998f178377
//with modifiaction to make it support multisrc
override val baseUrl: String = "https://www.luscious.net"
override val name: String = "Luscious"
override val supportsLatest: Boolean = true
private val apiBaseUrl: String = "https://api.luscious.net/graphql/nobatch/"
private val apiBaseUrl: String = "$baseUrl/graphql/nobatch/"
private val gson = Gson()
override val client: OkHttpClient = network.cloudflareClient
private val lusLang: String = lusLang(lang)
private fun lusLang(lang: String): String {
return when (lang) {
"en" -> "1"
"ja" -> "2"
"es" -> "3"
"it" -> "4"
"de" -> "5"
"fr" -> "6"
"zh" -> "8"
"ko" -> "9"
"pt" -> "100"
"th" -> "101"
else -> "99"
}
}
// Common
@ -273,7 +291,7 @@ class Luscious(override val lang: String, private val lusLang: String) : HttpSou
val document = response.asJsoup()
return SManga.create().apply {
artist = document.select(".o-tag--category:contains(Artist:) .o-tag")?.joinToString() { it.text() }
artist = document.select(".o-tag--category:contains(Artist:) .o-tag")?.joinToString { it.text() }
author = artist
genre = parseMangaGenre(document)
@ -387,7 +405,7 @@ class Luscious(override val lang: String, private val lusLang: String) : HttpSou
SelectFilterOption("Date - Upcoming", "date_upcoming"),
SelectFilterOption("Date - Trending", "date_trending"),
SelectFilterOption("Date - Featured", "date_featured"),
SelectFilterOption("Date - Last Viewed", "date_last_interaction"),
SelectFilterOption("Date - Last Viewed", "date_last_interaction")
)
fun getAlbumTypeFilters() = listOf(

View File

@ -0,0 +1,27 @@
package eu.kanade.tachiyomi.multisrc.luscious
import generator.ThemeSourceData.MultiLang
import generator.ThemeSourceData.SingleLang
import generator.ThemeSourceGenerator
class LusciousGenerator : ThemeSourceGenerator {
override val themePkg = "luscious"
override val themeClass = "Luscious"
override val baseVersionCode: Int = 1
override val sources = listOf(
MultiLang("Luscious", "https://www.luscious.net", listOf("en","ja", "es", "it", "de", "fr", "zh", "ko", "other", "pt", "th"), isNsfw = true, className = "LusciousFactory", overrideVersionCode = 2),
MultiLang("Luscious (Members)", "https://members.luscious.net", listOf("en","ja", "es", "it", "de", "fr", "zh", "ko", "other", "pt", "th"), isNsfw = true, className = "LusciousMembersFactory", pkgName = "lusciousmembers"),//Requires Account
MultiLang("Luscious (API)", "https://api.luscious.net", listOf("en","ja", "es", "it", "de", "fr", "zh", "ko", "other", "pt", "th"), isNsfw = true, className = "LusciousAPIFactory", pkgName = "lusciousapi")
)
companion object {
@JvmStatic
fun main(args: Array<String>) {
LusciousGenerator().createAll()
}
}
}

View File

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="eu.kanade.tachiyomi.extension" />

View File

@ -1,13 +0,0 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
ext {
extName = 'Luscious'
pkgNameSuffix = 'all.luscious'
extClass = '.LusciousFactory'
extVersionCode = 2
libVersion = '1.2'
containsNsfw = true
}
apply from: "$rootDir/common.gradle"

View File

@ -1,23 +0,0 @@
package eu.kanade.tachiyomi.extension.all.luscious
import eu.kanade.tachiyomi.annotations.Nsfw
import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.source.SourceFactory
@Nsfw
class LusciousFactory : SourceFactory {
override fun createSources(): List<Source> = listOf(
Luscious("en", Luscious.ENGLISH_LUS_LANG_VAL),
Luscious("ja", Luscious.JAPANESE_LUS_LANG_VAL),
Luscious("es", Luscious.SPANISH_LUS_LANG_VAL),
Luscious("it", Luscious.ITALIAN_LUS_LANG_VAL),
Luscious("de", Luscious.GERMAN_LUS_LANG_VAL),
Luscious("fr", Luscious.FRENCH_LUS_LANG_VAL),
Luscious("zh", Luscious.CHINESE_LUS_LANG_VAL),
Luscious("ko", Luscious.KOREAN_LUS_LANG_VAL),
Luscious("other", Luscious.OTHERS_LUS_LANG_VAL),
Luscious("pt", Luscious.PORTUGESE_LUS_LANG_VAL),
Luscious("th", Luscious.THAI_LUS_LANG_VAL)
)
}