Skip to content

Commit

Permalink
Convert FlixScans to multisrc (#17902)
Browse files Browse the repository at this point in the history
* Convert FlixScans to multisrc and move GalaxyManga to it

* add MangaNoon as well

* space in name
  • Loading branch information
AwkwardPeak7 authored Sep 12, 2023
1 parent 0154639 commit b24426f
Show file tree
Hide file tree
Showing 29 changed files with 69 additions and 55 deletions.
11 changes: 11 additions & 0 deletions .run/FlixScansGenerator.run.xml
Original file line number Diff line number Diff line change
@@ -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>
File renamed without changes
5 changes: 5 additions & 0 deletions multisrc/overrides/flixscans/flixscans/src/FlixScansNet.kt
Original file line number Diff line number Diff line change
@@ -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/")
7 changes: 7 additions & 0 deletions multisrc/overrides/flixscans/galaxymanga/src/GalaxyManga.kt
Original file line number Diff line number Diff line change
@@ -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
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 0 additions & 18 deletions multisrc/overrides/mangathemesia/galaxymanga/src/GalaxyManga.kt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}
Expand All @@ -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)
Expand Down Expand Up @@ -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>> {
Expand Down Expand Up @@ -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/"
}
}
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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 }
}
}

Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -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()
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.extension.en.flixscans
package eu.kanade.tachiyomi.multisrc.flixscans

import eu.kanade.tachiyomi.source.model.Filter

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
)

Expand Down
2 changes: 0 additions & 2 deletions src/en/flixscans/AndroidManifest.xml

This file was deleted.

12 changes: 0 additions & 12 deletions src/en/flixscans/build.gradle

This file was deleted.

0 comments on commit b24426f

Please sign in to comment.