diff --git a/multisrc/overrides/madara/olympusscantop/res/mipmap-hdpi/ic_launcher.png b/multisrc/overrides/madara/olympusscantop/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index 39a0a3916..000000000 Binary files a/multisrc/overrides/madara/olympusscantop/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/multisrc/overrides/madara/olympusscantop/res/mipmap-mdpi/ic_launcher.png b/multisrc/overrides/madara/olympusscantop/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index 406b15de9..000000000 Binary files a/multisrc/overrides/madara/olympusscantop/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/multisrc/overrides/madara/olympusscantop/res/mipmap-xhdpi/ic_launcher.png b/multisrc/overrides/madara/olympusscantop/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index f265a804e..000000000 Binary files a/multisrc/overrides/madara/olympusscantop/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/multisrc/overrides/madara/olympusscantop/res/mipmap-xxhdpi/ic_launcher.png b/multisrc/overrides/madara/olympusscantop/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index 06f0efddb..000000000 Binary files a/multisrc/overrides/madara/olympusscantop/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/multisrc/overrides/madara/olympusscantop/res/mipmap-xxxhdpi/ic_launcher.png b/multisrc/overrides/madara/olympusscantop/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index fd7b1081c..000000000 Binary files a/multisrc/overrides/madara/olympusscantop/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/multisrc/overrides/madara/olympusscantop/res/web_hi_res_512.png b/multisrc/overrides/madara/olympusscantop/res/web_hi_res_512.png deleted file mode 100644 index 248e9e9da..000000000 Binary files a/multisrc/overrides/madara/olympusscantop/res/web_hi_res_512.png and /dev/null differ diff --git a/multisrc/overrides/madara/olympusscantop/src/OlympusScanTop.kt b/multisrc/overrides/madara/olympusscantop/src/OlympusScanTop.kt deleted file mode 100644 index 345d6de58..000000000 --- a/multisrc/overrides/madara/olympusscantop/src/OlympusScanTop.kt +++ /dev/null @@ -1,14 +0,0 @@ -package eu.kanade.tachiyomi.extension.es.olympusscantop - -import eu.kanade.tachiyomi.multisrc.madara.Madara -import java.text.SimpleDateFormat -import java.util.Locale - -class OlympusScanTop : Madara( - "OlympusScan.top", - "https://olympusscan.top", - "es", - dateFormat = SimpleDateFormat("MMM d, yyy", Locale("es")), -) { - override val useNewChapterEndpoint = true -} diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt index 4b0d84512..bb48b1bd4 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt @@ -332,7 +332,6 @@ class MadaraGenerator : ThemeSourceGenerator { SingleLang("NovelMic", "https://novelmic.com", "en", overrideVersionCode = 1), SingleLang("Novels Town", "https://novelstown.cyou", "ar"), SingleLang("Oh No Manga", "https://ohnomanga.com", "en", isNsfw = true), - SingleLang("OlympusScan.top", "https://olympusscan.top", "es", className = "OlympusScanTop"), SingleLang("Painful Nightz Scan", "https://painfulnightz.com", "en", overrideVersionCode = 1), SingleLang("Petrotechsociety", "https://www.petrotechsociety.org", "en", isNsfw = true), SingleLang("Pian Manga", "https://pianmanga.me", "en", isNsfw = true, overrideVersionCode = 1), diff --git a/src/es/leercapitulo/build.gradle b/src/es/leercapitulo/build.gradle index 281245bb2..fc4f5fa88 100644 --- a/src/es/leercapitulo/build.gradle +++ b/src/es/leercapitulo/build.gradle @@ -3,10 +3,10 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlinx-serialization' ext { - extName = 'LeerCapitulo' + extName = 'LeerCapitulo / OlympusScan.top' pkgNameSuffix = 'es.leercapitulo' extClass = '.LeerCapitulo' - extVersionCode = 1 + extVersionCode = 2 } apply from: "$rootDir/common.gradle" \ No newline at end of file diff --git a/src/es/leercapitulo/src/eu/kanade/tachiyomi/extension/es/leercapitulo/LeerCapitulo.kt b/src/es/leercapitulo/src/eu/kanade/tachiyomi/extension/es/leercapitulo/LeerCapitulo.kt index f9653cfe4..879a4cf62 100644 --- a/src/es/leercapitulo/src/eu/kanade/tachiyomi/extension/es/leercapitulo/LeerCapitulo.kt +++ b/src/es/leercapitulo/src/eu/kanade/tachiyomi/extension/es/leercapitulo/LeerCapitulo.kt @@ -1,7 +1,11 @@ package eu.kanade.tachiyomi.extension.es.leercapitulo +import android.app.Application +import androidx.preference.ListPreference +import androidx.preference.PreferenceScreen import eu.kanade.tachiyomi.extension.es.leercapitulo.dto.MangaDto import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.source.ConfigurableSource import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.MangasPage import eu.kanade.tachiyomi.source.model.Page @@ -15,19 +19,39 @@ import okhttp3.Request import okhttp3.Response import org.jsoup.nodes.Document import org.jsoup.nodes.Element +import uy.kohesive.injekt.Injekt +import uy.kohesive.injekt.api.get import uy.kohesive.injekt.injectLazy +import kotlin.random.Random -open class LeerCapitulo : ParsedHttpSource() { +class LeerCapitulo : ParsedHttpSource(), ConfigurableSource { override val name = "LeerCapitulo" - override val baseUrl = "https://www.leercapitulo.com" - override val lang = "es" override val supportsLatest = true private val json: Json by injectLazy() + private val isCi = System.getenv("CI") == "true" + + override val baseUrl + get() = when { + isCi -> MIRRORS.joinToString("#, ") + else -> _baseUrl + } + + private val _baseUrl = run { + val preferences = Injekt.get().getSharedPreferences("source_$id", 0x0000) + val mirrors = MIRRORS + var index = preferences.getString(MIRROR_PREF, "-1")!!.toInt() + if (index !in mirrors.indices) { + index = Random.nextInt(0, mirrors.size) + preferences.edit().putString(MIRROR_PREF, index.toString()).apply() + } + mirrors[index] + } + // Popular override fun popularMangaRequest(page: Int): Request = GET(baseUrl, headers) @@ -125,7 +149,7 @@ open class LeerCapitulo : ParsedHttpSource() { override fun pageListParse(document: Document): List { val urls = document.selectFirst("#arraydata")!!.text().split(',') return urls.mapIndexed { i, image_url -> - Page(i, "", image_url) + Page(i, imageUrl = image_url.replace("https://cdn.statically.io/img/", "https://")) // just redirects } } @@ -134,8 +158,27 @@ open class LeerCapitulo : ParsedHttpSource() { // Other private fun String.toStatus() = when (this) { - "Publicándose" -> SManga.ONGOING - "Pausado", "FINALIZADO", "CANCELADO" -> SManga.COMPLETED + "Ongoing" -> SManga.ONGOING + "Paused" -> SManga.ON_HIATUS + "Completed" -> SManga.COMPLETED + "Cancelled" -> SManga.CANCELLED else -> SManga.UNKNOWN } + + override fun setupPreferenceScreen(screen: PreferenceScreen) { + ListPreference(screen.context).apply { + val mirrors = MIRRORS + + key = MIRROR_PREF + title = "Mirror" + summary = "%s\nRequires restart to take effect" + entries = mirrors + entryValues = Array(mirrors.size, Int::toString) + }.let(screen::addPreference) + } + + companion object { + private const val MIRROR_PREF = "MIRROR" + private val MIRRORS get() = arrayOf("https://www.leercapitulo.com", "https://olympusscan.top") + } }