[skip ci] Remove unnecessary annotations, run linter (#11299)

This commit is contained in:
arkon 2022-04-01 17:03:36 -04:00 committed by GitHub
parent 9313a6d9b7
commit d347c2ca2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 9 additions and 49 deletions

View File

@ -102,11 +102,10 @@ open class Genkan(
description = document.select("div.col-lg-9").text().substringAfter("Description ").substringBefore(" Volume")
thumbnail_url = styleToUrl(document.select("div.media a").first())
genre = listOfNotNull(
document.selectFirst(countryOfOriginSelector)?.let { countryOfOriginToSeriesType(it.text())}
document.selectFirst(countryOfOriginSelector)?.let { countryOfOriginToSeriesType(it.text()) }
).joinToString()
}
override fun chapterListSelector() = "div.col-lg-9 div.flex"
override fun chapterFromElement(element: Element): SChapter {

View File

@ -16,8 +16,10 @@ class GuyaGenerator : ThemeSourceGenerator {
SingleLang("Guya", "https://guya.moe", "en", overrideVersionCode = 18),
SingleLang("Danke fürs Lesen", "https://danke.moe", "en", className = "DankeFursLesen"),
SingleLang("Hachirumi", "https://hachirumi.com", "en", isNsfw = true),
MultiLang("Magical Translators", "https://mahoushoujobu.com", listOf("en", "es", "pl"),
overrideVersionCode = 1),
MultiLang(
"Magical Translators", "https://mahoushoujobu.com", listOf("en", "es", "pl"),
overrideVersionCode = 1
),
)
companion object {
@JvmStatic

View File

@ -21,7 +21,6 @@ import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.buildJsonObject
import kotlinx.serialization.json.int
import kotlinx.serialization.json.jsonArray
import kotlinx.serialization.json.jsonNull
import kotlinx.serialization.json.jsonObject
import kotlinx.serialization.json.jsonPrimitive
import kotlinx.serialization.json.put
@ -84,7 +83,7 @@ abstract class HentaiHand(
.addQueryParameter("sort", "popularity")
.addQueryParameter("order", "desc")
.addQueryParameter("duration", "all")
hhLangId.forEachIndexed() {index, it ->
hhLangId.forEachIndexed() { index, it ->
url.addQueryParameter("languages[${-index - 1}]", it.toString())
}
// if (altLangId != null) url.addQueryParameter("languages", altLangId.toString())
@ -101,7 +100,7 @@ abstract class HentaiHand(
.addQueryParameter("sort", "uploaded_at")
.addQueryParameter("order", "desc")
.addQueryParameter("duration", "all")
hhLangId.forEachIndexed() {index, it ->
hhLangId.forEachIndexed() { index, it ->
url.addQueryParameter("languages[${-index - 1}]", it.toString())
}
return GET(url.toString())
@ -132,7 +131,7 @@ abstract class HentaiHand(
.addQueryParameter("page", page.toString())
.addQueryParameter("q", query)
hhLangId.forEachIndexed() {index, it ->
hhLangId.forEachIndexed() { index, it ->
url.addQueryParameter("languages[${-index - 1}]", it.toString())
}
@ -150,7 +149,7 @@ abstract class HentaiHand(
is LookupFilter -> {
filter.state.split(",").map { it.trim() }.filter { it.isNotBlank() }.map {
lookupFilterId(it, filter.uri) ?: throw Exception("No ${filter.singularName} \"$it\" was found")
}.forEachIndexed() {index, it ->
}.forEachIndexed() { index, it ->
if (!(filter.uri == "languages" && hhLangId.contains(it)))
url.addQueryParameter(filter.uri + "[$index]", it.toString())
}
@ -192,8 +191,6 @@ abstract class HentaiHand(
else -> SManga.COMPLETED
}
description = listOf(
Pair("Alternative Title", obj["alternative_title"]!!.jsonPrimitive.content),
Pair("Groups", jsonArrayToString("groups", obj)),

View File

@ -8,7 +8,6 @@ import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.online.HttpSource
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json
import okhttp3.Headers
@ -16,7 +15,6 @@ import okhttp3.Response
import rx.Observable
import uy.kohesive.injekt.injectLazy
@ExperimentalSerializationApi
open class MonochromeCMS(
override val name: String,
override val baseUrl: String,

View File

@ -10,7 +10,6 @@ import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.online.HttpSource
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.builtins.ListSerializer
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json
@ -27,7 +26,6 @@ import okhttp3.Response
import rx.Observable
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import java.lang.UnsupportedOperationException
const val SEARCH_PAGE_LIMIT = 100
@ -37,7 +35,6 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S
private val apiBase = "https://api.comick.fun"
override val supportsLatest = true
@ExperimentalSerializationApi
private val json: Json by lazy {
Json(from = Injekt.get()) {
serializersModule = SerializersModule {
@ -47,7 +44,6 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S
}
}
@ExperimentalSerializationApi
private val mangaIdCache = SMangaDeserializer.mangaIdCache
final override fun headersBuilder() = Headers.Builder().apply {
@ -90,7 +86,6 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S
/** Utils **/
/** Returns an observable which emits a single value -> the manga's id **/
@ExperimentalSerializationApi
private fun chapterId(manga: SManga): Observable<Int> {
val mangaSlug = slug(manga)
return mangaIdCache[mangaSlug]?.let { Observable.just(it) }
@ -105,13 +100,11 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S
/** Popular Manga **/
@ExperimentalSerializationApi
override fun fetchPopularManga(page: Int) = fetchSearchManga(page, "", FilterList(emptyList()))
override fun popularMangaRequest(page: Int) = throw UnsupportedOperationException("Not used")
override fun popularMangaParse(response: Response) = throw UnsupportedOperationException("Not used")
/** Latest Manga **/
@ExperimentalSerializationApi
override fun latestUpdatesParse(response: Response): MangasPage {
val noResults = MangasPage(emptyList(), false)
if (response.code == 204)
@ -129,7 +122,6 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S
return GET("$url", headers)
}
@ExperimentalSerializationApi
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
if (!query.startsWith(SLUG_SEARCH_PREFIX))
return super.fetchSearchManga(page, query, filters)
@ -157,7 +149,6 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S
return GET("$url", headers)
}
@ExperimentalSerializationApi
override fun searchMangaParse(response: Response) = json.decodeFromString<List<SManga>>(response.body!!.string())
.let { MangasPage(it, it.size == SEARCH_PAGE_LIMIT) }
@ -168,7 +159,6 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S
}
// Shenanigans to allow "open in webview" to show a webpage instead of JSON
@ExperimentalSerializationApi
override fun fetchMangaDetails(manga: SManga): Observable<SManga> {
return client.newCall(apiMangaDetailsRequest(manga))
.asObservableSuccess()
@ -177,7 +167,6 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S
}
}
@ExperimentalSerializationApi
override fun mangaDetailsParse(response: Response) = json.decodeFromString(
deserializer = jsonFlatten<SManga>(objKey = "comic", "id", "title", "desc", "status", "country", "slug"),
response.body!!.string()
@ -188,7 +177,6 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S
private fun chapterListRequest(page: Int, mangaId: Int) =
GET("$apiBase/comic/$mangaId/chapter?page=$page&limit=$SEARCH_PAGE_LIMIT", headers)
@ExperimentalSerializationApi
override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> {
return if (manga.status != SManga.LICENSED) {
chapterId(manga).concatMap { id ->
@ -213,7 +201,6 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S
}
}
@ExperimentalSerializationApi
override fun chapterListParse(response: Response) = json.decodeFromString(
deserializer = deepSelectDeserializer<List<SChapter>>("chapters"),
response.body!!.string()
@ -223,7 +210,6 @@ abstract class ComickFun(override val lang: String, private val comickFunLang: S
override fun pageListRequest(chapter: SChapter) = GET("$apiBase/chapter/${hid(chapter)}", headers, CacheControl.FORCE_NETWORK)
@ExperimentalSerializationApi
override fun pageListParse(response: Response) =
json.decodeFromString(
deserializer = deepSelectDeserializer<List<String>>("chapter", "images", tDeserializer = ListSerializer(deepSelectDeserializer("url"))),

View File

@ -4,7 +4,6 @@ import android.os.Build
import android.text.Html
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.KSerializer
import kotlinx.serialization.builtins.ListSerializer
import kotlinx.serialization.descriptors.SerialDescriptor
@ -20,7 +19,6 @@ import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.JsonTransformingSerializer
import kotlinx.serialization.json.buildJsonObject
import kotlinx.serialization.serializer
import java.lang.Exception
import java.text.SimpleDateFormat
import kotlin.math.pow
import kotlin.math.truncate
@ -40,7 +38,6 @@ import kotlin.math.truncate
*
* deepSelectDeserializer&lt;String&gt;("user", "name", "first") deserializes the above into "John"
*/
@ExperimentalSerializationApi
inline fun <reified T : Any> deepSelectDeserializer(vararg keys: String, tDeserializer: KSerializer<T> = serializer()): KSerializer<T> {
val descriptors = keys.foldRight(listOf(tDeserializer.descriptor)) { x, acc ->
acc + acc.last().let {
@ -89,7 +86,6 @@ inline fun <reified T : Any> jsonFlatten(
}
}
@ExperimentalSerializationApi
inline fun <T> Decoder.decodeStructureByKnownName(descriptor: SerialDescriptor, decodeFn: CompositeDecoder.(Sequence<Pair<String, Int>>) -> T): T {
return decodeStructure(descriptor) {
decodeFn(
@ -101,7 +97,6 @@ inline fun <T> Decoder.decodeStructureByKnownName(descriptor: SerialDescriptor,
}
}
@ExperimentalSerializationApi
class SChapterDeserializer : KSerializer<SChapter> {
override val descriptor = buildClassSerialDescriptor(SChapter::class.qualifiedName!!) {
element<String>("chap")
@ -144,7 +139,6 @@ class SChapterDeserializer : KSerializer<SChapter> {
return formattedTitle.toString()
}
@ExperimentalSerializationApi
override fun deserialize(decoder: Decoder): SChapter {
return SChapter.create().apply {
var chap: String? = null
@ -177,7 +171,6 @@ class SChapterDeserializer : KSerializer<SChapter> {
override fun serialize(encoder: Encoder, value: SChapter) = throw UnsupportedOperationException("Unsupported")
}
@ExperimentalSerializationApi
class SMangaDeserializer : KSerializer<SManga> {
private fun cleanDesc(s: String) = (
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
@ -204,7 +197,6 @@ class SMangaDeserializer : KSerializer<SManga> {
element<String>("country", isOptional = true)
}
@ExperimentalSerializationApi
override fun deserialize(decoder: Decoder): SManga {
return SManga.create().apply {
var id: Int? = null

View File

@ -1,9 +1,7 @@
package eu.kanade.tachiyomi.extension.all.leagueoflegends
import eu.kanade.tachiyomi.source.SourceFactory
import kotlinx.serialization.ExperimentalSerializationApi
@ExperimentalSerializationApi
class LOLFactory : SourceFactory {
override fun createSources() = listOf(
LOLUniverse("en_us"),

View File

@ -8,7 +8,6 @@ import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.online.HttpSource
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json
import okhttp3.Response
@ -17,7 +16,6 @@ import uy.kohesive.injekt.injectLazy
import java.text.SimpleDateFormat
import java.util.Locale
@ExperimentalSerializationApi
class LOLUniverse(
private val siteLang: String,
override val lang: String = siteLang.substring(0, 2)

View File

@ -13,7 +13,6 @@ import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.online.HttpSource
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json
import okhttp3.Response
@ -22,7 +21,6 @@ import uy.kohesive.injekt.api.get
import java.text.SimpleDateFormat
import java.util.Locale
@ExperimentalSerializationApi
open class SimplyHentai(override val lang: String) : ConfigurableSource, HttpSource() {
override val name = "Simply Hentai"

View File

@ -1,9 +1,7 @@
package eu.kanade.tachiyomi.extension.all.simplyhentai
import eu.kanade.tachiyomi.source.SourceFactory
import kotlinx.serialization.ExperimentalSerializationApi
@ExperimentalSerializationApi
class SimplyHentaiFactory : SourceFactory {
override fun createSources() = listOf(
SimplyHentai("en"),

View File

@ -6,7 +6,6 @@ ext {
pkgNameSuffix = 'all.thelibraryofohara'
extClass = '.TheLibraryOfOharaFactory'
extVersionCode = 1
libVersion = '1.2'
}
apply from: "$rootDir/common.gradle"

View File

@ -9,7 +9,6 @@ import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.online.HttpSource
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.decodeFromJsonElement
@ -19,7 +18,6 @@ import okhttp3.Request
import okhttp3.Response
import uy.kohesive.injekt.injectLazy
@ExperimentalSerializationApi
class Pururin : HttpSource() {
override val name = "Pururin"

View File

@ -9,13 +9,11 @@ import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.online.HttpSource
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json
import okhttp3.Response
import uy.kohesive.injekt.injectLazy
@ExperimentalSerializationApi
class ZinChanManga : HttpSource() {
override val lang = "en"

View File

@ -6,7 +6,6 @@ ext {
pkgNameSuffix = 'es.leermangasxyz'
extClass = '.LeerMangasXYZ'
extVersionCode = 1
libVersion = '1.2'
}
apply from: "$rootDir/common.gradle"