feat: add BookOasis document reader and text settings
This commit is contained in:
@@ -290,7 +290,13 @@ class LocalSource(
|
||||
val chapters = fileSystem.getFilesInMangaDirectory(manga.url)
|
||||
// Only keep supported formats
|
||||
.filterNot { it.name.orEmpty().startsWith('.') }
|
||||
.filter { it.isDirectory || Archive.isSupported(it) || it.extension.equals("epub", true) }
|
||||
.filter {
|
||||
it.isDirectory ||
|
||||
Archive.isSupported(it) ||
|
||||
it.extension.equals("epub", true) ||
|
||||
it.extension.equals("pdf", true) ||
|
||||
it.extension.equals("txt", true)
|
||||
}
|
||||
.map { chapterFile ->
|
||||
SChapter.create().apply {
|
||||
url = "${manga.url}/${chapterFile.name}"
|
||||
@@ -385,6 +391,9 @@ class LocalSource(
|
||||
entry?.let { coverManager.update(manga, epub.getInputStream(it)!!) }
|
||||
}
|
||||
}
|
||||
is Format.Pdf,
|
||||
is Format.Text,
|
||||
-> null
|
||||
}
|
||||
} catch (e: Throwable) {
|
||||
logcat(LogPriority.ERROR, e) { "Error updating cover for ${manga.title}" }
|
||||
|
||||
@@ -8,6 +8,8 @@ sealed interface Format {
|
||||
data class Directory(val file: UniFile) : Format
|
||||
data class Archive(val file: UniFile) : Format
|
||||
data class Epub(val file: UniFile) : Format
|
||||
data class Pdf(val file: UniFile) : Format
|
||||
data class Text(val file: UniFile) : Format
|
||||
|
||||
class UnknownFormatException : Exception()
|
||||
|
||||
@@ -16,6 +18,8 @@ sealed interface Format {
|
||||
fun valueOf(file: UniFile) = when {
|
||||
file.isDirectory -> Directory(file)
|
||||
file.extension.equals("epub", true) -> Epub(file)
|
||||
file.extension.equals("pdf", true) -> Pdf(file)
|
||||
file.extension.equals("txt", true) -> Text(file)
|
||||
isArchiveSupported(file) -> Archive(file)
|
||||
else -> throw UnknownFormatException()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user