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
|
@ -1,6 +1,8 @@
|
|||
package ani.dantotsu.parsers
|
||||
|
||||
import android.app.Application
|
||||
import ani.dantotsu.download.DownloadCompat.Companion.loadChaptersCompat
|
||||
import ani.dantotsu.download.DownloadCompat.Companion.loadImagesCompat
|
||||
import ani.dantotsu.download.DownloadsManager
|
||||
import ani.dantotsu.download.DownloadsManager.Companion.getSubDirectory
|
||||
import ani.dantotsu.media.MediaNameAdapter
|
||||
|
@ -41,8 +43,12 @@ class OfflineMangaParser : MangaParser() {
|
|||
chapters.add(chapter)
|
||||
}
|
||||
}
|
||||
chapters.sortBy { MediaNameAdapter.findChapterNumber(it.number) }
|
||||
return chapters
|
||||
return if (chapters.isNotEmpty()) {
|
||||
chapters.sortBy { MediaNameAdapter.findChapterNumber(it.number) }
|
||||
chapters
|
||||
} else {
|
||||
loadChaptersCompat(mangaLink, extra, sManga)
|
||||
}
|
||||
}
|
||||
return emptyList()
|
||||
}
|
||||
|
@ -60,26 +66,32 @@ class OfflineMangaParser : MangaParser() {
|
|||
images.add(image)
|
||||
}
|
||||
}
|
||||
images.sortBy { image ->
|
||||
val matchResult = imageNumberRegex.find(image.url.url)
|
||||
matchResult?.groups?.get(1)?.value?.toIntOrNull() ?: Int.MAX_VALUE
|
||||
}
|
||||
for (image in images) {
|
||||
Logger.log("imageNumber: ${image.url.url}")
|
||||
}
|
||||
return images
|
||||
return if (images.isNotEmpty()) {
|
||||
images.sortBy { image ->
|
||||
val matchResult = imageNumberRegex.find(image.url.url)
|
||||
matchResult?.groups?.get(1)?.value?.toIntOrNull() ?: Int.MAX_VALUE
|
||||
}
|
||||
images
|
||||
} else {
|
||||
loadImagesCompat(chapterLink, sChapter)
|
||||
}
|
||||
}
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
override suspend fun search(query: String): List<ShowResponse> {
|
||||
val titles = downloadManager.mangaDownloadedTypes.map { it.title }.distinct()
|
||||
val returnTitles: MutableList<String> = mutableListOf()
|
||||
val titles = downloadManager.mangaDownloadedTypes.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)
|
||||
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) {
|
||||
returnList.add(ShowResponse(title, title, title))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue