diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangadventure/MangAdventure.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangadventure/MangAdventure.kt index d719cb75c..70ec21562 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangadventure/MangAdventure.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangadventure/MangAdventure.kt @@ -5,6 +5,7 @@ import eu.kanade.tachiyomi.AppInfo import eu.kanade.tachiyomi.network.GET 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.HttpSource @@ -13,7 +14,6 @@ import kotlinx.serialization.json.decodeFromJsonElement import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.Response import uy.kohesive.injekt.injectLazy -import eu.kanade.tachiyomi.source.model.Page as SPage /** MangAdventure base source. */ abstract class MangAdventure( @@ -25,7 +25,7 @@ abstract class MangAdventure( protected open val categories = DEFAULT_CATEGORIES /** The site's manga status names. */ - protected open val statuses = arrayOf("Any", "Completed", "Ongoing") + protected open val statuses = arrayOf("Any", "Completed", "Ongoing", "Hiatus", "Cancelled") /** The site's sort order labels that correspond to [SortOrder.values]. */ protected open val orders = arrayOf( @@ -36,9 +36,8 @@ abstract class MangAdventure( ) /** A user agent representing Tachiyomi. */ - private val userAgent = "Mozilla/5.0 " + - "(Android ${VERSION.RELEASE}; Mobile) " + - "Tachiyomi/${AppInfo.getVersionName()}" + private val userAgent = + "Mozilla/5.0 (Android ${VERSION.RELEASE}; Mobile) Tachiyomi/${AppInfo.getVersionName()}" /** The URL of the site's API. */ private val apiUrl by lazy { "$baseUrl/api/v2" } @@ -62,7 +61,7 @@ abstract class MangAdventure( override fun searchMangaRequest(page: Int, query: String, filters: FilterList) = apiUrl.toHttpUrl().newBuilder().addEncodedPathSegment("series").run { if (query.startsWith(SLUG_QUERY)) { - addQueryParameter("slug", query.substring(SLUG_QUERY.length)) + addQueryParameter("slug", query.substringAfter(SLUG_QUERY)) } else { addQueryParameter("page", page.toString()) addQueryParameter("title", query) @@ -70,6 +69,7 @@ abstract class MangAdventure( addQueryParameter(it.param, it.toString()) } } + GET(build(), headers) } @@ -98,7 +98,7 @@ abstract class MangAdventure( SChapter.create().apply { url = chapter.id.toString() name = buildString { - append(chapter.full_title) + append(chapter.fullTitle) if (chapter.final) append(" [END]") } chapter_number = chapter.number @@ -111,8 +111,8 @@ abstract class MangAdventure( response.decode().let(::mangaFromJSON) override fun pageListParse(response: Response) = - response.decode>().map { page -> - SPage(page.number, page.url, page.image) + response.decode>().map { page -> + Page(page.number, imageUrl = page.image) } override fun imageUrlParse(response: Response) = @@ -126,8 +126,8 @@ abstract class MangAdventure( FilterList( Author(), Artist(), - SortOrder(orders), Status(statuses), + SortOrder(orders), CategoryList(categories), ) diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangadventure/MangAdventureAPI.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangadventure/MangAdventureAPI.kt index ce420cdc6..2d7b3fb4e 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangadventure/MangAdventureAPI.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangadventure/MangAdventureAPI.kt @@ -1,34 +1,37 @@ package eu.kanade.tachiyomi.multisrc.mangadventure +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + /** Generic results wrapper schema. */ -@kotlinx.serialization.Serializable +@Serializable internal class Results( private val results: List, ) : Iterable by results /** Generic paginator schema. */ -@kotlinx.serialization.Serializable +@Serializable internal class Paginator( val last: Boolean, private val results: List, ) : Iterable by results /** Page model schema. */ -@kotlinx.serialization.Serializable -internal data class Page( +@Serializable +internal data class MAPage( private val id: Int, val image: String, val number: Int, val url: String, ) { override fun equals(other: Any?) = - this === other || other is Page && id == other.id + this === other || other is MAPage && id == other.id override fun hashCode() = id } /** Chapter model schema. */ -@kotlinx.serialization.Serializable +@Serializable internal data class Chapter( val id: Int, val title: String, @@ -38,7 +41,7 @@ internal data class Chapter( val final: Boolean, val series: String, val groups: List, - val full_title: String, + @SerialName("full_title") val fullTitle: String, ) { override fun equals(other: Any?) = this === other || other is Chapter && id == other.id @@ -47,7 +50,7 @@ internal data class Chapter( } /** Series model schema. */ -@kotlinx.serialization.Serializable +@Serializable internal data class Series( val slug: String, val title: String, diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangadventure/MangAdventureGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangadventure/MangAdventureGenerator.kt index cde6e5288..02af19243 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangadventure/MangAdventureGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangadventure/MangAdventureGenerator.kt @@ -9,7 +9,7 @@ class MangAdventureGenerator : ThemeSourceGenerator { override val themeClass = "MangAdventure" - override val baseVersionCode = 12 + override val baseVersionCode = 13 override val sources = listOf( SingleLang("Arc-Relight", "https://arc-relight.com", "en", className = "ArcRelight"),