From 7babbc272badf5177b7306c5ba851e0dda768d75 Mon Sep 17 00:00:00 2001
From: h-hyuuga <83582211+h-hyuuga@users.noreply.github.com>
Date: Fri, 2 Jul 2021 13:29:04 -0400
Subject: [PATCH] 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
---
.../res/mipmap-hdpi/ic_launcher.png | Bin
.../res/mipmap-mdpi/ic_launcher.png | Bin
.../res/mipmap-xhdpi/ic_launcher.png | Bin
.../res/mipmap-xxhdpi/ic_launcher.png | Bin
.../res/mipmap-xxxhdpi/ic_launcher.png | Bin
.../arangscans/res/web_hi_res_512.png | Bin
.../weebreader/default}/AndroidManifest.xml | 11 +++-----
.../naniscans/res/mipmap-hdpi/ic_launcher.png | Bin
.../naniscans/res/mipmap-mdpi/ic_launcher.png | Bin
.../res/mipmap-xhdpi/ic_launcher.png | Bin
.../res/mipmap-xxhdpi/ic_launcher.png | Bin
.../res/mipmap-xxxhdpi/ic_launcher.png | Bin
.../naniscans/res/web_hi_res_512.png | Bin
.../weebreader/naniscans/src/NaniScans.kt | 10 +++++++
.../multisrc/madara/MadaraGenerator.kt | 1 -
.../multisrc/weebreader/Weebreader.kt | 22 ++++++---------
.../weebreader/WeebreaderGenerator.kt | 25 ++++++++++++++++++
.../weebreader/WeebreaderUrlActivity.kt | 8 +++---
src/en/naniscans/build.gradle | 13 ---------
19 files changed, 50 insertions(+), 40 deletions(-)
rename multisrc/overrides/{madara => weebreader}/arangscans/res/mipmap-hdpi/ic_launcher.png (100%)
rename multisrc/overrides/{madara => weebreader}/arangscans/res/mipmap-mdpi/ic_launcher.png (100%)
rename multisrc/overrides/{madara => weebreader}/arangscans/res/mipmap-xhdpi/ic_launcher.png (100%)
rename multisrc/overrides/{madara => weebreader}/arangscans/res/mipmap-xxhdpi/ic_launcher.png (100%)
rename multisrc/overrides/{madara => weebreader}/arangscans/res/mipmap-xxxhdpi/ic_launcher.png (100%)
rename multisrc/overrides/{madara => weebreader}/arangscans/res/web_hi_res_512.png (100%)
rename {src/en/naniscans => multisrc/overrides/weebreader/default}/AndroidManifest.xml (67%)
rename {src/en => multisrc/overrides/weebreader}/naniscans/res/mipmap-hdpi/ic_launcher.png (100%)
rename {src/en => multisrc/overrides/weebreader}/naniscans/res/mipmap-mdpi/ic_launcher.png (100%)
rename {src/en => multisrc/overrides/weebreader}/naniscans/res/mipmap-xhdpi/ic_launcher.png (100%)
rename {src/en => multisrc/overrides/weebreader}/naniscans/res/mipmap-xxhdpi/ic_launcher.png (100%)
rename {src/en => multisrc/overrides/weebreader}/naniscans/res/mipmap-xxxhdpi/ic_launcher.png (100%)
rename {src/en => multisrc/overrides/weebreader}/naniscans/res/web_hi_res_512.png (100%)
create mode 100644 multisrc/overrides/weebreader/naniscans/src/NaniScans.kt
rename src/en/naniscans/src/eu/kanade/tachiyomi/extension/en/naniscans/NaniScans.kt => multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/weebreader/Weebreader.kt (95%)
create mode 100644 multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/weebreader/WeebreaderGenerator.kt
rename src/en/naniscans/src/eu/kanade/tachiyomi/extension/en/naniscans/NaniScansUrlActivity.kt => multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/weebreader/WeebreaderUrlActivity.kt (78%)
delete mode 100644 src/en/naniscans/build.gradle
diff --git a/multisrc/overrides/madara/arangscans/res/mipmap-hdpi/ic_launcher.png b/multisrc/overrides/weebreader/arangscans/res/mipmap-hdpi/ic_launcher.png
similarity index 100%
rename from multisrc/overrides/madara/arangscans/res/mipmap-hdpi/ic_launcher.png
rename to multisrc/overrides/weebreader/arangscans/res/mipmap-hdpi/ic_launcher.png
diff --git a/multisrc/overrides/madara/arangscans/res/mipmap-mdpi/ic_launcher.png b/multisrc/overrides/weebreader/arangscans/res/mipmap-mdpi/ic_launcher.png
similarity index 100%
rename from multisrc/overrides/madara/arangscans/res/mipmap-mdpi/ic_launcher.png
rename to multisrc/overrides/weebreader/arangscans/res/mipmap-mdpi/ic_launcher.png
diff --git a/multisrc/overrides/madara/arangscans/res/mipmap-xhdpi/ic_launcher.png b/multisrc/overrides/weebreader/arangscans/res/mipmap-xhdpi/ic_launcher.png
similarity index 100%
rename from multisrc/overrides/madara/arangscans/res/mipmap-xhdpi/ic_launcher.png
rename to multisrc/overrides/weebreader/arangscans/res/mipmap-xhdpi/ic_launcher.png
diff --git a/multisrc/overrides/madara/arangscans/res/mipmap-xxhdpi/ic_launcher.png b/multisrc/overrides/weebreader/arangscans/res/mipmap-xxhdpi/ic_launcher.png
similarity index 100%
rename from multisrc/overrides/madara/arangscans/res/mipmap-xxhdpi/ic_launcher.png
rename to multisrc/overrides/weebreader/arangscans/res/mipmap-xxhdpi/ic_launcher.png
diff --git a/multisrc/overrides/madara/arangscans/res/mipmap-xxxhdpi/ic_launcher.png b/multisrc/overrides/weebreader/arangscans/res/mipmap-xxxhdpi/ic_launcher.png
similarity index 100%
rename from multisrc/overrides/madara/arangscans/res/mipmap-xxxhdpi/ic_launcher.png
rename to multisrc/overrides/weebreader/arangscans/res/mipmap-xxxhdpi/ic_launcher.png
diff --git a/multisrc/overrides/madara/arangscans/res/web_hi_res_512.png b/multisrc/overrides/weebreader/arangscans/res/web_hi_res_512.png
similarity index 100%
rename from multisrc/overrides/madara/arangscans/res/web_hi_res_512.png
rename to multisrc/overrides/weebreader/arangscans/res/web_hi_res_512.png
diff --git a/src/en/naniscans/AndroidManifest.xml b/multisrc/overrides/weebreader/default/AndroidManifest.xml
similarity index 67%
rename from src/en/naniscans/AndroidManifest.xml
rename to multisrc/overrides/weebreader/default/AndroidManifest.xml
index 16997e31e..821836fd6 100644
--- a/src/en/naniscans/AndroidManifest.xml
+++ b/multisrc/overrides/weebreader/default/AndroidManifest.xml
@@ -4,7 +4,7 @@
@@ -12,15 +12,10 @@
-
-
+ android:scheme="${SOURCESCHEME}" />
diff --git a/src/en/naniscans/res/mipmap-hdpi/ic_launcher.png b/multisrc/overrides/weebreader/naniscans/res/mipmap-hdpi/ic_launcher.png
similarity index 100%
rename from src/en/naniscans/res/mipmap-hdpi/ic_launcher.png
rename to multisrc/overrides/weebreader/naniscans/res/mipmap-hdpi/ic_launcher.png
diff --git a/src/en/naniscans/res/mipmap-mdpi/ic_launcher.png b/multisrc/overrides/weebreader/naniscans/res/mipmap-mdpi/ic_launcher.png
similarity index 100%
rename from src/en/naniscans/res/mipmap-mdpi/ic_launcher.png
rename to multisrc/overrides/weebreader/naniscans/res/mipmap-mdpi/ic_launcher.png
diff --git a/src/en/naniscans/res/mipmap-xhdpi/ic_launcher.png b/multisrc/overrides/weebreader/naniscans/res/mipmap-xhdpi/ic_launcher.png
similarity index 100%
rename from src/en/naniscans/res/mipmap-xhdpi/ic_launcher.png
rename to multisrc/overrides/weebreader/naniscans/res/mipmap-xhdpi/ic_launcher.png
diff --git a/src/en/naniscans/res/mipmap-xxhdpi/ic_launcher.png b/multisrc/overrides/weebreader/naniscans/res/mipmap-xxhdpi/ic_launcher.png
similarity index 100%
rename from src/en/naniscans/res/mipmap-xxhdpi/ic_launcher.png
rename to multisrc/overrides/weebreader/naniscans/res/mipmap-xxhdpi/ic_launcher.png
diff --git a/src/en/naniscans/res/mipmap-xxxhdpi/ic_launcher.png b/multisrc/overrides/weebreader/naniscans/res/mipmap-xxxhdpi/ic_launcher.png
similarity index 100%
rename from src/en/naniscans/res/mipmap-xxxhdpi/ic_launcher.png
rename to multisrc/overrides/weebreader/naniscans/res/mipmap-xxxhdpi/ic_launcher.png
diff --git a/src/en/naniscans/res/web_hi_res_512.png b/multisrc/overrides/weebreader/naniscans/res/web_hi_res_512.png
similarity index 100%
rename from src/en/naniscans/res/web_hi_res_512.png
rename to multisrc/overrides/weebreader/naniscans/res/web_hi_res_512.png
diff --git a/multisrc/overrides/weebreader/naniscans/src/NaniScans.kt b/multisrc/overrides/weebreader/naniscans/src/NaniScans.kt
new file mode 100644
index 000000000..02c7f4ac6
--- /dev/null
+++ b/multisrc/overrides/weebreader/naniscans/src/NaniScans.kt
@@ -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
+}
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 72fbb5189..0e33bda7c 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
@@ -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),
diff --git a/src/en/naniscans/src/eu/kanade/tachiyomi/extension/en/naniscans/NaniScans.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/weebreader/Weebreader.kt
similarity index 95%
rename from src/en/naniscans/src/eu/kanade/tachiyomi/extension/en/naniscans/NaniScans.kt
rename to multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/weebreader/Weebreader.kt
index 3ac88918b..acc1addc2 100644
--- a/src/en/naniscans/src/eu/kanade/tachiyomi/extension/en/naniscans/NaniScans.kt
+++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/weebreader/Weebreader.kt
@@ -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
diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/weebreader/WeebreaderGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/weebreader/WeebreaderGenerator.kt
new file mode 100644
index 000000000..ec685aa63
--- /dev/null
+++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/weebreader/WeebreaderGenerator.kt
@@ -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) {
+ WeebreaderGenerator().createAll()
+ }
+ }
+}
diff --git a/src/en/naniscans/src/eu/kanade/tachiyomi/extension/en/naniscans/NaniScansUrlActivity.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/weebreader/WeebreaderUrlActivity.kt
similarity index 78%
rename from src/en/naniscans/src/eu/kanade/tachiyomi/extension/en/naniscans/NaniScansUrlActivity.kt
rename to multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/weebreader/WeebreaderUrlActivity.kt
index f5b400bf0..cd1330deb 100644
--- a/src/en/naniscans/src/eu/kanade/tachiyomi/extension/en/naniscans/NaniScansUrlActivity.kt
+++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/weebreader/WeebreaderUrlActivity.kt
@@ -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()
diff --git a/src/en/naniscans/build.gradle b/src/en/naniscans/build.gradle
deleted file mode 100644
index e2f9b97cb..000000000
--- a/src/en/naniscans/build.gradle
+++ /dev/null
@@ -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"