Mmrcms split with revisions for #6742 (#6767)

* Add MMRCMS.kt

* Add Files

* Add files via upload

* Delete src/all/mmrcms directory

* Added icons
This commit is contained in:
Johannes Joens 2021-05-02 08:52:32 +12:00 committed by GitHub
parent 58d5923290
commit 9b00d811d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 343 additions and 327 deletions

View File

@ -0,0 +1,7 @@
package eu.kanade.tachiyomi.extension.pt.animaregia
import eu.kanade.tachiyomi.multisrc.mmrcms.MMRCMS
class AnimaRegia : MMRCMS("AnimaRegia", "https://animaregia.net", "pt-BR"){
override val id: Long = 4378659695320121364
}

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -0,0 +1,17 @@
package eu.kanade.tachiyomi.extension.bg.utsukushii
import eu.kanade.tachiyomi.multisrc.mmrcms.MMRCMS
import eu.kanade.tachiyomi.source.model.MangasPage
import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.util.asJsoup
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.Response
class Utsukushii : MMRCMS("Utsukushii", "https://manga.utsukushii-bg.com", "bg"){
override fun popularMangaRequest(page: Int): Request {
return GET("$baseUrl/manga-list", headers)
}
}

View File

@ -1,13 +1,11 @@
package eu.kanade.tachiyomi.extension.all.mmrcms package eu.kanade.tachiyomi.multisrc.mmrcms
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.net.Uri import android.net.Uri
import android.util.Base64
import com.github.salomonbrys.kotson.array import com.github.salomonbrys.kotson.array
import com.github.salomonbrys.kotson.get import com.github.salomonbrys.kotson.get
import com.github.salomonbrys.kotson.string import com.github.salomonbrys.kotson.string
import com.google.gson.JsonParser import com.google.gson.JsonParser
import eu.kanade.tachiyomi.annotations.Nsfw
import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.asObservableSuccess import eu.kanade.tachiyomi.network.asObservableSuccess
import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.Filter
@ -23,34 +21,92 @@ import okhttp3.Request
import okhttp3.Response import okhttp3.Response
import org.jsoup.nodes.Element import org.jsoup.nodes.Element
import rx.Observable import rx.Observable
import java.net.URLDecoder
import java.text.ParseException import java.text.ParseException
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Locale import java.util.Locale
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
import com.github.salomonbrys.kotson.array
import com.github.salomonbrys.kotson.bool
import com.github.salomonbrys.kotson.string
import com.google.gson.JsonArray
import com.google.gson.JsonObject
import android.util.Base64
import java.net.URLDecoder
open class MyMangaReaderCMSSource( abstract class MMRCMS (
final override val lang: String, override val name: String,
final override val name: String, override val baseUrl: String,
final override val baseUrl: String, override val lang: String,
final override val supportsLatest: Boolean, private val sourceInfo: String = "",
private val itemUrl: String,
private val categoryMappings: List<Pair<String, String>>,
private val tagMappings: List<Pair<String, String>>?
) : HttpSource() { ) : HttpSource() {
private val jsonParser = JsonParser() open val jsonData = if(sourceInfo == "") {
SourceData.giveMetaData(baseUrl)
} else{
sourceInfo
}
/**
* Parse a List of JSON sources into a list of `MyMangaReaderCMSSource`s
*
* Example JSON :
* ```
* {
* "language": "en",
* "name": "Example manga reader",
* "base_url": "https://example.com",
* "supports_latest": true,
* "item_url": "https://example.com/manga/",
* "categories": [
* {"id": "stuff", "name": "Stuff"},
* {"id": "test", "name": "Test"}
* ],
* "tags": [
* {"id": "action", "name": "Action"},
* {"id": "adventure", "name": "Adventure"}
* ]
* }
*
*
* Sources that do not supports tags may use `null` instead of a list of json objects
*
* @param sourceString The List of JSON strings 1 entry = one source
* @return The list of parsed sources
*
* isNSFW, language, name and base_url are no longer needed as that is handled by multisrc
* supports_latest, item_url, categories and tags are still needed
*
*
*/
open val jsonObject = JsonParser.parseString(jsonData) as JsonObject
override val supportsLatest = jsonObject["supports_latest"].bool
open val itemUrl = jsonObject["item_url"].string
open val categoryMappings = mapToPairs(jsonObject["categories"].array)
open var tagMappings = if (jsonObject["tags"].isJsonArray) {
mapToPairs(jsonObject["tags"].asJsonArray)
} else {
emptyList<Pair<String, String>>()
}
/**
* Map an array of JSON objects to pairs. Each JSON object must have
* the following properties:
*
* id: first item in pair
* name: second item in pair
*
* @param array The array to process
* @return The new list of pairs
*/
open fun mapToPairs(array: JsonArray): List<Pair<String, String>> = array.map {
it as JsonObject
it["id"].string to it["name"].string
}
private val itemUrlPath = Uri.parse(itemUrl).pathSegments.firstOrNull() private val itemUrlPath = Uri.parse(itemUrl).pathSegments.firstOrNull()
private val parsedBaseUrl = Uri.parse(baseUrl) private val parsedBaseUrl = Uri.parse(baseUrl)
/**
* Hardcode IDs for sources for which we altered name or lang
*/
override val id: Long = when (name) {
"Comic Space" -> 1847392744200215680
"Mangás Yuri" -> 6456162511058446409
"AnimaRegia" -> 4378659695320121364
else -> super.id
}
override val client: OkHttpClient = network.cloudflareClient.newBuilder() override val client: OkHttpClient = network.cloudflareClient.newBuilder()
.connectTimeout(1, TimeUnit.MINUTES) .connectTimeout(1, TimeUnit.MINUTES)
@ -59,10 +115,7 @@ open class MyMangaReaderCMSSource(
.build() .build()
override fun popularMangaRequest(page: Int): Request { override fun popularMangaRequest(page: Int): Request {
return when (name) { return GET("$baseUrl/filterList?page=$page&sortBy=views&asc=false", headers)
"Utsukushii" -> GET("$baseUrl/manga-list", headers)
else -> GET("$baseUrl/filterList?page=$page&sortBy=views&asc=false", headers)
}
} }
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
@ -111,7 +164,7 @@ open class MyMangaReaderCMSSource(
override fun searchMangaParse(response: Response): MangasPage { override fun searchMangaParse(response: Response): MangasPage {
return if (listOf("query", "q").any { it in response.request.url.queryParameterNames }) { return if (listOf("query", "q").any { it in response.request.url.queryParameterNames }) {
// If a search query was specified, use search instead! // If a search query was specified, use search instead!
val jsonArray = jsonParser.parse(response.body!!.string()).let { val jsonArray = JsonParser.parseString(response.body!!.string()).let {
if (name == "Mangas.pw") it.array else it["suggestions"].array if (name == "Mangas.pw") it.array else it["suggestions"].array
} }
MangasPage( MangasPage(
@ -214,7 +267,7 @@ open class MyMangaReaderCMSSource(
} }
// Guess thumbnails on broken websites // Guess thumbnails on broken websites
private fun coverGuess(url: String?, mangaUrl: String): String? { fun coverGuess(url: String?, mangaUrl: String): String? {
return if (url?.endsWith("no-image.png") == true) { return if (url?.endsWith("no-image.png") == true) {
"$baseUrl/uploads/manga/${mangaUrl.substringAfterLast('/')}/cover/cover_250x350.jpg" "$baseUrl/uploads/manga/${mangaUrl.substringAfterLast('/')}/cover/cover_250x350.jpg"
} else { } else {
@ -222,7 +275,7 @@ open class MyMangaReaderCMSSource(
} }
} }
private fun getUrlWithoutBaseUrl(newUrl: String): String { fun getUrlWithoutBaseUrl(newUrl: String): String {
val parsedNewUrl = Uri.parse(newUrl) val parsedNewUrl = Uri.parse(newUrl)
val newPathSegments = parsedNewUrl.pathSegments.toMutableList() val newPathSegments = parsedNewUrl.pathSegments.toMutableList()
@ -382,6 +435,7 @@ open class MyMangaReaderCMSSource(
Page(i, "", url) Page(i, "", url)
} }
override fun imageUrlParse(response: Response) = throw UnsupportedOperationException("Unused method called!") override fun imageUrlParse(response: Response) = throw UnsupportedOperationException("Unused method called!")
private fun getInitialFilterList() = listOf<Filter<*>>( private fun getInitialFilterList() = listOf<Filter<*>>(
@ -415,7 +469,7 @@ open class MyMangaReaderCMSSource(
override fun getFilterList(): FilterList { override fun getFilterList(): FilterList {
return when { return when {
name == "Mangas.pw" -> FilterList() name == "Mangas.pw" -> FilterList()
tagMappings != null -> { tagMappings != emptyList<Pair<String, String>>()-> {
FilterList( FilterList(
getInitialFilterList() + UriSelectFilter( getInitialFilterList() + UriSelectFilter(
"Tag", "Tag",
@ -489,22 +543,3 @@ open class MyMangaReaderCMSSource(
private val DATE_FORMAT = SimpleDateFormat("d MMM. yyyy", Locale.US) private val DATE_FORMAT = SimpleDateFormat("d MMM. yyyy", Locale.US)
} }
} }
@Nsfw
class MyMangaReaderCMSSourceNsfw(
lang: String,
name: String,
baseUrl: String,
supportsLatest: Boolean,
itemUrl: String,
categoryMappings: List<Pair<String, String>>,
tagMappings: List<Pair<String, String>>?
) : MyMangaReaderCMSSource(
lang,
name,
baseUrl,
supportsLatest,
itemUrl,
categoryMappings,
tagMappings
)

View File

@ -0,0 +1,26 @@
package eu.kanade.tachiyomi.multisrc.mmrcms
import generator.ThemeSourceData
import generator.ThemeSourceData.SingleLang
import generator.ThemeSourceGenerator
class MMRCMSGenerator : ThemeSourceGenerator {
override val themePkg = "mmrcms"
override val themeClass = "MMRCMS"
override val baseVersionCode: Int = MMRCMSSources.version
override val sources = MMRCMSSources.sourceList.map {
SingleLang(it.name, it.baseUrl, it.lang, it.isNsfw, it.className, it.pkgName, it.overrideVersionCode)
}
companion object {
@JvmStatic
fun main(args: Array<String>) {
MMRCMSGenerator().createAll()
}
}
}

View File

@ -1,9 +1,10 @@
package eu.kanade.tachiyomi.extension.all.mmrcms package eu.kanade.tachiyomi.multisrc.mmrcms
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.annotation.TargetApi import android.annotation.TargetApi
import android.os.Build import android.os.Build
import com.google.gson.Gson import com.google.gson.Gson
import eu.kanade.tachiyomi.multisrc.mmrcms.MMRCMSSources.Companion.sourceList
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.Request import okhttp3.Request
import org.jsoup.Jsoup import org.jsoup.Jsoup
@ -25,33 +26,32 @@ import javax.net.ssl.X509TrustManager
* CMS: https://getcyberworks.com/product/manga-reader-cms/ * CMS: https://getcyberworks.com/product/manga-reader-cms/
*/ */
class Generator { class MMRCMSJsonGen {
//private var preRunTotal: String
private var preRunTotal: String
init { init {
System.setProperty("https.protocols", "TLSv1,TLSv1.1,TLSv1.2,TLSv1.3") System.setProperty("https.protocols", "TLSv1,TLSv1.1,TLSv1.2,TLSv1.3")
preRunTotal = Regex("""MMRSOURCE_(\d+)""").findAll(File(relativePath).readText(Charsets.UTF_8)).last().groupValues[1] //preRunTotal = Regex("""-> (\d+)""").findAll(File(relativePath).readText(Charsets.UTF_8)).last().groupValues[1]
} }
data class SourceData(val lang: String, val name: String, val baseUrl: String, val isNsfw: Boolean = false)
@TargetApi(Build.VERSION_CODES.O) @TargetApi(Build.VERSION_CODES.O)
fun generate() { fun generate() {
val buffer = StringBuffer() val buffer = StringBuffer()
val dateTime = ZonedDateTime.now() val dateTime = ZonedDateTime.now()
val formattedDate = dateTime.format(DateTimeFormatter.RFC_1123_DATE_TIME) val formattedDate = dateTime.format(DateTimeFormatter.RFC_1123_DATE_TIME)
buffer.append("package eu.kanade.tachiyomi.extension.all.mmrcms") buffer.append("package eu.kanade.tachiyomi.multisrc.mmrcms")
buffer.append("\n\n// GENERATED FILE, DO NOT MODIFY!\n// Generated $formattedDate\n\n") buffer.append("\n\n// GENERATED FILE, DO NOT MODIFY!\n// Generated $formattedDate\n\n")
buffer.append("class SourceData() {\n")
buffer.append(" companion object {\n")
buffer.append(" fun giveMetaData(url:String): String{\n")
buffer.append(" return when (url) {\n")
var number = 1 var number = 1
sources.forEach { sources.forEach {
try { try {
val map = mutableMapOf<String, Any>() val map = mutableMapOf<String, Any>()
map["language"] = it.lang
map["name"] = it.name map["name"] = it.name
map["base_url"] = it.baseUrl map["base_url"] = it.baseUrl
map["supports_latest"] = supportsLatest(it.baseUrl) map["supports_latest"] = supportsLatest(it.baseUrl)
map["isNsfw"] = it.isNsfw
val advancedSearchDocument = getDocument("${it.baseUrl}/advanced-search", false) val advancedSearchDocument = getDocument("${it.baseUrl}/advanced-search", false)
@ -89,26 +89,19 @@ class Generator {
val toJson = Gson().toJson(map) val toJson = Gson().toJson(map)
buffer.append("private const val MMRSOURCE_$number = \"\"\"$toJson\"\"\"\n") buffer.append(" \"${it.baseUrl}\" -> \"\"\"$toJson\"\"\"\n")
number++ number++
} catch (e: Exception) { } catch (e: Exception) {
println("error generating source ${it.name} ${e.printStackTrace()}") println("error generating source ${it.name} ${e.printStackTrace()}")
} }
} }
buffer.append("val SOURCES: List<String> get() = listOf(") buffer.append(" else -> \"\"\n")
for (i in 1 until number) { buffer.append(" }\n")
buffer.append("MMRSOURCE_$i") buffer.append(" }\n")
when (i) { buffer.append(" }\n")
number - 1 -> { buffer.append("}\n")
buffer.append(")\n") //println("Pre-run sources: $preRunTotal")
}
else -> {
buffer.append(", ")
}
}
}
println("Pre-run sources: $preRunTotal")
println("Post-run sources: ${number - 1}") println("Post-run sources: ${number - 1}")
val writer = PrintWriter(relativePath) val writer = PrintWriter(relativePath)
writer.write(buffer.toString()) writer.write(buffer.toString())
@ -232,111 +225,13 @@ class Generator {
} }
companion object { companion object {
val sources = listOf( val sources = sourceList
SourceData("ar", "مانجا اون لاين", "https://onma.me"),
SourceData("en", "Read Comics Online", "https://readcomicsonline.ru"),
SourceData("en", "Fallen Angels", "https://manga.fascans.com"),
SourceData("en", "Zahard", "https://zahard.top"),
SourceData("en", "Manhwas Men", "https://manhwas.men"),
SourceData("fr", "Scan FR", "https://www.scan-fr.cc"),
SourceData("fr", "Scan VF", "https://www.scan-vf.net"),
SourceData("fr", "Scan OP", "https://scan-op.cc"),
SourceData("id", "Komikid", "https://www.komikid.com"),
SourceData("pt-BR", "Mangás Yuri", "https://mangasyuri.net"),
SourceData("pl", "Nikushima", "http://azbivo.webd.pro"),
SourceData("tr", "MangaHanta", "http://mangahanta.com"),
SourceData("vi", "Fallen Angels Scans", "https://truyen.fascans.com"),
SourceData("es", "LeoManga", "https://leomanga.me"),
SourceData("es", "submanga", "https://submanga.io"),
SourceData("es", "Mangadoor", "https://mangadoor.com"),
SourceData("es", "Mangas.pw", "https://mangas.in"),
SourceData("bg", "Utsukushii", "https://manga.utsukushii-bg.com"),
SourceData("pl", "Phoenix-Scans", "https://phoenix-scans.pl"),
SourceData("tr", "Puzzmos", "https://puzzmos.com"),
SourceData("fr", "Scan-1", "https://wwv.scan-1.com"),
SourceData("fr", "Lelscan-VF", "https://lelscan-vf.co"),
SourceData("id", "Komik Manga", "https://adm.komikmanga.com"),
SourceData("ko", "Mangazuki Raws", "https://raws.mangazuki.co"),
SourceData("en", "Mangazuki", "https://mangazuki.co/"),
SourceData("pt-BR", "Remangas", "https://remangas.top"),
SourceData("pt-BR", "AnimaRegia", "https://animaregia.net"),
SourceData("tr", "MangaVadisi", "http://manga-v2.mangavadisi.org"),
SourceData("id", "MangaID", "https://mangaid.click"),
SourceData("fr", "Jpmangas", "https://jpmangas.co"),
SourceData("fr", "Op-VF", "https://www.op-vf.com"),
SourceData("fr", "FR Scan", "https://www.frscan.me"),
// NOTE: THIS SOURCE CONTAINS A CUSTOM LANGUAGE SYSTEM (which will be ignored)!
SourceData("other", "HentaiShark", "https://www.hentaishark.com", true)
)
// Changed CMS
// SourceData("es", "Tumangaonline.co", "http://tumangaonline.com"),
// SourceData("id", "MangaYu", "https://mangayu.com"),
// SourceData("en", "MangaTreat Scans", "http://www.mangatreat.com"),
// SourceData("en", "Chibi Manga Reader", "https://www.cmreader.info"),
// SourceData("tr", "Epikmanga", "https://www.epikmanga.com"),
// SourceData("en", "Hatigarm Scans", "https://hatigarmscans.net"),
// Went offline
// SourceData("ru", "Japit Comics", "https://j-comics.ru"),
// SourceData("es", "Universo Yuri", "https://universoyuri.com"),
// SourceData("pl", "Dracaena", "https://dracaena.webd.pl/czytnik"),
// SourceData("pt-BR", "Comic Space", "https://www.comicspace.com.br"),
// SourceData("pl", "ToraScans", "http://torascans.pl"),
// SourceData("en", "White Cloud Pavilion", "https://www.whitecloudpavilion.com/manga/free"),
// SourceData("en", "Biamam Scans", "https://biamam.com"),
// SourceData("en", "Mangawww Reader", "https://mangawww.club"),
// SourceData("ru", "Anigai clan", "http://anigai.ru"),
// SourceData("en", "ZXComic", "http://zxcomic.com"),
// SourceData("es", "SOS Scanlation", "https://sosscanlation.com"),
// SourceData("es", "MangaCasa", "https://mangacasa.com"))
// SourceData("ja", "RAW MANGA READER", "https://rawmanga.site"),
// SourceData("ar", "Manga FYI", "http://mangafyi.com/manga/arabic"),
// SourceData("en", "MangaRoot", "http://mangaroot.com"),
// SourceData("en", "MangaForLife", "http://manga4ever.com"),
// SourceData("en", "Manga Spoil", "http://mangaspoil.com"),
// SourceData("en", "MangaBlue", "http://mangablue.com"),
// SourceData("en", "Manga Forest", "https://mangaforest.com"),
// SourceData("en", "DManga", "http://dmanga.website"),
// SourceData("en", "DB Manga", "http://dbmanga.com"),
// SourceData("en", "Mangacox", "http://mangacox.com"),
// SourceData("en", "GO Manhwa", "http://gomanhwa.xyz"),
// SourceData("en", "KoManga", "https://komanga.net"),
// SourceData("en", "Manganimecan", "http://manganimecan.com"),
// SourceData("en", "Hentai2Manga", "http://hentai2manga.com"),
// SourceData("en", "4 Manga", "http://4-manga.com"),
// SourceData("en", "XYXX.INFO", "http://xyxx.info"),
// SourceData("en", "Isekai Manga Reader", "https://isekaimanga.club"),
// SourceData("fa", "TrinityReader", "http://trinityreader.pw"),
// SourceData("fr", "Manga-LEL", "https://www.manga-lel.com"),
// SourceData("fr", "Manga Etonnia", "https://www.etonnia.com"),
// SourceData("fr", "ScanFR.com"), "http://scanfr.com"),
// SourceData("fr", "Manga FYI", "http://mangafyi.com/manga/french"),
// SourceData("fr", "scans-manga", "http://scans-manga.com"),
// SourceData("fr", "Henka no Kaze", "http://henkanokazelel.esy.es/upload"),
// SourceData("fr", "Tous Vos Scans", "http://www.tous-vos-scans.com"),
// SourceData("id", "Manga Desu", "http://mangadesu.net"),
// SourceData("id", "Komik Mangafire.ID", "http://go.mangafire.id"),
// SourceData("id", "MangaOnline", "https://mangaonline.web.id"),
// SourceData("id", "MangaNesia", "https://manganesia.com"),
// SourceData("id", "MangaID", "https://mangaid.me"
// SourceData("id", "Manga Seru", "http://www.mangaseru.top"
// SourceData("id", "Manga FYI", "http://mangafyi.com/manga/indonesian"
// SourceData("id", "Bacamangaku", "http://www.bacamangaku.com"),
// SourceData("id", "Indo Manga Reader", "http://indomangareader.com"),
// SourceData("it", "Kingdom Italia Reader", "http://kireader.altervista.org"),
// SourceData("ja", "IchigoBook", "http://ichigobook.com"),
// SourceData("ja", "Mangaraw Online", "http://mangaraw.online"
// SourceData("ja", "Mangazuki RAWS", "https://raws.mangazuki.co"),
// SourceData("ja", "MangaRAW", "https://www.mgraw.com"),
// SourceData("ja", "マンガ/漫画 マガジン/雑誌 raw", "http://netabare-manga-raw.com"),
// SourceData("ru", "NAKAMA", "http://nakama.ru"),
// SourceData("tr", "MangAoi", "http://mangaoi.com"),
// SourceData("tr", "ManhuaTR", "http://www.manhua-tr.com"),
val relativePath = System.getProperty("user.dir") + "/src/all/mmrcms/src/eu/kanade/tachiyomi/extension/all/mmrcms/GeneratedSources.kt" val relativePath = System.getProperty("user.dir") + "/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mmrcms/SourceData.kt"
@JvmStatic @JvmStatic
fun main(args: Array<String>) { fun main(args: Array<String>) {
Generator().generate() MMRCMSJsonGen().generate()
} }
} }
} }

View File

@ -0,0 +1,143 @@
package eu.kanade.tachiyomi.multisrc.mmrcms
import java.util.Locale
class MMRCMSSources {
companion object {
sealed class SourceData {
abstract val name: String
abstract val baseUrl: String
abstract val isNsfw: Boolean
abstract val className: String
abstract val pkgName: String
abstract val overrideVersionCode: Int
data class Single(
override val name: String,
override val baseUrl: String,
val lang: String,
override val isNsfw: Boolean = false,
override val className: String = name.replace(" ", ""),
override val pkgName: String = className.toLowerCase(Locale.ENGLISH),
override val overrideVersionCode: Int = 0,
) : SourceData()
data class Multi(
override val name: String,
override val baseUrl: String,
val langs: List<String>,
override val isNsfw: Boolean = false,
override val className: String = name.replace(" ", "") + "Factory",
override val pkgName: String = className.substringBefore("Factory").toLowerCase(Locale.ENGLISH),
override val overrideVersionCode: Int = 0,
) : SourceData()
}
val version: Int = 3
val sourceList: List<SourceData.Single> = listOf(
SourceData.Single("مانجا اون لاين", "https://onma.me", "ar", className = "onma"),
SourceData.Single("Read Comics Online", "https://readcomicsonline.ru", "en"),
SourceData.Single("Fallen Angels", "https://manga.fascans.com", "en"),
SourceData.Single("Zahard", "https://zahard.top", "en"),
SourceData.Single("Manhwas Men", "https://manhwas.men", "en"),
SourceData.Single("Scan FR", "https://www.scan-fr.cc", "fr"),
SourceData.Single("Scan VF", "https://www.scan-vf.net", "fr"),
SourceData.Single("Scan OP", "https://scan-op.cc", "fr"),
SourceData.Single("Komikid", "https://www.komikid.com", "id"),
SourceData.Single("Nikushima", "http://azbivo.webd.pro", "pl"),
SourceData.Single("MangaHanta", "http://mangahanta.com", "tr"),
SourceData.Single("Fallen Angels Scans", "https://truyen.fascans.com", "vi"),
SourceData.Single("LeoManga", "https://leomanga.me", "es"),
SourceData.Single("submanga", "https://submanga.io", "es"),
SourceData.Single("Mangadoor", "https://mangadoor.com", "es"),
SourceData.Single("Mangas.pw", "https://mangas.in", "es", className = "MangasPw"),
SourceData.Single("Utsukushii", "https://manga.utsukushii-bg.com", "bg"),
SourceData.Single("Phoenix-Scans", "https://phoenix-scans.pl", "pl", className = "PhoenixScans"),
SourceData.Single("Puzzmos", "https://puzzmos.com", "tr"),
SourceData.Single("Scan-1", "https://wwv.scan-1.com", "fr", className = "ScanOne"),
SourceData.Single("Lelscan-VF", "https://lelscan-vf.co", "fr", className = "LelscanVF"),
SourceData.Single("Komik Manga", "https://adm.komikmanga.com", "id"),
SourceData.Single("Mangazuki Raws", "https://raws.mangazuki.co", "ko"),
SourceData.Single("Mangazuki", "https://mangazuki.co", "en"),
SourceData.Single("Remangas", "https://remangas.top", "pt-BR"),
SourceData.Single("AnimaRegia", "https://animaregia.net", "pt-BR"),
SourceData.Single("MangaVadisi", "http://manga-v2.mangavadisi.org", "tr"),
SourceData.Single("MangaID", "https://mangaid.click", "id"),
SourceData.Single("Jpmangas", "https://jpmangas.co", "fr"),
SourceData.Single("Op-VF", "https://www.op-vf.com", "fr", className = "OpVF"),
SourceData.Single("FR Scan", "https://frscan.cc", "fr"),
// NOTE: THIS SOURCE CONTAINS A CUSTOM LANGUAGE SYSTEM (which will be ignored)!
SourceData.Single("HentaiShark", "https://www.hentaishark.com", "all", isNsfw = true),
//MultiLang("HentaiShark", "https://www.hentaishark.com", listOf("en", "ja", "zh", "de", "nl", "ko", "cz", "eo", "mn", "ar", "sk", "la", "ua", "ceb", "tl", "fi", "bg", "tr"), isNsfw = true, className = "HentaiSharkFactory"),
)
}
}
//SingleLang("Mangás Yuri", "https://mangasyuri.net", "pt-BR", className = "MangasYuri"), override val id: Long = 6456162511058446409
//SingleLang("FR Scan", "https://www.frscan.me", "fr"),
// Reference from old Factory Source
// Changed CMS
// SourceData("es", "Tumangaonline.co", "http://tumangaonline.com"),
// SourceData("id", "MangaYu", "https://mangayu.com"),
// SourceData("en", "MangaTreat Scans", "http://www.mangatreat.com"),
// SourceData("en", "Chibi Manga Reader", "https://www.cmreader.info"),
// SourceData("tr", "Epikmanga", "https://www.epikmanga.com"),
// SourceData("en", "Hatigarm Scans", "https://hatigarmscans.net"),
// Went offline
// SourceData("ru", "Japit Comics", "https://j-comics.ru"),
// SourceData("es", "Universo Yuri", "https://universoyuri.com"),
// SourceData("pl", "Dracaena", "https://dracaena.webd.pl/czytnik"),
// SourceData("pt-BR", "Comic Space", "https://www.comicspace.com.br"), //ID "Comic Space" -> 1847392744200215680
// SourceData("pl", "ToraScans", "http://torascans.pl"),
// SourceData("en", "White Cloud Pavilion", "https://www.whitecloudpavilion.com/manga/free"),
// SourceData("en", "Biamam Scans", "https://biamam.com"),
// SourceData("en", "Mangawww Reader", "https://mangawww.club"),
// SourceData("ru", "Anigai clan", "http://anigai.ru"),
// SourceData("en", "ZXComic", "http://zxcomic.com"),
// SourceData("es", "SOS Scanlation", "https://sosscanlation.com"),
// SourceData("es", "MangaCasa", "https://mangacasa.com"))
// SourceData("ja", "RAW MANGA READER", "https://rawmanga.site"),
// SourceData("ar", "Manga FYI", "http://mangafyi.com/manga/arabic"),
// SourceData("en", "MangaRoot", "http://mangaroot.com"),
// SourceData("en", "MangaForLife", "http://manga4ever.com"),
// SourceData("en", "Manga Spoil", "http://mangaspoil.com"),
// SourceData("en", "MangaBlue", "http://mangablue.com"),
// SourceData("en", "Manga Forest", "https://mangaforest.com"),
// SourceData("en", "DManga", "http://dmanga.website"),
// SourceData("en", "DB Manga", "http://dbmanga.com"),
// SourceData("en", "Mangacox", "http://mangacox.com"),
// SourceData("en", "GO Manhwa", "http://gomanhwa.xyz"),
// SourceData("en", "KoManga", "https://komanga.net"),
// SourceData("en", "Manganimecan", "http://manganimecan.com"),
// SourceData("en", "Hentai2Manga", "http://hentai2manga.com"),
// SourceData("en", "4 Manga", "http://4-manga.com"),
// SourceData("en", "XYXX.INFO", "http://xyxx.info"),
// SourceData("en", "Isekai Manga Reader", "https://isekaimanga.club"),
// SourceData("fa", "TrinityReader", "http://trinityreader.pw"),
// SourceData("fr", "Manga-LEL", "https://www.manga-lel.com"),
// SourceData("fr", "Manga Etonnia", "https://www.etonnia.com"),
// SourceData("fr", "ScanFR.com"), "http://scanfr.com"),
// SourceData("fr", "Manga FYI", "http://mangafyi.com/manga/french"),
// SourceData("fr", "scans-manga", "http://scans-manga.com"),
// SourceData("fr", "Henka no Kaze", "http://henkanokazelel.esy.es/upload"),
// SourceData("fr", "Tous Vos Scans", "http://www.tous-vos-scans.com"),
// SourceData("id", "Manga Desu", "http://mangadesu.net"),
// SourceData("id", "Komik Mangafire.ID", "http://go.mangafire.id"),
// SourceData("id", "MangaOnline", "https://mangaonline.web.id"),
// SourceData("id", "MangaNesia", "https://manganesia.com"),
// SourceData("id", "MangaID", "https://mangaid.me"
// SourceData("id", "Manga Seru", "http://www.mangaseru.top"
// SourceData("id", "Manga FYI", "http://mangafyi.com/manga/indonesian"
// SourceData("id", "Bacamangaku", "http://www.bacamangaku.com"),
// SourceData("id", "Indo Manga Reader", "http://indomangareader.com"),
// SourceData("it", "Kingdom Italia Reader", "http://kireader.altervista.org"),
// SourceData("ja", "IchigoBook", "http://ichigobook.com"),
// SourceData("ja", "Mangaraw Online", "http://mangaraw.online"
// SourceData("ja", "Mangazuki RAWS", "https://raws.mangazuki.co"),
// SourceData("ja", "MangaRAW", "https://www.mgraw.com"),
// SourceData("ja", "マンガ/漫画 マガジン/雑誌 raw", "http://netabare-manga-raw.com"),
// SourceData("ru", "NAKAMA", "http://nakama.ru"),
// SourceData("tr", "MangAoi", "http://mangaoi.com"),
// SourceData("tr", "ManhuaTR", "http://www.manhua-tr.com"),

File diff suppressed because one or more lines are too long

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 = 'My Manga Reader CMS (Many sources)'
pkgNameSuffix = 'all.mmrcms'
extClass = '.MyMangaReaderCMSSources'
extVersionCode = 55
libVersion = '1.2'
containsNsfw = true
}
apply from: "$rootDir/common.gradle"

File diff suppressed because one or more lines are too long

View File

@ -1,101 +0,0 @@
package eu.kanade.tachiyomi.extension.all.mmrcms
import com.github.salomonbrys.kotson.array
import com.github.salomonbrys.kotson.bool
import com.github.salomonbrys.kotson.string
import com.google.gson.JsonArray
import com.google.gson.JsonObject
import com.google.gson.JsonParser
import eu.kanade.tachiyomi.source.SourceFactory
class MyMangaReaderCMSSources : SourceFactory {
/**
* Create a new copy of the sources
* @return The created sources
*/
override fun createSources() = parseSources(SOURCES)
/**
* Parse a List of JSON sources into a list of `MyMangaReaderCMSSource`s
*
* Example JSON :
* ```
* {
* "language": "en",
* "name": "Example manga reader",
* "base_url": "https://example.com",
* "supports_latest": true,
* "item_url": "https://example.com/manga/",
* "categories": [
* {"id": "stuff", "name": "Stuff"},
* {"id": "test", "name": "Test"}
* ],
* "tags": [
* {"id": "action", "name": "Action"},
* {"id": "adventure", "name": "Adventure"}
* ]
* }
*
*
* Sources that do not supports tags may use `null` instead of a list of json objects
*
* @param sourceString The List of JSON strings 1 entry = one source
* @return The list of parsed sources
*/
private fun parseSources(sourceString: List<String>): List<MyMangaReaderCMSSource> {
val parser = JsonParser()
return sourceString.map {
val jsonObject = parser.parse(it) as JsonObject
val language = jsonObject["language"].string
val name = jsonObject["name"].string
val baseUrl = jsonObject["base_url"].string
val supportsLatest = jsonObject["supports_latest"].bool
val itemUrl = jsonObject["item_url"].string
val categories = mapToPairs(jsonObject["categories"].array)
var tags = emptyList<Pair<String, String>>()
if (jsonObject["tags"].isJsonArray) {
tags = mapToPairs(jsonObject["tags"].asJsonArray)
}
val isNsfw = jsonObject["isNsfw"].bool
if (isNsfw) {
MyMangaReaderCMSSourceNsfw(
language,
name,
baseUrl,
supportsLatest,
itemUrl,
categories,
tags
)
} else {
MyMangaReaderCMSSource(
language,
name,
baseUrl,
supportsLatest,
itemUrl,
categories,
tags
)
}
}
}
/**
* Map an array of JSON objects to pairs. Each JSON object must have
* the following properties:
*
* id: first item in pair
* name: second item in pair
*
* @param array The array to process
* @return The new list of pairs
*/
private fun mapToPairs(array: JsonArray): List<Pair<String, String>> = array.map {
it as JsonObject
it["id"].string to it["name"].string
}
}