Add ID search workaround for MAL tracking
This commit is contained in:
parent
3df98d576e
commit
a49adbd09c
2 changed files with 7 additions and 1 deletions
|
@ -76,6 +76,12 @@ class MyAnimeList(private val context: Context, id: Int) : TrackService(id) {
|
|||
}
|
||||
|
||||
override fun search(query: String): Observable<List<TrackSearch>> {
|
||||
if (query.startsWith("my:")) {
|
||||
query.substringAfter("my:").toIntOrNull()?.let { id ->
|
||||
return runAsObservable({ listOf(api.getMangaDetails(id)) })
|
||||
}
|
||||
}
|
||||
|
||||
return runAsObservable({ api.search(query) })
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ class MyAnimeListApi(private val client: OkHttpClient, interceptor: MyAnimeListI
|
|||
}
|
||||
}
|
||||
|
||||
private suspend fun getMangaDetails(id: Int): TrackSearch {
|
||||
suspend fun getMangaDetails(id: Int): TrackSearch {
|
||||
return withContext(Dispatchers.IO) {
|
||||
val url = "$baseApiUrl/manga".toUri().buildUpon()
|
||||
.appendPath(id.toString())
|
||||
|
|
Reference in a new issue