fix: allow deprecated media to be played
This commit is contained in:
parent
3c46c21a25
commit
3622d91886
12 changed files with 647 additions and 103 deletions
|
@ -5,6 +5,7 @@ import ani.dantotsu.download.DownloadsManager
|
|||
import ani.dantotsu.download.DownloadsManager.Companion.getSubDirectory
|
||||
import ani.dantotsu.media.MediaNameAdapter
|
||||
import ani.dantotsu.media.MediaType
|
||||
import ani.dantotsu.util.Logger
|
||||
import me.xdrop.fuzzywuzzy.FuzzySearch
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
|
@ -48,13 +49,16 @@ class OfflineNovelParser : NovelParser() {
|
|||
}
|
||||
|
||||
override suspend fun search(query: String): List<ShowResponse> {
|
||||
val titles = downloadManager.novelDownloadedTypes.map { it.title }.distinct()
|
||||
val returnTitles: MutableList<String> = mutableListOf()
|
||||
val titles = downloadManager.novelDownloadedTypes.map { it.titleName }.distinct()
|
||||
val returnTitlesPair: MutableList<Pair<String, Int>> = mutableListOf()
|
||||
for (title in titles) {
|
||||
if (FuzzySearch.ratio(title.lowercase(), query.lowercase()) > 80) {
|
||||
returnTitles.add(title)
|
||||
Logger.log("Comparing $title to $query")
|
||||
val score = FuzzySearch.ratio(title.lowercase(), query.lowercase())
|
||||
if (score > 80) {
|
||||
returnTitlesPair.add(Pair(title, score))
|
||||
}
|
||||
}
|
||||
val returnTitles = returnTitlesPair.sortedByDescending { it.second }.map { it.first }
|
||||
val returnList: MutableList<ShowResponse> = mutableListOf()
|
||||
for (title in returnTitles) {
|
||||
//need to search the subdirectories for the ShowResponses
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue