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
1 changed files with 16 additions and 10 deletions

View File

@ -69,8 +69,8 @@ class NekosamaProvider : MainAPI() {
// Sorted by the best title matching
val titlesSorted = titles.sortedBy { it ->
-FuzzySearch.ratio(
it?.take(query.length + nCharQuery),
query
it?.lowercase()?.take(query.length + nCharQuery),
query.lowercase()
)
}
return titlesSorted.elementAt(0)
@ -88,8 +88,9 @@ class NekosamaProvider : MainAPI() {
this.sortedBy {
val bestTitleMatching = it.titleObtainedBysortByQuery(query)
-FuzzySearch.ratio(
bestTitleMatching?.take(query.length + nCharQuery) ?: bestTitleMatching,
query
bestTitleMatching?.lowercase()?.take(query.length + nCharQuery)
?: bestTitleMatching?.lowercase(),
query.lowercase()
)
}
}
@ -104,7 +105,10 @@ class NekosamaProvider : MainAPI() {
this.sortedBy {
val name = it.name
-FuzzySearch.ratio(name.take(query.length + nCharQuery), query)
-FuzzySearch.ratio(
name.lowercase().take(query.length + nCharQuery),
query.lowercase()
)
}
}
}
@ -122,7 +126,7 @@ class NekosamaProvider : MainAPI() {
listOf(
"$mainUrl/animes-search-vf.json" to "(VF) ",
"$mainUrl/animes-search-vostfr.json" to "(Vostfr) "
).apmap {(url, version) ->
).apmap { (url, version) ->
val dubStatus = when (!version.isNullOrBlank()) {
version.contains("VF") -> DubStatus.Dubbed
version.contains("Vostfr") -> DubStatus.Subbed
@ -140,13 +144,14 @@ class NekosamaProvider : MainAPI() {
when (type) {
"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,
href,
TvType.AnimeMovie,
false
) {
this.posterUrl = mediaPoster
this.dubStatus = EnumSet.of(dubStatus)
}
))
null, "tv", "ova", "" -> (
@ -232,10 +237,10 @@ class NekosamaProvider : MainAPI() {
val infosList =
document.selectFirst("div#anime-info-list")?.text()
val isinfosList = !infosList.isNullOrBlank()
var year:Int?=null
var year: Int? = null
if (isinfosList) {
if (infosList!!.contains("movie")) mediaType = TvType.AnimeMovie
year =regexYear.find(infosList)!!.groupValues.get(1).toInt()
year = regexYear.find(infosList)!!.groupValues.get(1).toInt()
}
val description = document.selectFirst("div.synopsis > p")?.text()
@ -392,13 +397,14 @@ class NekosamaProvider : MainAPI() {
} else // a movie
{
return newMovieSearchResponse(
return newAnimeSearchResponse(
title,
link,
TvType.AnimeMovie,
false,
) {
this.posterUrl = posterUrl
this.dubStatus = EnumSet.of(dubStatus)
}
}
}