Update Anilist API search to return 50 results (#1657)

* Update Anilist API search to return 50 results

This will help alleviate not being able to find manga with generic names
such as Monster

* Add description to Anilist search dialogue
This commit is contained in:
Ken Swenson 2018-10-27 13:02:10 -04:00 committed by inorichi
parent 974891a085
commit ae6d052978

View File

@ -90,7 +90,7 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
fun search(search: String): Observable<List<TrackSearch>> { fun search(search: String): Observable<List<TrackSearch>> {
val query = """ val query = """
query Search(${'$'}query: String) { query Search(${'$'}query: String) {
Page (perPage: 25) { Page (perPage: 50) {
media(search: ${'$'}query, type: MANGA, format_not_in: [NOVEL]) { media(search: ${'$'}query, type: MANGA, format_not_in: [NOVEL]) {
id id
title { title {
@ -102,6 +102,7 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
type type
status status
chapters chapters
description
startDate { startDate {
year year
month month
@ -160,6 +161,7 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
type type
status status
chapters chapters
description
startDate { startDate {
year year
month month
@ -245,7 +247,7 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
fun jsonToALManga(struct: JsonObject): ALManga{ fun jsonToALManga(struct: JsonObject): ALManga{
return ALManga(struct["id"].asInt, struct["title"]["romaji"].asString, struct["coverImage"]["large"].asString, return ALManga(struct["id"].asInt, struct["title"]["romaji"].asString, struct["coverImage"]["large"].asString,
null, struct["type"].asString, struct["status"].asString, struct["description"].nullString.orEmpty(), struct["type"].asString, struct["status"].asString,
struct["startDate"]["year"].nullString.orEmpty() + struct["startDate"]["month"].nullString.orEmpty() struct["startDate"]["year"].nullString.orEmpty() + struct["startDate"]["month"].nullString.orEmpty()
+ struct["startDate"]["day"].nullString.orEmpty(), struct["chapters"].nullInt ?: 0) + struct["startDate"]["day"].nullString.orEmpty(), struct["chapters"].nullInt ?: 0)
} }