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
This commit is contained in:
BrutuZ 2024-04-17 10:35:39 -03:00 committed by Draff
parent d86505e788
commit c411229164
3 changed files with 11 additions and 5 deletions

View File

@ -1,7 +1,7 @@
ext { ext {
extName = 'Anchira' extName = 'Anchira'
extClass = '.Anchira' extClass = '.Anchira'
extVersionCode = 11 extVersionCode = 12
isNsfw = true isNsfw = true
} }

View File

@ -82,8 +82,11 @@ class Anchira : HttpSource(), ConfigurableSource {
url = "/g/${it.id}/${it.key}" url = "/g/${it.id}/${it.key}"
title = it.title title = it.title
thumbnail_url = "$cdnUrl/${it.id}/${it.key}/m/${it.thumbnailIndex + 1}" 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 } author = it.tags.filter { it.namespace == 2 }.joinToString(", ") { it.name }
.ifEmpty { art }
genre = prepareTags(it.tags, preferences.useTagGrouping) genre = prepareTags(it.tags, preferences.useTagGrouping)
update_strategy = UpdateStrategy.ONLY_FETCH_ONCE update_strategy = UpdateStrategy.ONLY_FETCH_ONCE
status = SManga.COMPLETED status = SManga.COMPLETED
@ -240,8 +243,11 @@ class Anchira : HttpSource(), ConfigurableSource {
title = data.title title = data.title
thumbnail_url = thumbnail_url =
"$cdnUrl/${data.id}/${data.key}/b/${data.thumbnailIndex + 1}" "$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 } author = data.tags.filter { it.namespace == 2 }.joinToString(", ") { it.name }
.ifEmpty { art }
genre = prepareTags(data.tags, preferences.useTagGrouping) genre = prepareTags(data.tags, preferences.useTagGrouping)
update_strategy = UpdateStrategy.ONLY_FETCH_ONCE update_strategy = UpdateStrategy.ONLY_FETCH_ONCE
status = SManga.COMPLETED status = SManga.COMPLETED
@ -398,7 +404,7 @@ class Anchira : HttpSource(), ConfigurableSource {
private class SortFilter : Filter.Sort( private class SortFilter : Filter.Sort(
"Sort", "Sort",
arrayOf("Title", "Pages", "Date published", "Date uploaded", "Popularity"), arrayOf("Title", "Pages", "Date uploaded", "Date published", "Popularity"),
Selection(2, false), Selection(2, false),
) )

View File

@ -23,7 +23,7 @@ data class Entry(
val key: String, val key: String,
@SerialName("published_at") val publishedAt: Long = 0L, @SerialName("published_at") val publishedAt: Long = 0L,
val title: String, val title: String,
@SerialName("thumb_index") val thumbnailIndex: Int = 1, @SerialName("thumb_index") val thumbnailIndex: Int = 0,
val tags: List<Tag> = emptyList(), val tags: List<Tag> = emptyList(),
val url: String? = null, val url: String? = null,
val pages: Int = 1, val pages: Int = 1,