Add authors/artists to MAL search results (#2833)

(cherry picked from commit 51b3ab3fd19bdf6a7c3bd2085104392a9c412622)

# Conflicts:
#	CHANGELOG.md
This commit is contained in:
MajorTanya
2026-01-07 09:16:56 +01:00
committed by Jobobby04
parent 89a521b836
commit 46c1c6463a
2 changed files with 26 additions and 1 deletions
@@ -254,6 +254,13 @@ class MyAnimeListApi(
publishing_status = searchItem.status.replace("_", " ")
publishing_type = searchItem.mediaType.replace("_", " ")
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() }
}
}
@@ -280,7 +287,7 @@ class MyAnimeListApi(
private const val BASE_API_URL = "https://api.myanimelist.net/v2"
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
@@ -18,8 +18,26 @@ data class MALManga(
val mediaType: String,
@SerialName("start_date")
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
data class MALMangaCovers(
val large: String = "",