Earlym fix latest updates & some fixes (#491)

* change latest update request

* remove non-functional sort filters

* more nulls

* cleanup

* filter ico files from pages
This commit is contained in:
AwkwardPeak7 2024-01-22 22:12:37 +05:00 committed by Draff
parent 9759754b13
commit 863c51dec6
4 changed files with 25 additions and 15 deletions

View File

@ -1,7 +1,7 @@
ext { ext {
extName = 'EarlyManga' extName = 'EarlyManga'
extClass = '.EarlyManga' extClass = '.EarlyManga'
extVersionCode = 22 extVersionCode = 23
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -60,8 +60,10 @@ class EarlyManga : HttpSource() {
override fun popularMangaParse(response: Response) = searchMangaParse(response) override fun popularMangaParse(response: Response) = searchMangaParse(response)
/* latest */ /* latest */
override fun latestUpdatesRequest(page: Int) = override fun latestUpdatesRequest(page: Int): Request {
searchMangaRequest(page, "", OrderByFilter.LATEST) return GET("$apiUrl/home/show-more?page=$page")
}
override fun latestUpdatesParse(response: Response) = searchMangaParse(response) override fun latestUpdatesParse(response: Response) = searchMangaParse(response)
/* search */ /* search */
@ -93,7 +95,9 @@ class EarlyManga : HttpSource() {
SManga.create().apply { SManga.create().apply {
url = "/manga/${it.id}/${it.slug}" url = "/manga/${it.id}/${it.slug}"
title = it.title title = it.title
thumbnail_url = "$baseUrl/storage/uploads/covers_optimized_mangalist/manga_${it.id}/${it.cover}" thumbnail_url = it.cover?.let { cover ->
"$baseUrl/storage/uploads/covers_optimized_mangalist/manga_${it.id}/$cover"
}
} }
}, },
hasNextPage = result.meta.last_page > result.meta.current_page, hasNextPage = result.meta.last_page > result.meta.current_page,
@ -166,10 +170,17 @@ class EarlyManga : HttpSource() {
title = result.title title = result.title
author = result.authors?.joinToString { it.trim() } author = result.authors?.joinToString { it.trim() }
artist = result.artists?.joinToString { it.trim() } artist = result.artists?.joinToString { it.trim() }
description = "${result.desc.trim()}\n\nAlternative Names: ${result.alt_titles?.joinToString { it.name.trim() }}" description = buildString {
result.desc?.trim()?.also { append(it, "\n\n") }
result.alt_titles?.joinToString("\n") { "${it.name.trim()}" }
?.takeUnless { it.isEmpty() }
?.also { append("Alternative Names:\n", it) }
}
genre = result.all_genres?.joinToString { it.name.trim() } genre = result.all_genres?.joinToString { it.name.trim() }
status = result.pubstatus[0].name.parseStatus() status = result.pubstatus[0].name.parseStatus()
thumbnail_url = "$baseUrl/storage/uploads/covers/manga_${result.id}/${result.cover}" thumbnail_url = result.cover?.let { cover ->
"$baseUrl/storage/uploads/covers/manga_${result.id}/$cover"
}
} }
} }
@ -211,9 +222,11 @@ class EarlyManga : HttpSource() {
val chapterUrl = response.request.url.toString() val chapterUrl = response.request.url.toString()
.replace("/api", "") .replace("/api", "")
return result.images.mapIndexed { index, img -> return result.images
Page(index = index, url = chapterUrl, imageUrl = "$cdnUrl/manga/manga_${result.manga_id}/chapter_${result.slug}/$img") .filterNot { it.endsWith(".ico") }
} .mapIndexed { index, img ->
Page(index = index, url = chapterUrl, imageUrl = "$cdnUrl/manga/manga_${result.manga_id}/chapter_${result.slug}/$img")
}
} }
override fun imageRequest(page: Page): Request { override fun imageRequest(page: Page): Request {

View File

@ -13,7 +13,7 @@ data class SearchData(
val id: Int, val id: Int,
val title: String, val title: String,
val slug: String, val slug: String,
val cover: String, val cover: String? = null,
) )
@Serializable @Serializable
@ -31,8 +31,8 @@ data class MangaData(
val artists: List<String>?, val artists: List<String>?,
val all_genres: List<NameVal>?, val all_genres: List<NameVal>?,
val pubstatus: List<NameVal>, val pubstatus: List<NameVal>,
val desc: String = "Unknown", val desc: String? = "Unknown",
val cover: String, val cover: String? = null,
) )
@Serializable @Serializable

View File

@ -53,14 +53,11 @@ class OrderByFilter(
private val options = listOf( private val options = listOf(
"Views", "Views",
"Bookmarks", "Bookmarks",
"Added date",
"Updated date",
"Number of chapters", "Number of chapters",
"Rating", "Rating",
) )
val POPULAR = FilterList(OrderByFilter("Views")) val POPULAR = FilterList(OrderByFilter("Views"))
val LATEST = FilterList(OrderByFilter("Updated date"))
} }
} }