mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-10 12:47:26 +01:00
Use user preferred title language in Anilist (#5758)
* Use user preferred title language in Anilist Since Anilist is only used by authenticated users, the title language can be set using the `userPreferred` field (defaults to romaji) Changed wherever `title>romaji` was being used. Shouldn't have missed any. `userPreferred` is also available for Staff and Character but not relevant to Tachiyomi for now. Users might need to go Logout and log back in on Anilist to see the change. Actual setting can be found at https://anilist.co/settings/media closes https://github.com/tachiyomiorg/tachiyomi/issues/5757 * correct title in anilist model indicates the fact that userPreferred title is used * convert forgotten `type` to `format` as well leads to NPE when using `findLibManga`. missed one query in https://github.com/tachiyomiorg/tachiyomi/pull/5741
This commit is contained in:
parent
4eaccc966e
commit
708e71a35a
@ -110,7 +110,7 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
||||
|media(search: ${'$'}query, type: MANGA, format_not_in: [NOVEL]) {
|
||||
|id
|
||||
|title {
|
||||
|romaji
|
||||
|userPreferred
|
||||
|}
|
||||
|coverImage {
|
||||
|large
|
||||
@ -175,12 +175,12 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
||||
|media {
|
||||
|id
|
||||
|title {
|
||||
|romaji
|
||||
|userPreferred
|
||||
|}
|
||||
|coverImage {
|
||||
|large
|
||||
|}
|
||||
|type
|
||||
|format
|
||||
|status
|
||||
|chapters
|
||||
|description
|
||||
@ -264,7 +264,7 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
||||
private fun jsonToALManga(struct: JsonObject): ALManga {
|
||||
return ALManga(
|
||||
struct["id"]!!.jsonPrimitive.int,
|
||||
struct["title"]!!.jsonObject["romaji"]!!.jsonPrimitive.content,
|
||||
struct["title"]!!.jsonObject["userPreferred"]!!.jsonPrimitive.content,
|
||||
struct["coverImage"]!!.jsonObject["large"]!!.jsonPrimitive.content,
|
||||
struct["description"]!!.jsonPrimitive.contentOrNull,
|
||||
struct["format"]!!.jsonPrimitive.content.replace("_", "-"),
|
||||
|
@ -10,7 +10,7 @@ import java.util.Locale
|
||||
|
||||
data class ALManga(
|
||||
val media_id: Int,
|
||||
val title_romaji: String,
|
||||
val title_user_pref: String,
|
||||
val image_url_lge: String,
|
||||
val description: String?,
|
||||
val format: String,
|
||||
@ -21,7 +21,7 @@ data class ALManga(
|
||||
|
||||
fun toTrack() = TrackSearch.create(TrackManager.ANILIST).apply {
|
||||
media_id = this@ALManga.media_id
|
||||
title = title_romaji
|
||||
title = title_user_pref
|
||||
total_chapters = this@ALManga.total_chapters
|
||||
cover_url = image_url_lge
|
||||
summary = description ?: ""
|
||||
|
Loading…
Reference in New Issue
Block a user