add some info and improve search func

This commit is contained in:
Eddy 2022-10-23 00:19:55 +02:00
parent d7a3f2c1ce
commit c18ecfc3c3

View file

@ -69,8 +69,8 @@ class NekosamaProvider : MainAPI() {
// Sorted by the best title matching // Sorted by the best title matching
val titlesSorted = titles.sortedBy { it -> val titlesSorted = titles.sortedBy { it ->
-FuzzySearch.ratio( -FuzzySearch.ratio(
it?.take(query.length + nCharQuery), it?.lowercase()?.take(query.length + nCharQuery),
query query.lowercase()
) )
} }
return titlesSorted.elementAt(0) return titlesSorted.elementAt(0)
@ -88,8 +88,9 @@ class NekosamaProvider : MainAPI() {
this.sortedBy { this.sortedBy {
val bestTitleMatching = it.titleObtainedBysortByQuery(query) val bestTitleMatching = it.titleObtainedBysortByQuery(query)
-FuzzySearch.ratio( -FuzzySearch.ratio(
bestTitleMatching?.take(query.length + nCharQuery) ?: bestTitleMatching, bestTitleMatching?.lowercase()?.take(query.length + nCharQuery)
query ?: bestTitleMatching?.lowercase(),
query.lowercase()
) )
} }
} }
@ -104,7 +105,10 @@ class NekosamaProvider : MainAPI() {
this.sortedBy { this.sortedBy {
val name = it.name val name = it.name
-FuzzySearch.ratio(name.take(query.length + nCharQuery), query) -FuzzySearch.ratio(
name.lowercase().take(query.length + nCharQuery),
query.lowercase()
)
} }
} }
} }
@ -140,13 +144,14 @@ class NekosamaProvider : MainAPI() {
when (type) { when (type) {
"m0v1e", "special" -> ( "m0v1e", "special" -> (
listofResults.add(newMovieSearchResponse( // réponse du film qui sera ajoutée à la liste apmap qui sera ensuite return listofResults.add(newAnimeSearchResponse( // réponse du film qui sera ajoutée à la liste apmap qui sera ensuite return
title, title,
href, href,
TvType.AnimeMovie, TvType.AnimeMovie,
false false
) { ) {
this.posterUrl = mediaPoster this.posterUrl = mediaPoster
this.dubStatus = EnumSet.of(dubStatus)
} }
)) ))
null, "tv", "ova", "" -> ( null, "tv", "ova", "" -> (
@ -392,13 +397,14 @@ class NekosamaProvider : MainAPI() {
} else // a movie } else // a movie
{ {
return newMovieSearchResponse( return newAnimeSearchResponse(
title, title,
link, link,
TvType.AnimeMovie, TvType.AnimeMovie,
false, false,
) { ) {
this.posterUrl = posterUrl this.posterUrl = posterUrl
this.dubStatus = EnumSet.of(dubStatus)
} }
} }
} }