Anchira: Fix API changes (#3038)
* Anchira: Fix API changes * Fix thumbnails on library response * Anchira: Remove data class * Update src/en/anchira/src/eu/kanade/tachiyomi/extension/en/anchira/AnchiraDto.kt --------- Co-authored-by: BrutuZ <BrutuZ@users.noreply.github.com>
This commit is contained in:
parent
47af581f6d
commit
3cb723b12b
|
@ -1,7 +1,7 @@
|
|||
ext {
|
||||
extName = 'Anchira'
|
||||
extClass = '.Anchira'
|
||||
extVersionCode = 12
|
||||
extVersionCode = 13
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ class Anchira : HttpSource(), ConfigurableSource {
|
|||
SManga.create().apply {
|
||||
url = "/g/${it.id}/${it.key}"
|
||||
title = it.title
|
||||
thumbnail_url = "$cdnUrl/${it.id}/${it.key}/m/${it.thumbnailIndex + 1}"
|
||||
thumbnail_url = "$cdnUrl/${it.id}/${it.key}/m/${it.cover?.name}"
|
||||
val art = it.tags.filter { it.namespace == 1 }.joinToString(", ") { it.name }
|
||||
.ifEmpty { null }
|
||||
artist = art
|
||||
|
@ -242,7 +242,7 @@ class Anchira : HttpSource(), ConfigurableSource {
|
|||
url = "/g/${data.id}/${data.key}"
|
||||
title = data.title
|
||||
thumbnail_url =
|
||||
"$cdnUrl/${data.id}/${data.key}/b/${data.thumbnailIndex + 1}"
|
||||
"$cdnUrl/${data.id}/${data.key}/l/${data.images[data.thumbnailIndex].name}"
|
||||
val art = data.tags.filter { it.namespace == 1 }.joinToString(", ") { it.name }
|
||||
.ifEmpty { null }
|
||||
artist = art
|
||||
|
@ -316,10 +316,10 @@ class Anchira : HttpSource(), ConfigurableSource {
|
|||
val data = json.decodeFromString<Entry>(response.body.string())
|
||||
val imageData = getImageData(data)
|
||||
|
||||
return imageData.names.mapIndexed { i, name ->
|
||||
return data.images.mapIndexed { i, image ->
|
||||
Page(
|
||||
i,
|
||||
imageUrl = "$cdnUrl/${imageData.id}/${imageData.key}/${imageData.hash}/b/$name",
|
||||
imageUrl = "$cdnUrl/${imageData.id}/${imageData.key}/${imageData.hash}/b/${image.name}",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ class Anchira : HttpSource(), ConfigurableSource {
|
|||
val keys = anchiraData.find { it.id == entry.id }
|
||||
|
||||
if (keys?.key != null && keys.hash != null) {
|
||||
return ImageData(keys.id, keys.key, keys.hash, keys.names)
|
||||
return ImageData(keys.id, keys.key, keys.hash)
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
|
@ -4,13 +4,13 @@ import kotlinx.serialization.SerialName
|
|||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class Tag(
|
||||
class Tag(
|
||||
var name: String,
|
||||
var namespace: Int? = null,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class LibraryResponse(
|
||||
class LibraryResponse(
|
||||
val entries: List<Entry> = emptyList(),
|
||||
val total: Int,
|
||||
val page: Int,
|
||||
|
@ -18,7 +18,7 @@ data class LibraryResponse(
|
|||
)
|
||||
|
||||
@Serializable
|
||||
data class Entry(
|
||||
class Entry(
|
||||
val id: Int,
|
||||
val key: String,
|
||||
@SerialName("published_at") val publishedAt: Long = 0L,
|
||||
|
@ -27,21 +27,27 @@ data class Entry(
|
|||
val tags: List<Tag> = emptyList(),
|
||||
val url: String? = null,
|
||||
val pages: Int = 1,
|
||||
val cover: Image? = null,
|
||||
@SerialName("data")
|
||||
val images: List<Image> = emptyList(),
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class ImageData(
|
||||
class ImageData(
|
||||
val id: Int,
|
||||
val key: String,
|
||||
val hash: String,
|
||||
val names: List<String>,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class EntryKey(
|
||||
class EntryKey(
|
||||
val id: Int,
|
||||
val key: String? = null,
|
||||
val hash: String? = null,
|
||||
val url: String? = null,
|
||||
val names: List<String> = emptyList(),
|
||||
)
|
||||
|
||||
@Serializable
|
||||
class Image(
|
||||
@SerialName("n") val name: String,
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue