Add authors/artists to MAL search results (#2833)
This commit is contained in:
@@ -13,6 +13,7 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co
|
|||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
### Added
|
### Added
|
||||||
- Automatically remove downloads on Suwayomi after reading, configurable via extension settings ([@cpiber](https://github.com/cpiber)) ([#2673](https://github.com/mihonapp/mihon/pull/2673))
|
- Automatically remove downloads on Suwayomi after reading, configurable via extension settings ([@cpiber](https://github.com/cpiber)) ([#2673](https://github.com/mihonapp/mihon/pull/2673))
|
||||||
|
- Display author & artist name in MAL search results ([@MajorTanya](https://github.com/MajorTanya)) ([#2833](https://github.com/mihonapp/mihon/pull/2833))
|
||||||
|
|
||||||
### Improved
|
### Improved
|
||||||
- Minimize memory usage by reducing in-memory cover cache size ([@Lolle2000la](https://github.com/Lolle2000la)) ([#2266](https://github.com/mihonapp/mihon/pull/2266))
|
- Minimize memory usage by reducing in-memory cover cache size ([@Lolle2000la](https://github.com/Lolle2000la)) ([#2266](https://github.com/mihonapp/mihon/pull/2266))
|
||||||
|
|||||||
@@ -217,6 +217,13 @@ class MyAnimeListApi(
|
|||||||
publishing_status = searchItem.status.replace("_", " ")
|
publishing_status = searchItem.status.replace("_", " ")
|
||||||
publishing_type = searchItem.mediaType.replace("_", " ")
|
publishing_type = searchItem.mediaType.replace("_", " ")
|
||||||
start_date = searchItem.startDate ?: ""
|
start_date = searchItem.startDate ?: ""
|
||||||
|
artists = searchItem.authors
|
||||||
|
.filter { authorNode -> authorNode.role == "Art" }
|
||||||
|
.mapNotNull { authorNode -> authorNode.node.getFullName() }
|
||||||
|
authors = searchItem.authors
|
||||||
|
// count all with "Story" or "Story & Art" as authors, like is done for library entries
|
||||||
|
.filter { authorNode -> authorNode.role.contains("Story") }
|
||||||
|
.mapNotNull { authorNode -> authorNode.node.getFullName() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,7 +250,7 @@ class MyAnimeListApi(
|
|||||||
private const val BASE_API_URL = "https://api.myanimelist.net/v2"
|
private const val BASE_API_URL = "https://api.myanimelist.net/v2"
|
||||||
|
|
||||||
private const val SEARCH_FIELDS =
|
private const val SEARCH_FIELDS =
|
||||||
"id,title,synopsis,num_chapters,mean,main_picture,status,media_type,start_date"
|
"id,title,synopsis,num_chapters,mean,main_picture,status,media_type,start_date,authors{first_name,last_name}"
|
||||||
|
|
||||||
private const val LIST_PAGINATION_AMOUNT = 250
|
private const val LIST_PAGINATION_AMOUNT = 250
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,26 @@ data class MALManga(
|
|||||||
val mediaType: String,
|
val mediaType: String,
|
||||||
@SerialName("start_date")
|
@SerialName("start_date")
|
||||||
val startDate: String?,
|
val startDate: String?,
|
||||||
|
val authors: List<MALAuthorNode>,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class MALAuthorNode(
|
||||||
|
val node: MALAuthor,
|
||||||
|
val role: String,
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class MALAuthor(
|
||||||
|
val id: Int,
|
||||||
|
@SerialName("first_name")
|
||||||
|
val firstName: String,
|
||||||
|
@SerialName("last_name")
|
||||||
|
val lastName: String,
|
||||||
|
) {
|
||||||
|
fun getFullName(): String? = "$firstName $lastName".trim().ifBlank { null }
|
||||||
|
}
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class MALMangaCovers(
|
data class MALMangaCovers(
|
||||||
val large: String = "",
|
val large: String = "",
|
||||||
|
|||||||
Reference in New Issue
Block a user