mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-27 16:26:29 +03:00
parent
303dd2ef44
commit
c94774eba3
11 changed files with 44 additions and 13 deletions
|
@ -182,6 +182,7 @@ fun AnimeTrackerSearch(
|
||||||
status = it.publishing_status.toLowerCase(Locale.current).capitalize(
|
status = it.publishing_status.toLowerCase(Locale.current).capitalize(
|
||||||
Locale.current,
|
Locale.current,
|
||||||
),
|
),
|
||||||
|
score = it.score,
|
||||||
description = it.summary.trim(),
|
description = it.summary.trim(),
|
||||||
selected = it == selected,
|
selected = it == selected,
|
||||||
onClick = { onSelectedChange(it) },
|
onClick = { onSelectedChange(it) },
|
||||||
|
|
|
@ -197,9 +197,8 @@ fun MangaTrackerSearch(
|
||||||
Locale.current,
|
Locale.current,
|
||||||
),
|
),
|
||||||
startDate = it.start_date,
|
startDate = it.start_date,
|
||||||
status = it.publishing_status.toLowerCase(Locale.current).capitalize(
|
status = it.publishing_status.toLowerCase(Locale.current).capitalize(Locale.current),
|
||||||
Locale.current,
|
score = it.score,
|
||||||
),
|
|
||||||
description = it.summary.trim(),
|
description = it.summary.trim(),
|
||||||
selected = it == selected,
|
selected = it == selected,
|
||||||
onClick = { onSelectedChange(it) },
|
onClick = { onSelectedChange(it) },
|
||||||
|
@ -225,6 +224,7 @@ fun SearchResultItem(
|
||||||
type: String,
|
type: String,
|
||||||
startDate: String,
|
startDate: String,
|
||||||
status: String,
|
status: String,
|
||||||
|
score: Float,
|
||||||
description: String,
|
description: String,
|
||||||
selected: Boolean,
|
selected: Boolean,
|
||||||
onClick: () -> Unit,
|
onClick: () -> Unit,
|
||||||
|
@ -286,6 +286,12 @@ fun SearchResultItem(
|
||||||
text = status,
|
text = status,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
if (score != -1f) {
|
||||||
|
SearchResultItemDetails(
|
||||||
|
title = stringResource(MR.strings.score),
|
||||||
|
text = score.toString(),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (description.isNotBlank()) {
|
if (description.isNotBlank()) {
|
||||||
|
|
|
@ -250,6 +250,7 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
||||||
|month
|
|month
|
||||||
|day
|
|day
|
||||||
|}
|
|}
|
||||||
|
|averageScore
|
||||||
|}
|
|}
|
||||||
|}
|
|}
|
||||||
|}
|
|}
|
||||||
|
@ -303,6 +304,7 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
||||||
|month
|
|month
|
||||||
|day
|
|day
|
||||||
|}
|
|}
|
||||||
|
|averageScore
|
||||||
|}
|
|}
|
||||||
|}
|
|}
|
||||||
|}
|
|}
|
||||||
|
@ -533,6 +535,7 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
||||||
struct["status"]!!.jsonPrimitive.contentOrNull ?: "",
|
struct["status"]!!.jsonPrimitive.contentOrNull ?: "",
|
||||||
parseDate(struct, "startDate"),
|
parseDate(struct, "startDate"),
|
||||||
struct["chapters"]!!.jsonPrimitive.intOrNull ?: 0,
|
struct["chapters"]!!.jsonPrimitive.intOrNull ?: 0,
|
||||||
|
struct["averageScore"]?.jsonPrimitive?.intOrNull ?: -1,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -546,6 +549,7 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
||||||
struct["status"]!!.jsonPrimitive.contentOrNull ?: "",
|
struct["status"]!!.jsonPrimitive.contentOrNull ?: "",
|
||||||
parseDate(struct, "startDate"),
|
parseDate(struct, "startDate"),
|
||||||
struct["episodes"]!!.jsonPrimitive.intOrNull ?: 0,
|
struct["episodes"]!!.jsonPrimitive.intOrNull ?: 0,
|
||||||
|
struct["averageScore"]?.jsonPrimitive?.intOrNull ?: -1,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ data class ALManga(
|
||||||
val publishing_status: String,
|
val publishing_status: String,
|
||||||
val start_date_fuzzy: Long,
|
val start_date_fuzzy: Long,
|
||||||
val total_chapters: Int,
|
val total_chapters: Int,
|
||||||
|
val average_score: Int,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
fun toTrack() = MangaTrackSearch.create(TrackerManager.ANILIST).apply {
|
fun toTrack() = MangaTrackSearch.create(TrackerManager.ANILIST).apply {
|
||||||
|
@ -29,6 +30,7 @@ data class ALManga(
|
||||||
total_chapters = this@ALManga.total_chapters
|
total_chapters = this@ALManga.total_chapters
|
||||||
cover_url = image_url_lge
|
cover_url = image_url_lge
|
||||||
summary = description?.htmlDecode() ?: ""
|
summary = description?.htmlDecode() ?: ""
|
||||||
|
score = average_score.toFloat()
|
||||||
tracking_url = AnilistApi.mangaUrl(media_id)
|
tracking_url = AnilistApi.mangaUrl(media_id)
|
||||||
publishing_status = this@ALManga.publishing_status
|
publishing_status = this@ALManga.publishing_status
|
||||||
publishing_type = format
|
publishing_type = format
|
||||||
|
@ -52,6 +54,7 @@ data class ALAnime(
|
||||||
val publishing_status: String,
|
val publishing_status: String,
|
||||||
val start_date_fuzzy: Long,
|
val start_date_fuzzy: Long,
|
||||||
val total_episodes: Int,
|
val total_episodes: Int,
|
||||||
|
val average_score: Int,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
fun toTrack() = AnimeTrackSearch.create(TrackerManager.ANILIST).apply {
|
fun toTrack() = AnimeTrackSearch.create(TrackerManager.ANILIST).apply {
|
||||||
|
@ -60,6 +63,7 @@ data class ALAnime(
|
||||||
total_episodes = this@ALAnime.total_episodes
|
total_episodes = this@ALAnime.total_episodes
|
||||||
cover_url = image_url_lge
|
cover_url = image_url_lge
|
||||||
summary = description?.htmlDecode() ?: ""
|
summary = description?.htmlDecode() ?: ""
|
||||||
|
score = average_score.toFloat()
|
||||||
tracking_url = AnilistApi.animeUrl(media_id)
|
tracking_url = AnilistApi.animeUrl(media_id)
|
||||||
publishing_status = this@ALAnime.publishing_status
|
publishing_status = this@ALAnime.publishing_status
|
||||||
publishing_type = format
|
publishing_type = format
|
||||||
|
|
|
@ -13,6 +13,7 @@ import eu.kanade.tachiyomi.network.parseAs
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import kotlinx.serialization.json.JsonObject
|
import kotlinx.serialization.json.JsonObject
|
||||||
import kotlinx.serialization.json.contentOrNull
|
import kotlinx.serialization.json.contentOrNull
|
||||||
|
import kotlinx.serialization.json.floatOrNull
|
||||||
import kotlinx.serialization.json.int
|
import kotlinx.serialization.json.int
|
||||||
import kotlinx.serialization.json.jsonArray
|
import kotlinx.serialization.json.jsonArray
|
||||||
import kotlinx.serialization.json.jsonObject
|
import kotlinx.serialization.json.jsonObject
|
||||||
|
@ -177,11 +178,13 @@ class BangumiApi(
|
||||||
} else {
|
} else {
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
val rating = obj["rating"]?.jsonObject?.get("score")?.jsonPrimitive?.floatOrNull ?: -1f
|
||||||
return MangaTrackSearch.create(trackId).apply {
|
return MangaTrackSearch.create(trackId).apply {
|
||||||
media_id = obj["id"]!!.jsonPrimitive.long
|
media_id = obj["id"]!!.jsonPrimitive.long
|
||||||
title = obj["name_cn"]!!.jsonPrimitive.content
|
title = obj["name_cn"]!!.jsonPrimitive.content
|
||||||
cover_url = coverUrl
|
cover_url = coverUrl
|
||||||
summary = obj["name"]!!.jsonPrimitive.content
|
summary = obj["name"]!!.jsonPrimitive.content
|
||||||
|
score = rating
|
||||||
tracking_url = obj["url"]!!.jsonPrimitive.content
|
tracking_url = obj["url"]!!.jsonPrimitive.content
|
||||||
total_chapters = totalChapters
|
total_chapters = totalChapters
|
||||||
}
|
}
|
||||||
|
@ -199,10 +202,13 @@ class BangumiApi(
|
||||||
} else {
|
} else {
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val rating = obj["rating"]?.jsonObject?.get("score")?.jsonPrimitive?.floatOrNull ?: -1f
|
||||||
return AnimeTrackSearch.create(trackId).apply {
|
return AnimeTrackSearch.create(trackId).apply {
|
||||||
media_id = obj["id"]!!.jsonPrimitive.long
|
media_id = obj["id"]!!.jsonPrimitive.long
|
||||||
title = obj["name_cn"]!!.jsonPrimitive.content
|
title = obj["name_cn"]!!.jsonPrimitive.content
|
||||||
cover_url = coverUrl
|
cover_url = coverUrl
|
||||||
|
score = rating
|
||||||
summary = obj["name"]!!.jsonPrimitive.content
|
summary = obj["name"]!!.jsonPrimitive.content
|
||||||
tracking_url = obj["url"]!!.jsonPrimitive.content
|
tracking_url = obj["url"]!!.jsonPrimitive.content
|
||||||
total_episodes = totalChapters
|
total_episodes = totalChapters
|
||||||
|
|
|
@ -483,13 +483,14 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor)
|
||||||
"https://AWQO5J657S-dsn.algolia.net/1/indexes/production_media/query/"
|
"https://AWQO5J657S-dsn.algolia.net/1/indexes/production_media/query/"
|
||||||
private const val algoliaAppId = "AWQO5J657S"
|
private const val algoliaAppId = "AWQO5J657S"
|
||||||
private const val algoliaFilter =
|
private const val algoliaFilter =
|
||||||
"&facetFilters=%5B%22kind%3Amanga%22%5D&attributesToRetrieve=%5B%22synopsis%22%2C%22canonicalTitle%22%2C" +
|
"&facetFilters=%5B%22kind%3Amanga%22%5D&attributesToRetrieve=" +
|
||||||
"%22chapterCount%22%2C%22posterImage%22%2C%22" +
|
"%5B%22synopsis%22%2C%22averageRating%22%2C%22canonicalTitle%22%2C%22chapterCount%22%2C%22" +
|
||||||
"startDate%22%2C%22subtype%22%2C%22endDate%22%2C%20%22id%22%5D"
|
"posterImage%22%2C%22startDate%22%2C%22subtype%22%2C%22endDate%22%2C%20%22id%22%5D"
|
||||||
private const val algoliaFilterAnime =
|
private const val algoliaFilterAnime =
|
||||||
"&facetFilters=%5B%22kind%3Aanime%22%5D&attributesToRetrieve=%5B%22synopsis%22%2C%22canonicalTitle%22%2C" +
|
"&facetFilters=%5B%22kind%3Aanime%22%5D&attributesToRetrieve=" +
|
||||||
"%22episodeCount%22%2C%22posterImage%22%2C%22" +
|
"%5B%22synopsis%22%2C%22averageRating%22%2C%22canonicalTitle%22%2C%22episodeCount%22%2C%22" +
|
||||||
"startDate%22%2C%22subtype%22%2C%22endDate%22%2C%20%22id%22%5D"
|
"posterImage%22%2C%22startDate%22%2C%22subtype%22%2C%22endDate%22%2C%20%22id%22%5D"
|
||||||
|
|
||||||
|
|
||||||
fun mangaUrl(remoteId: Long): String {
|
fun mangaUrl(remoteId: Long): String {
|
||||||
return baseMangaUrl + remoteId
|
return baseMangaUrl + remoteId
|
||||||
|
|
|
@ -30,6 +30,7 @@ class KitsuSearchManga(obj: JsonObject) {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
private val synopsis = obj["synopsis"]?.jsonPrimitive?.contentOrNull
|
private val synopsis = obj["synopsis"]?.jsonPrimitive?.contentOrNull
|
||||||
|
private val rating = obj["averageRating"]?.jsonPrimitive?.contentOrNull?.toFloatOrNull()
|
||||||
private var startDate = obj["startDate"]?.jsonPrimitive?.contentOrNull?.let {
|
private var startDate = obj["startDate"]?.jsonPrimitive?.contentOrNull?.let {
|
||||||
val outputDf = SimpleDateFormat("yyyy-MM-dd", Locale.US)
|
val outputDf = SimpleDateFormat("yyyy-MM-dd", Locale.US)
|
||||||
outputDf.format(Date(it.toLong() * 1000))
|
outputDf.format(Date(it.toLong() * 1000))
|
||||||
|
@ -44,6 +45,7 @@ class KitsuSearchManga(obj: JsonObject) {
|
||||||
cover_url = original ?: ""
|
cover_url = original ?: ""
|
||||||
summary = synopsis ?: ""
|
summary = synopsis ?: ""
|
||||||
tracking_url = KitsuApi.mangaUrl(media_id)
|
tracking_url = KitsuApi.mangaUrl(media_id)
|
||||||
|
score = rating ?: -1f
|
||||||
publishing_status = if (endDate == null) {
|
publishing_status = if (endDate == null) {
|
||||||
"Publishing"
|
"Publishing"
|
||||||
} else {
|
} else {
|
||||||
|
@ -66,6 +68,7 @@ class KitsuSearchAnime(obj: JsonObject) {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
private val synopsis = obj["synopsis"]?.jsonPrimitive?.contentOrNull
|
private val synopsis = obj["synopsis"]?.jsonPrimitive?.contentOrNull
|
||||||
|
private val rating = obj["averageRating"]?.jsonPrimitive?.contentOrNull?.toFloatOrNull()
|
||||||
private var startDate = obj["startDate"]?.jsonPrimitive?.contentOrNull?.let {
|
private var startDate = obj["startDate"]?.jsonPrimitive?.contentOrNull?.let {
|
||||||
val outputDf = SimpleDateFormat("yyyy-MM-dd", Locale.US)
|
val outputDf = SimpleDateFormat("yyyy-MM-dd", Locale.US)
|
||||||
outputDf.format(Date(it.toLong() * 1000))
|
outputDf.format(Date(it.toLong() * 1000))
|
||||||
|
@ -80,6 +83,7 @@ class KitsuSearchAnime(obj: JsonObject) {
|
||||||
cover_url = original ?: ""
|
cover_url = original ?: ""
|
||||||
summary = synopsis ?: ""
|
summary = synopsis ?: ""
|
||||||
tracking_url = KitsuApi.animeUrl(media_id)
|
tracking_url = KitsuApi.animeUrl(media_id)
|
||||||
|
score = rating ?: -1f
|
||||||
publishing_status = if (endDate == null) {
|
publishing_status = if (endDate == null) {
|
||||||
"Publishing"
|
"Publishing"
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -20,7 +20,7 @@ class AnimeTrackSearch : AnimeTrack {
|
||||||
|
|
||||||
override var total_episodes: Int = 0
|
override var total_episodes: Int = 0
|
||||||
|
|
||||||
override var score: Float = 0f
|
override var score: Float = -1f
|
||||||
|
|
||||||
override var status: Int = 0
|
override var status: Int = 0
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ class MangaTrackSearch : MangaTrack {
|
||||||
|
|
||||||
override var total_chapters: Int = 0
|
override var total_chapters: Int = 0
|
||||||
|
|
||||||
override var score: Float = 0f
|
override var score: Float = -1f
|
||||||
|
|
||||||
override var status: Int = 0
|
override var status: Int = 0
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ import kotlinx.serialization.json.JsonObject
|
||||||
import kotlinx.serialization.json.boolean
|
import kotlinx.serialization.json.boolean
|
||||||
import kotlinx.serialization.json.contentOrNull
|
import kotlinx.serialization.json.contentOrNull
|
||||||
import kotlinx.serialization.json.float
|
import kotlinx.serialization.json.float
|
||||||
|
import kotlinx.serialization.json.floatOrNull
|
||||||
import kotlinx.serialization.json.int
|
import kotlinx.serialization.json.int
|
||||||
import kotlinx.serialization.json.jsonArray
|
import kotlinx.serialization.json.jsonArray
|
||||||
import kotlinx.serialization.json.jsonObject
|
import kotlinx.serialization.json.jsonObject
|
||||||
|
@ -130,7 +131,7 @@ class MyAnimeListApi(
|
||||||
.appendPath(id.toString())
|
.appendPath(id.toString())
|
||||||
.appendQueryParameter(
|
.appendQueryParameter(
|
||||||
"fields",
|
"fields",
|
||||||
"id,title,synopsis,num_chapters,main_picture,status,media_type,start_date",
|
"id,title,synopsis,num_chapters,mean,main_picture,status,media_type,start_date",
|
||||||
)
|
)
|
||||||
.build()
|
.build()
|
||||||
with(json) {
|
with(json) {
|
||||||
|
@ -144,6 +145,7 @@ class MyAnimeListApi(
|
||||||
title = obj["title"]!!.jsonPrimitive.content
|
title = obj["title"]!!.jsonPrimitive.content
|
||||||
summary = obj["synopsis"]?.jsonPrimitive?.content ?: ""
|
summary = obj["synopsis"]?.jsonPrimitive?.content ?: ""
|
||||||
total_chapters = obj["num_chapters"]!!.jsonPrimitive.int
|
total_chapters = obj["num_chapters"]!!.jsonPrimitive.int
|
||||||
|
score = obj["mean"]?.jsonPrimitive?.floatOrNull ?: -1f
|
||||||
cover_url =
|
cover_url =
|
||||||
obj["main_picture"]?.jsonObject?.get("large")?.jsonPrimitive?.content
|
obj["main_picture"]?.jsonObject?.get("large")?.jsonPrimitive?.content
|
||||||
?: ""
|
?: ""
|
||||||
|
@ -170,7 +172,7 @@ class MyAnimeListApi(
|
||||||
.appendPath(id.toString())
|
.appendPath(id.toString())
|
||||||
.appendQueryParameter(
|
.appendQueryParameter(
|
||||||
"fields",
|
"fields",
|
||||||
"id,title,synopsis,num_episodes,main_picture,status,media_type,start_date",
|
"id,title,synopsis,num_episodes,mean,main_picture,status,media_type,start_date",
|
||||||
)
|
)
|
||||||
.build()
|
.build()
|
||||||
with(json) {
|
with(json) {
|
||||||
|
@ -184,6 +186,7 @@ class MyAnimeListApi(
|
||||||
title = obj["title"]!!.jsonPrimitive.content
|
title = obj["title"]!!.jsonPrimitive.content
|
||||||
summary = obj["synopsis"]?.jsonPrimitive?.content ?: ""
|
summary = obj["synopsis"]?.jsonPrimitive?.content ?: ""
|
||||||
total_episodes = obj["num_episodes"]!!.jsonPrimitive.int
|
total_episodes = obj["num_episodes"]!!.jsonPrimitive.int
|
||||||
|
score = obj["mean"]?.jsonPrimitive?.floatOrNull ?: -1f
|
||||||
cover_url =
|
cover_url =
|
||||||
obj["main_picture"]?.jsonObject?.get("large")?.jsonPrimitive?.content
|
obj["main_picture"]?.jsonObject?.get("large")?.jsonPrimitive?.content
|
||||||
?: ""
|
?: ""
|
||||||
|
|
|
@ -177,6 +177,7 @@ class ShikimoriApi(
|
||||||
total_chapters = obj["chapters"]!!.jsonPrimitive.int
|
total_chapters = obj["chapters"]!!.jsonPrimitive.int
|
||||||
cover_url = baseUrl + obj["image"]!!.jsonObject["preview"]!!.jsonPrimitive.content
|
cover_url = baseUrl + obj["image"]!!.jsonObject["preview"]!!.jsonPrimitive.content
|
||||||
summary = ""
|
summary = ""
|
||||||
|
score = obj["score"]!!.jsonPrimitive.float
|
||||||
tracking_url = baseUrl + obj["url"]!!.jsonPrimitive.content
|
tracking_url = baseUrl + obj["url"]!!.jsonPrimitive.content
|
||||||
publishing_status = obj["status"]!!.jsonPrimitive.content
|
publishing_status = obj["status"]!!.jsonPrimitive.content
|
||||||
publishing_type = obj["kind"]!!.jsonPrimitive.content
|
publishing_type = obj["kind"]!!.jsonPrimitive.content
|
||||||
|
@ -191,6 +192,7 @@ class ShikimoriApi(
|
||||||
total_episodes = obj["episodes"]!!.jsonPrimitive.int
|
total_episodes = obj["episodes"]!!.jsonPrimitive.int
|
||||||
cover_url = baseUrl + obj["image"]!!.jsonObject["preview"]!!.jsonPrimitive.content
|
cover_url = baseUrl + obj["image"]!!.jsonObject["preview"]!!.jsonPrimitive.content
|
||||||
summary = ""
|
summary = ""
|
||||||
|
score = obj["score"]!!.jsonPrimitive.float
|
||||||
tracking_url = baseUrl + obj["url"]!!.jsonPrimitive.content
|
tracking_url = baseUrl + obj["url"]!!.jsonPrimitive.content
|
||||||
publishing_status = obj["status"]!!.jsonPrimitive.content
|
publishing_status = obj["status"]!!.jsonPrimitive.content
|
||||||
publishing_type = obj["kind"]!!.jsonPrimitive.content
|
publishing_type = obj["kind"]!!.jsonPrimitive.content
|
||||||
|
|
Loading…
Reference in a new issue