mirror of
https://github.com/mihonapp/mihon.git
synced 2025-06-29 04:27:51 +02:00
Use unified storage location for local source
This commit is contained in:
@ -73,7 +73,7 @@ actual class LocalSource(
|
||||
override suspend fun getLatestUpdates(page: Int) = getSearchManga(page, "", LATEST_FILTERS)
|
||||
|
||||
override suspend fun getSearchManga(page: Int, query: String, filters: FilterList): MangasPage {
|
||||
val baseDirsFiles = fileSystem.getFilesInBaseDirectories()
|
||||
val baseDirFiles = fileSystem.getFilesInBaseDirectory()
|
||||
val lastModifiedLimit by lazy {
|
||||
if (filters === LATEST_FILTERS) {
|
||||
System.currentTimeMillis() - LATEST_THRESHOLD
|
||||
@ -81,7 +81,7 @@ actual class LocalSource(
|
||||
0L
|
||||
}
|
||||
}
|
||||
var mangaDirs = baseDirsFiles
|
||||
var mangaDirs = baseDirFiles
|
||||
// Filter out files that are hidden and is not a folder
|
||||
.filter { it.isDirectory && !it.name.startsWith('.') }
|
||||
.distinctBy { it.name }
|
||||
@ -308,9 +308,8 @@ actual class LocalSource(
|
||||
|
||||
fun getFormat(chapter: SChapter): Format {
|
||||
try {
|
||||
return fileSystem.getBaseDirectories()
|
||||
.map { dir -> File(dir, chapter.url) }
|
||||
.find { it.exists() }
|
||||
return File(fileSystem.getBaseDirectory(), chapter.url)
|
||||
.takeIf { it.exists() }
|
||||
?.let(Format.Companion::valueOf)
|
||||
?: throw Exception(context.stringResource(MR.strings.chapter_not_found))
|
||||
} catch (e: Format.UnknownFormatException) {
|
||||
|
Reference in New Issue
Block a user