Convert FlixScans to multisrc (#17902)

* Convert FlixScans to multisrc and move GalaxyManga to it

* add MangaNoon as well

* space in name
This commit is contained in:
AwkwardPeak7 2023-09-12 07:43:59 +05:00 committed by GitHub
parent 0154639645
commit b24426f5b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 69 additions and 55 deletions

View File

@ -0,0 +1,11 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="FlixScansGenerator" type="JetRunConfigurationType" nameIsGenerated="true">
<module name="tachiyomi-extensions.multisrc.main" />
<option name="MAIN_CLASS_NAME" value="eu.kanade.tachiyomi.multisrc.flixscans.FlixScansGenerator" />
<method v="2">
<option name="Make" enabled="true" />
<option name="Gradle.BeforeRunTask" enabled="true" tasks="ktFormat" externalProjectPath="$PROJECT_DIR$/multisrc" vmOptions="" scriptParameters="-Ptheme=flixscans" />
<option name="Gradle.BeforeRunTask" enabled="true" tasks="ktLint" externalProjectPath="$PROJECT_DIR$/multisrc" vmOptions="" scriptParameters="-Ptheme=flixscans" />
</method>
</configuration>
</component>

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

View File

@ -0,0 +1,5 @@
package eu.kanade.tachiyomi.extension.en.flixscans
import eu.kanade.tachiyomi.multisrc.flixscans.FlixScans
class FlixScansNet : FlixScans("Flix Scans", "https://flixscans.net", "en", cdnUrl = "https://media.flixscans.net/")

View File

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 120 KiB

View File

@ -0,0 +1,7 @@
package eu.kanade.tachiyomi.extension.ar.galaxymanga
import eu.kanade.tachiyomi.multisrc.flixscans.FlixScans
class GalaxyManga : FlixScans("جالاكسي مانجا", "https://flixscans.com", "ar") {
override val versionId = 2
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 KiB

View File

@ -1,18 +0,0 @@
package eu.kanade.tachiyomi.extension.ar.galaxymanga
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
import java.text.SimpleDateFormat
import java.util.Locale
class GalaxyManga : MangaThemesia(
"جالاكسي مانجا",
"https://galaxymanga.org",
"ar",
dateFormat = SimpleDateFormat("MMMM dd, yyyy", Locale("ar")),
) {
override val seriesArtistSelector = ".infotable tr:contains(الرسام) td:last-child, ${super.seriesArtistSelector}"
override val seriesAuthorSelector = ".infotable tr:contains(المؤلف) td:last-child, ${super.seriesAuthorSelector}"
override val seriesStatusSelector = ".infotable tr:contains(الحالة) td:last-child, ${super.seriesStatusSelector}"
override val seriesTypeSelector = ".infotable tr:contains(النوع) td:last-child, ${super.seriesTypeSelector}"
override val seriesAltNameSelector = ".infotable tr:contains(الأسماء الثانوية) td:last-child, ${super.seriesAltNameSelector}"
}

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.extension.en.flixscans
package eu.kanade.tachiyomi.multisrc.flixscans
import android.util.Log
import eu.kanade.tachiyomi.network.GET
@ -26,19 +26,17 @@ import okhttp3.Response
import rx.Observable
import uy.kohesive.injekt.injectLazy
class FlixScans : HttpSource() {
override val name = "Flix Scans"
override val lang = "en"
override val baseUrl = "https://flixscans.net"
private val apiUrl = "https://api.flixscans.net/api/v1"
abstract class FlixScans(
override val name: String,
override val baseUrl: String,
override val lang: String,
protected val apiUrl: String = baseUrl.replace("://", "://api.").plus("/api/v1"),
protected val cdnUrl: String = baseUrl.replace("://", "://api.").plus("/storage/"),
) : HttpSource() {
override val supportsLatest = true
private val json: Json by injectLazy()
protected open val json: Json by injectLazy()
override val client = network.cloudflareClient.newBuilder()
.rateLimit(2)
@ -67,7 +65,7 @@ class FlixScans : HttpSource() {
val entries = (result.hot + result.topAll + result.topMonth + result.topWeek)
.distinctBy { it.id }
.map(BrowseSeries::toSManga)
.map { it.toSManga(cdnUrl) }
return MangasPage(entries, false)
}
@ -87,7 +85,7 @@ class FlixScans : HttpSource() {
val currentPage = response.request.url.queryParameter("page")
?.toIntOrNull() ?: 1
val entries = result.data.map(BrowseSeries::toSManga)
val entries = result.data.map { it.toSManga(cdnUrl) }
val hasNextPage = result.meta.lastPage > currentPage
return MangasPage(entries, hasNextPage)
@ -239,7 +237,7 @@ class FlixScans : HttpSource() {
override fun mangaDetailsParse(response: Response): SManga {
val result = response.parseAs<SeriesResponse>()
return result.serie.toSManga()
return result.serie.toSManga(cdnUrl)
}
override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> {
@ -312,6 +310,5 @@ class FlixScans : HttpSource() {
companion object {
private val JSON_MEDIA_TYPE = "application/json; charset=utf-8".toMediaTypeOrNull()
const val cdnUrl = "https://media.flixscans.net/"
}
}

View File

@ -1,9 +1,10 @@
package eu.kanade.tachiyomi.extension.en.flixscans
package eu.kanade.tachiyomi.multisrc.flixscans
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import org.jsoup.Jsoup
import java.text.SimpleDateFormat
import java.util.Locale
@ -34,10 +35,10 @@ data class BrowseSeries(
val prefix: Int,
val thumbnail: String?,
) {
fun toSManga() = SManga.create().apply {
fun toSManga(cdnUrl: String) = SManga.create().apply {
title = this@BrowseSeries.title
url = "/series/$prefix-$id-$slug"
thumbnail_url = thumbnail?.let { FlixScans.cdnUrl + it }
thumbnail_url = thumbnail?.let { cdnUrl + it }
}
}
@ -74,15 +75,15 @@ data class Series(
val artists: List<GenreHolder>? = emptyList(),
val genres: List<GenreHolder>? = emptyList(),
) {
fun toSManga() = SManga.create().apply {
fun toSManga(cdnUrl: String) = SManga.create().apply {
title = this@Series.title
url = "/series/$prefix-$id-$slug"
thumbnail_url = FlixScans.cdnUrl + thumbnail
thumbnail_url = cdnUrl + thumbnail
author = authors?.joinToString { it.name.trim() }
artist = artists?.joinToString { it.name.trim() }
genre = (otherGenres + genres?.map { it.name.trim() }.orEmpty())
.distinct().joinToString { it.trim() }
description = story
description = story?.let { Jsoup.parse(it).text() }
if (otherNames?.isNotEmpty() == true) {
if (description.isNullOrEmpty()) {
description = "Alternative Names:\n"

View File

@ -0,0 +1,26 @@
package eu.kanade.tachiyomi.multisrc.flixscans
import generator.ThemeSourceData.SingleLang
import generator.ThemeSourceGenerator
class FlixScansGenerator : ThemeSourceGenerator {
override val themePkg = "flixscans"
override val themeClass = "FlixScans"
override val baseVersionCode: Int = 2
override val sources = listOf(
SingleLang("Flix Scans", "https://flixscans.net", "en", className = "FlixScansNet", pkgName = "flixscans"),
SingleLang("جالاكسي مانجا", "https://flixscans.com", "ar", className = "GalaxyManga", overrideVersionCode = 25),
SingleLang("مانجا نون", "https://manjanoon.com", "ar", className = "MangaNoon"),
)
companion object {
@JvmStatic
fun main(args: Array<String>) {
FlixScansGenerator().createAll()
}
}
}

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.extension.en.flixscans
package eu.kanade.tachiyomi.multisrc.flixscans
import eu.kanade.tachiyomi.source.model.Filter

View File

@ -141,7 +141,6 @@ class MangaThemesiaGenerator : ThemeSourceGenerator {
SingleLang("Zahard", "https://zahard.xyz", "en"),
SingleLang("สดใสเมะ", "https://www.xn--l3c0azab5a2gta.com", "th", isNsfw = true, className = "Sodsaime", overrideVersionCode = 1),
SingleLang("أريا مانجا", "https://www.areascans.net", "ar", className = "AreaManga"),
SingleLang("جالاكسي مانجا", "https://galaxymanga.org", "ar", className = "GalaxyManga"),
SingleLang("فيكس مانجا", "https://vexmanga.net", "ar", className = "VexManga"),
)

View File

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View File

@ -1,12 +0,0 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlinx-serialization'
ext {
extName = 'Flix Scans'
pkgNameSuffix = 'en.flixscans'
extClass = '.FlixScans'
extVersionCode = 1
}
apply from: "$rootDir/common.gradle"