From c411229164d749065e3c6cd075e90c7b09665775 Mon Sep 17 00:00:00 2001 From: BrutuZ Date: Wed, 17 Apr 2024 10:35:39 -0300 Subject: [PATCH] Anchira: Non-empty Author field (#2448) Don't pass empty string for Author * Fix swapped sort filter * When the cover offset is undefined, assume first page instead of second --- src/en/anchira/build.gradle | 2 +- .../kanade/tachiyomi/extension/en/anchira/Anchira.kt | 12 +++++++++--- .../tachiyomi/extension/en/anchira/AnchiraDto.kt | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/en/anchira/build.gradle b/src/en/anchira/build.gradle index 9242ce537..c0ef7fe1b 100644 --- a/src/en/anchira/build.gradle +++ b/src/en/anchira/build.gradle @@ -1,7 +1,7 @@ ext { extName = 'Anchira' extClass = '.Anchira' - extVersionCode = 11 + extVersionCode = 12 isNsfw = true } diff --git a/src/en/anchira/src/eu/kanade/tachiyomi/extension/en/anchira/Anchira.kt b/src/en/anchira/src/eu/kanade/tachiyomi/extension/en/anchira/Anchira.kt index 450382e3a..7b685aa83 100644 --- a/src/en/anchira/src/eu/kanade/tachiyomi/extension/en/anchira/Anchira.kt +++ b/src/en/anchira/src/eu/kanade/tachiyomi/extension/en/anchira/Anchira.kt @@ -82,8 +82,11 @@ class Anchira : HttpSource(), ConfigurableSource { url = "/g/${it.id}/${it.key}" title = it.title thumbnail_url = "$cdnUrl/${it.id}/${it.key}/m/${it.thumbnailIndex + 1}" - artist = it.tags.filter { it.namespace == 1 }.joinToString(", ") { it.name } + val art = it.tags.filter { it.namespace == 1 }.joinToString(", ") { it.name } + .ifEmpty { null } + artist = art author = it.tags.filter { it.namespace == 2 }.joinToString(", ") { it.name } + .ifEmpty { art } genre = prepareTags(it.tags, preferences.useTagGrouping) update_strategy = UpdateStrategy.ONLY_FETCH_ONCE status = SManga.COMPLETED @@ -240,8 +243,11 @@ class Anchira : HttpSource(), ConfigurableSource { title = data.title thumbnail_url = "$cdnUrl/${data.id}/${data.key}/b/${data.thumbnailIndex + 1}" - artist = data.tags.filter { it.namespace == 1 }.joinToString(", ") { it.name } + val art = data.tags.filter { it.namespace == 1 }.joinToString(", ") { it.name } + .ifEmpty { null } + artist = art author = data.tags.filter { it.namespace == 2 }.joinToString(", ") { it.name } + .ifEmpty { art } genre = prepareTags(data.tags, preferences.useTagGrouping) update_strategy = UpdateStrategy.ONLY_FETCH_ONCE status = SManga.COMPLETED @@ -398,7 +404,7 @@ class Anchira : HttpSource(), ConfigurableSource { private class SortFilter : Filter.Sort( "Sort", - arrayOf("Title", "Pages", "Date published", "Date uploaded", "Popularity"), + arrayOf("Title", "Pages", "Date uploaded", "Date published", "Popularity"), Selection(2, false), ) diff --git a/src/en/anchira/src/eu/kanade/tachiyomi/extension/en/anchira/AnchiraDto.kt b/src/en/anchira/src/eu/kanade/tachiyomi/extension/en/anchira/AnchiraDto.kt index 0929b0c1b..e4c821281 100644 --- a/src/en/anchira/src/eu/kanade/tachiyomi/extension/en/anchira/AnchiraDto.kt +++ b/src/en/anchira/src/eu/kanade/tachiyomi/extension/en/anchira/AnchiraDto.kt @@ -23,7 +23,7 @@ data class Entry( val key: String, @SerialName("published_at") val publishedAt: Long = 0L, val title: String, - @SerialName("thumb_index") val thumbnailIndex: Int = 1, + @SerialName("thumb_index") val thumbnailIndex: Int = 0, val tags: List = emptyList(), val url: String? = null, val pages: Int = 1,