Add Collected Curios to Tachiyomi extensions. (#17671)

* Add Collected Curios to Tachiyomi extensions.

Still to do:
* Add additional pages like Spider and Scorpion, Portfolio, etc.

* More refactoring.

* * Redone Icon in Android Asset Studio.

* Update src/en/collectedcurios/AndroidManifest.xml

Fixed AndroidManifest as in draft.

Co-authored-by: arkon <arkon@users.noreply.github.com>

* Update src/en/collectedcurios/build.gradle

extVersionCode 1 is enough.

Co-authored-by: arkon <arkon@users.noreply.github.com>

* Update Collectedcurios.kt

Addressed Arkons suggestions. Further refactoring needed.

* Update src/en/collectedcurios/build.gradle

* Shorten source to just itself.

Co-authored-by: Alessandro Jean <14254807+alessandrojean@users.noreply.github.com>

* Apply suggestions from code review

Accept all suggestions by  alessandrojean.

* Exchange blank "date" for "Chapter".

* Remove date_upload as not needed.

* Restructure when condition in imageUrlParse.

Co-authored-by: Alessandro Jean <14254807+alessandrojean@users.noreply.github.com>

---------

Co-authored-by: arkon <arkon@users.noreply.github.com>
Co-authored-by: Alessandro Jean <14254807+alessandrojean@users.noreply.github.com>
This commit is contained in:
Tomoka1 2023-08-29 01:42:33 +02:00 committed by GitHub
parent 9fcc8867d3
commit 1a959f6ab4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 167 additions and 0 deletions

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View File

@ -0,0 +1,12 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlinx-serialization'
ext {
extName = 'Collected Curios'
pkgNameSuffix = 'en.collectedcurios'
extClass = '.Collectedcurios'
extVersionCode = 1
}
apply from: "$rootDir/common.gradle"

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -0,0 +1,153 @@
package eu.kanade.tachiyomi.extension.en.collectedcurios
import android.util.Log
import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.MangasPage
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 eu.kanade.tachiyomi.util.asJsoup
import okhttp3.Request
import okhttp3.Response
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import rx.Observable
class Collectedcurios : ParsedHttpSource() {
override val name = "Collected Curios"
override val baseUrl = "https://www.collectedcurios.com"
override val lang = "en"
override val supportsLatest = false
override fun fetchPopularManga(page: Int): Observable<MangasPage> {
return Observable.just(
MangasPage(
arrayListOf(
SManga.create().apply {
title = "Sequential Art"
artist = "Jolly Jack aka Phillip M Jackson"
author = "Jolly Jack aka Phillip M Jackson"
status = SManga.ONGOING
url = "/sequentialart.php"
description = "Sequential Art webcomic."
thumbnail_url = "https://www.collectedcurios.com/images/CC_2011_Sequential_Art_Button.jpg"
},
SManga.create().apply {
title = "Battle Bunnies"
artist = "Jolly Jack aka Phillip M Jackson"
author = "Jolly Jack aka Phillip M Jackson"
status = SManga.ONGOING
url = "/battlebunnies.php"
description = "Battle Bunnies webcomic."
thumbnail_url = "https://www.collectedcurios.com/images/CC_2011_Battle_Bunnies_Button.jpg"
},
/*
SManga.create().apply {
title = "Spider and Scorpion"
artist = "Jolly Jack aka Phillip M Jackson"
author = "Jolly Jack aka Phillip M Jackson"
status = SManga.ONGOING
url = "/spiderandscorpion.php"
description = "Spider and Scorpion webcomic."
thumbnail_url = "https://www.collectedcurios.com/images/CC_2011_Spider_And_Scorpion_Button.jpg"
},
*/
),
false,
),
)
}
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
return fetchPopularManga(1)
}
override fun fetchMangaDetails(manga: SManga): Observable<SManga> {
return Observable.just(manga)
}
override fun chapterListParse(response: Response): List<SChapter> {
val responseJs = response.asJsoup()
val chapters =
if (responseJs.selectFirst("img[title=Last]") == null) {
responseJs.selectFirst("input[title=Jump to number]")
?.attr("value")?.toInt()
} else {
responseJs.selectFirst("img[title=Last]")?.parent()
?.attr("href")?.substringAfter("=")?.toInt()
}
var chapterList = mutableListOf<SChapter>()
for (i in chapters?.downTo(1)!!) {
chapterList.add(
SChapter.create().apply {
url = "${response.request.url}?s=$i"
name = "Chapter - $i"
chapter_number = i.toFloat()
date_upload = 0L
},
)
}
return chapterList
}
override fun chapterListSelector() = throw Exception("Not used")
override fun chapterFromElement(element: Element) = SChapter.create().apply {
name = element.selectFirst(".w3-round")?.attr("value") ?: "Chapter"
}
override fun pageListParse(document: Document): List<Page> = throw Exception("Not used")
override fun fetchPageList(chapter: SChapter) = Observable.just(listOf(Page(0, chapter.url)))!!
override fun imageUrlParse(response: Response): String {
val url = response.request.url.toString()
val document = response.asJsoup()
return when {
url.contains("sequentialart") ->
document.selectFirst(".w3-image")!!.absUrl("src")
url.contains("battlebunnies") || url.contains("spiderandscorpion") ->
document.selectFirst("#strip")!!.absUrl("src")
else -> throw Exception("Could not find the image")
}
}
override fun imageUrlParse(document: Document) = throw Exception("Not used")
override fun popularMangaSelector(): String = throw Exception("Not used")
override fun searchMangaFromElement(element: Element): SManga = throw Exception("Not used")
override fun searchMangaNextPageSelector(): String? = throw Exception("Not used")
override fun searchMangaSelector(): String = throw Exception("Not used")
override fun popularMangaRequest(page: Int): Request = throw Exception("Not used")
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request = throw Exception("Not used")
override fun popularMangaNextPageSelector(): String? = throw Exception("Not used")
override fun popularMangaFromElement(element: Element): SManga = throw Exception("Not used")
override fun mangaDetailsParse(document: Document): SManga = throw Exception("Not used")
override fun latestUpdatesNextPageSelector(): String? = throw Exception("Not used")
override fun latestUpdatesFromElement(element: Element): SManga = throw Exception("Not used")
override fun latestUpdatesRequest(page: Int): Request = throw Exception("Not used")
override fun latestUpdatesSelector(): String = throw Exception("Not used")
}