From 792734c22fa064b4cee5d7e6b4f32de5e545568d Mon Sep 17 00:00:00 2001
From: Ahmed gamal <12355.ahmedgamal.com@gmail.com>
Date: Thu, 5 Aug 2021 16:40:39 +0200
Subject: [PATCH] Asgard Team source fix (#8407)
* remove AsgardTeam
remove Asgard Team as it's not using madara theme anymore
* add Asgard Team source
fix asgard team manga as it's not using madara theme anymore
* update asgardteam version
update version
---
.../multisrc/madara/MadaraGenerator.kt | 1 -
src/ar/asgardteam/AndroidManifest.xml | 2 +
src/ar/asgardteam/build.gradle | 12 ++
.../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
.../ar}/asgardteam/res/web_hi_res_512.png | Bin
.../extension/ar/asgardteam/AsgardTeam.kt | 133 ++++++++++++++++++
10 files changed, 147 insertions(+), 1 deletion(-)
create mode 100644 src/ar/asgardteam/AndroidManifest.xml
create mode 100644 src/ar/asgardteam/build.gradle
rename {multisrc/overrides/madara => src/ar}/asgardteam/res/mipmap-hdpi/ic_launcher.png (100%)
rename {multisrc/overrides/madara => src/ar}/asgardteam/res/mipmap-mdpi/ic_launcher.png (100%)
rename {multisrc/overrides/madara => src/ar}/asgardteam/res/mipmap-xhdpi/ic_launcher.png (100%)
rename {multisrc/overrides/madara => src/ar}/asgardteam/res/mipmap-xxhdpi/ic_launcher.png (100%)
rename {multisrc/overrides/madara => src/ar}/asgardteam/res/mipmap-xxxhdpi/ic_launcher.png (100%)
rename {multisrc/overrides/madara => src/ar}/asgardteam/res/web_hi_res_512.png (100%)
create mode 100644 src/ar/asgardteam/src/eu/kanade/tachiyomi/extension/ar/asgardteam/AsgardTeam.kt
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 a720f8c78..dc570b66d 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
@@ -38,7 +38,6 @@ class MadaraGenerator : ThemeSourceGenerator {
SingleLang("ArazNovel", "https://www.araznovel.com", "tr", overrideVersionCode = 1),
SingleLang("Argos Scan", "https://argosscan.com", "pt-BR", overrideVersionCode = 3),
SingleLang("Arthur Scan", "https://arthurscan.xyz", "pt-BR", overrideVersionCode = 2),
- SingleLang("Asgard Team", "https://www.asgard1team.com", "ar", overrideVersionCode = 1),
SingleLang("Astral Library", "https://www.astrallibrary.net", "en", overrideVersionCode = 2),
SingleLang("Atikrost", "https://atikrost.com", "tr", overrideVersionCode = 1),
SingleLang("AZManhwa", "https://azmanhwa.net", "en"),
diff --git a/src/ar/asgardteam/AndroidManifest.xml b/src/ar/asgardteam/AndroidManifest.xml
new file mode 100644
index 000000000..30deb7f79
--- /dev/null
+++ b/src/ar/asgardteam/AndroidManifest.xml
@@ -0,0 +1,2 @@
+
+
diff --git a/src/ar/asgardteam/build.gradle b/src/ar/asgardteam/build.gradle
new file mode 100644
index 000000000..08364e855
--- /dev/null
+++ b/src/ar/asgardteam/build.gradle
@@ -0,0 +1,12 @@
+apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+
+ext {
+ extName = 'Asgard Team'
+ pkgNameSuffix = 'ar.asgardteam'
+ extClass = '.AsgardTeam'
+ extVersionCode = 10
+ libVersion = '1.2'
+}
+
+apply from: "$rootDir/common.gradle"
diff --git a/multisrc/overrides/madara/asgardteam/res/mipmap-hdpi/ic_launcher.png b/src/ar/asgardteam/res/mipmap-hdpi/ic_launcher.png
similarity index 100%
rename from multisrc/overrides/madara/asgardteam/res/mipmap-hdpi/ic_launcher.png
rename to src/ar/asgardteam/res/mipmap-hdpi/ic_launcher.png
diff --git a/multisrc/overrides/madara/asgardteam/res/mipmap-mdpi/ic_launcher.png b/src/ar/asgardteam/res/mipmap-mdpi/ic_launcher.png
similarity index 100%
rename from multisrc/overrides/madara/asgardteam/res/mipmap-mdpi/ic_launcher.png
rename to src/ar/asgardteam/res/mipmap-mdpi/ic_launcher.png
diff --git a/multisrc/overrides/madara/asgardteam/res/mipmap-xhdpi/ic_launcher.png b/src/ar/asgardteam/res/mipmap-xhdpi/ic_launcher.png
similarity index 100%
rename from multisrc/overrides/madara/asgardteam/res/mipmap-xhdpi/ic_launcher.png
rename to src/ar/asgardteam/res/mipmap-xhdpi/ic_launcher.png
diff --git a/multisrc/overrides/madara/asgardteam/res/mipmap-xxhdpi/ic_launcher.png b/src/ar/asgardteam/res/mipmap-xxhdpi/ic_launcher.png
similarity index 100%
rename from multisrc/overrides/madara/asgardteam/res/mipmap-xxhdpi/ic_launcher.png
rename to src/ar/asgardteam/res/mipmap-xxhdpi/ic_launcher.png
diff --git a/multisrc/overrides/madara/asgardteam/res/mipmap-xxxhdpi/ic_launcher.png b/src/ar/asgardteam/res/mipmap-xxxhdpi/ic_launcher.png
similarity index 100%
rename from multisrc/overrides/madara/asgardteam/res/mipmap-xxxhdpi/ic_launcher.png
rename to src/ar/asgardteam/res/mipmap-xxxhdpi/ic_launcher.png
diff --git a/multisrc/overrides/madara/asgardteam/res/web_hi_res_512.png b/src/ar/asgardteam/res/web_hi_res_512.png
similarity index 100%
rename from multisrc/overrides/madara/asgardteam/res/web_hi_res_512.png
rename to src/ar/asgardteam/res/web_hi_res_512.png
diff --git a/src/ar/asgardteam/src/eu/kanade/tachiyomi/extension/ar/asgardteam/AsgardTeam.kt b/src/ar/asgardteam/src/eu/kanade/tachiyomi/extension/ar/asgardteam/AsgardTeam.kt
new file mode 100644
index 000000000..04ab753bb
--- /dev/null
+++ b/src/ar/asgardteam/src/eu/kanade/tachiyomi/extension/ar/asgardteam/AsgardTeam.kt
@@ -0,0 +1,133 @@
+package eu.kanade.tachiyomi.extension.ar.asgardteam
+
+import eu.kanade.tachiyomi.network.GET
+import eu.kanade.tachiyomi.source.model.FilterList
+import eu.kanade.tachiyomi.source.model.Page
+import eu.kanade.tachiyomi.source.model.SChapter
+import eu.kanade.tachiyomi.source.model.SManga
+import eu.kanade.tachiyomi.source.online.ParsedHttpSource
+import okhttp3.Headers
+import okhttp3.OkHttpClient
+import okhttp3.Request
+import org.jsoup.nodes.Document
+import org.jsoup.nodes.Element
+import java.util.concurrent.TimeUnit
+
+class AsgardTeam : ParsedHttpSource() {
+
+ override val name = "AsgardTeam"
+
+ override val baseUrl = "https://asgard1team.com"
+
+ override val lang = "ar"
+
+ override val supportsLatest = true
+
+ override val client: OkHttpClient = network.cloudflareClient.newBuilder()
+ .connectTimeout(10, TimeUnit.SECONDS)
+ .readTimeout(30, TimeUnit.SECONDS)
+ .build()
+
+ override fun headersBuilder(): Headers.Builder = super.headersBuilder()
+ .add("Referer", baseUrl)
+
+ // Popular
+
+ override fun popularMangaSelector() = "div.manga-card"
+
+ override fun popularMangaRequest(page: Int): Request {
+ return GET("$baseUrl/manga-list/?page=$page", headers)
+ }
+
+ override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply {
+ element.select("div.manga-details__container").let {
+ thumbnail_url = element.select("img").attr("abs:src")
+ // title = it.text()
+ }
+ element.select("div.manga-details__container").let {
+ title = element.select("img").attr("alt")
+ }
+ element.select("div a.manga-card__title").let {
+ setUrlWithoutDomain(it.attr("abs:href"))
+ // title = it.text()
+ }
+ }
+
+ override fun popularMangaNextPageSelector() = "ul.pagination a.page-link"
+
+ // Latest
+
+ override fun latestUpdatesRequest(page: Int): Request {
+ return GET(baseUrl)
+ }
+
+ override fun latestUpdatesSelector() = popularMangaSelector()
+
+ override fun latestUpdatesFromElement(element: Element): SManga = popularMangaFromElement(element)
+
+ override fun latestUpdatesNextPageSelector(): String? = null
+
+ // Search
+
+ override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
+ return GET("$baseUrl/search/?s=$query&page=$page", headers)
+ }
+
+ override fun searchMangaSelector() = popularMangaSelector()
+
+ override fun searchMangaFromElement(element: Element): SManga = popularMangaFromElement(element)
+
+ override fun searchMangaNextPageSelector() = popularMangaNextPageSelector()
+
+ // Details
+
+ override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply {
+ return SManga.create().apply {
+ document.select("div.author-info-title").first().let { info ->
+ title = info.select("h6").text()
+ }
+ document.select("div.review-author-info").let { info ->
+ genre = info.select("a").joinToString { it.text() }
+ }
+ document.select("div.full-list-info:contains(المؤلف)").let { info ->
+ author = info.select("small").joinToString { it.text() }
+ }
+ document.select("div.full-list-info:contains(الرسام)").let { info ->
+ artist = info.select("small").joinToString { it.text() }
+ }
+ document.select("div.review-content").let { info ->
+ description = info.select("p").text()
+ }
+ }
+ }
+
+ // Chapters
+
+ override fun chapterListSelector() = "tbody > tr > td"
+
+ override fun chapterFromElement(element: Element): SChapter {
+ val chapter = SChapter.create()
+ element.select("a").let {
+ chapter.setUrlWithoutDomain(it.attr("abs:href"))
+ chapter.name = it.text()
+ }
+ chapter.date_upload = 0
+ return chapter
+ }
+
+ // Pages
+
+ override fun pageListParse(document: Document): List {
+ return document.select("section div.container div.container img").mapIndexed { i, img ->
+ Page(i, "", img.attr("abs:src"))
+ }
+ }
+
+ override fun imageRequest(page: Page): Request {
+ return GET(page.imageUrl!!, headersBuilder().set("Referer", page.url).build())
+ }
+
+ override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used")
+
+ override fun getFilterList() = FilterList()
+}