mirror of
https://github.com/recloudstream/cloudstream-extensions-multilingual.git
synced 2024-08-15 03:15:14 +00:00
add some info and improve search func
This commit is contained in:
parent
d7a3f2c1ce
commit
c18ecfc3c3
1 changed files with 16 additions and 10 deletions
|
@ -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()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,7 +126,7 @@ class NekosamaProvider : MainAPI() {
|
||||||
listOf(
|
listOf(
|
||||||
"$mainUrl/animes-search-vf.json" to "(VF) ",
|
"$mainUrl/animes-search-vf.json" to "(VF) ",
|
||||||
"$mainUrl/animes-search-vostfr.json" to "(Vostfr) "
|
"$mainUrl/animes-search-vostfr.json" to "(Vostfr) "
|
||||||
).apmap {(url, version) ->
|
).apmap { (url, version) ->
|
||||||
val dubStatus = when (!version.isNullOrBlank()) {
|
val dubStatus = when (!version.isNullOrBlank()) {
|
||||||
version.contains("VF") -> DubStatus.Dubbed
|
version.contains("VF") -> DubStatus.Dubbed
|
||||||
version.contains("Vostfr") -> DubStatus.Subbed
|
version.contains("Vostfr") -> DubStatus.Subbed
|
||||||
|
@ -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", "" -> (
|
||||||
|
@ -232,10 +237,10 @@ class NekosamaProvider : MainAPI() {
|
||||||
val infosList =
|
val infosList =
|
||||||
document.selectFirst("div#anime-info-list")?.text()
|
document.selectFirst("div#anime-info-list")?.text()
|
||||||
val isinfosList = !infosList.isNullOrBlank()
|
val isinfosList = !infosList.isNullOrBlank()
|
||||||
var year:Int?=null
|
var year: Int? = null
|
||||||
if (isinfosList) {
|
if (isinfosList) {
|
||||||
if (infosList!!.contains("movie")) mediaType = TvType.AnimeMovie
|
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()
|
val description = document.selectFirst("div.synopsis > p")?.text()
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue