Add new multisrc extension (Weebreader) (#7911)

* Arang Scans: Move to multisrc Weebreader (new)

* Weebreader: Add artist and author parsing

* Remove Weebreader.kt

* Weebreader: Replace weebreader implementation with NaniScan's implementation

* Weebreader: Rename classes

* Weebreader: Fix typo in filename

* Weebreader: Trim whitespace around author and artist
This commit is contained in:
h-hyuuga 2021-07-02 13:29:04 -04:00 committed by GitHub
parent bc1bd6e09e
commit 7babbc272b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 50 additions and 40 deletions

View File

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 180 KiB

After

Width:  |  Height:  |  Size: 180 KiB

View File

@ -4,7 +4,7 @@
<application>
<activity
android:name=".en.naniscans.NaniScansUrlActivity"
android:name=".en.naniscans.WeebreaderUrlActivity"
android:excludeFromRecents="true"
android:theme="@android:style/Theme.NoDisplay">
<intent-filter>
@ -12,15 +12,10 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="naniscans.com"
android:host="${SOURCEHOST}"
android:pathPattern="/titles/..*"
android:scheme="https" />
<data
android:host="www.naniscans.com"
android:pathPattern="/titles/..*"
android:scheme="https" />
android:scheme="${SOURCESCHEME}" />
</intent-filter>
</activity>
</application>

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 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: 9.7 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

@ -0,0 +1,10 @@
package eu.kanade.tachiyomi.extension.en.naniscans
import eu.kanade.tachiyomi.multisrc.weebreader.Weebreader
class NaniScans : Weebreader("NANI? Scans", "https://naniscans.com", "en") {
override val versionId = 2
}

View File

@ -34,7 +34,6 @@ class MadaraGenerator : ThemeSourceGenerator {
SingleLang("Anisa Manga", "https://anisamanga.com", "tr"),
SingleLang("ApollComics", "https://apollcomics.xyz", "es", overrideVersionCode = 1),
SingleLang("ArabMkr", "https://arabmkr.me", "ar"),
SingleLang("Arang Scans", "https://arangscans.com", "en", overrideVersionCode = 3), // removed override
SingleLang("ArazNovel", "https://www.araznovel.com", "tr", overrideVersionCode = 1),
SingleLang("Argos Scan", "https://argosscan.com", "pt-BR", overrideVersionCode = 2),
SingleLang("Arthur Scan", "https://arthurscan.xyz", "pt-BR", overrideVersionCode = 1),

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.extension.en.naniscans
package eu.kanade.tachiyomi.multisrc.weebreader
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.asObservableSuccess
@ -21,18 +21,14 @@ import uy.kohesive.injekt.injectLazy
import java.text.SimpleDateFormat
import java.util.Locale
class NaniScans : HttpSource() {
override val name = "NANI? Scans"
override val baseUrl = "https://naniscans.com"
override val lang = "en"
abstract class Weebreader(
override val name: String,
override val baseUrl: String,
override val lang: String,
): HttpSource() {
override val supportsLatest = true
override val versionId = 2
private val dateParser = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.getDefault())
private val json: Json by injectLazy()
@ -98,8 +94,8 @@ class NaniScans : HttpSource() {
return SManga.create().apply {
title = titleJson["name"]!!.jsonPrimitive.content
artist = titleJson["artist"]!!.jsonPrimitive.content
author = titleJson["author"]!!.jsonPrimitive.content
artist = titleJson["artist"]!!.jsonPrimitive.content.trim()
author = titleJson["author"]!!.jsonPrimitive.content.trim()
description = titleJson["synopsis"]!!.jsonPrimitive.content
status = getStatus(titleJson["status"]!!.jsonPrimitive.content)
thumbnail_url = "$baseUrl${titleJson["coverUrl"]!!.jsonPrimitive.content}"
@ -116,8 +112,6 @@ class NaniScans : HttpSource() {
if (titleJson["type"]!!.jsonPrimitive.content != "Comic")
throw UnsupportedOperationException("Tachiyomi only supports Comics.")
val chaptersJson = titleJson["chapters"]!!.jsonArray
return titleJson["chapters"]!!.jsonArray.map {
val chapter = it.jsonObject

View File

@ -0,0 +1,25 @@
package eu.kanade.tachiyomi.multisrc.weebreader
import generator.ThemeSourceData.SingleLang
import generator.ThemeSourceGenerator
class WeebreaderGenerator : ThemeSourceGenerator {
override val themePkg = "weebreader"
override val themeClass = "Weebreader"
override val baseVersionCode: Int = 1
override val sources = listOf(
SingleLang("Arang Scans", "https://arangscans.com", "en", overrideVersionCode = 10),
SingleLang("NANI? Scans", "https://naniscans.com", "en", overrideVersionCode = 6, className = "NaniScans"),
)
companion object {
@JvmStatic
fun main(args: Array<String>) {
WeebreaderGenerator().createAll()
}
}
}

View File

@ -1,4 +1,4 @@
package eu.kanade.tachiyomi.extension.en.naniscans
package eu.kanade.tachiyomi.multisrc.weebreader
import android.app.Activity
import android.content.ActivityNotFoundException
@ -7,7 +7,7 @@ import android.os.Bundle
import android.util.Log
import kotlin.system.exitProcess
class NaniScansUrlActivity : Activity() {
class WeebreaderUrlActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val pathSegments = intent?.data?.pathSegments
@ -23,10 +23,10 @@ class NaniScansUrlActivity : Activity() {
try {
startActivity(mainIntent)
} catch (e: ActivityNotFoundException) {
Log.e("NaniScansUrlActivity", e.toString())
Log.e("WeebreaderUrlActivity", e.toString())
}
} else {
Log.e("NaniScansUrlActivity", "could not parse uri from intent $intent")
Log.e("WeebreaderUrlActivity", "could not parse uri from intent $intent")
}
finish()

View File

@ -1,13 +0,0 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlinx-serialization'
ext {
extName = 'NANI? Scans'
pkgNameSuffix = 'en.naniscans'
extClass = '.NaniScans'
extVersionCode = 6
libVersion = '1.2'
}
apply from: "$rootDir/common.gradle"