Minor cleanup

This commit is contained in:
Aria Moradi
2021-09-19 00:59:04 +04:30
parent f1a077dc2f
commit 6a949fc851
2 changed files with 9 additions and 11 deletions

View File

@@ -14,7 +14,7 @@ const val MainClass = "suwayomi.tachidesk.MainKt"
// should be bumped with each stable release
val tachideskVersion = System.getenv("ProductVersion") ?: "v0.5.1"
val webUIRevisionTag = System.getenv("WebUIRevision") ?: "r803"
val webUIRevisionTag = System.getenv("WebUIRevision") ?: "r804"
// counts commits on the master branch
val tachideskRevision = runCatching {

View File

@@ -2,6 +2,8 @@ package eu.kanade.tachiyomi.source.local
import com.github.junrar.Archive
import eu.kanade.tachiyomi.source.local.FileSystemInterceptor.fakeUrlFrom
import eu.kanade.tachiyomi.source.local.Format.Directory
import eu.kanade.tachiyomi.source.local.Format.Zip
import eu.kanade.tachiyomi.source.local.LocalSource.Format.Directory
import eu.kanade.tachiyomi.source.local.LocalSource.Format.Epub
import eu.kanade.tachiyomi.source.local.LocalSource.Format.Rar
@@ -342,20 +344,16 @@ class LocalSource : HttpSource() {
throw Exception("Chapter not found")
}
private fun getFormat(file: File): Format {
return with(file) {
private fun getFormat(file: File): Format = with(file) {
when {
isDirectory -> Format.Directory(file)
extension.equals("zip", true) -> Format.Zip(file)
extension.equals("cbz", true) -> Format.Zip(file)
extension.equals("rar", true) -> Format.Rar(file)
extension.equals("cbr", true) -> Format.Rar(file)
extension.equals("epub", true) -> Format.Epub(file)
isDirectory -> Format.Directory(this)
extension.equals("zip", true) || extension.equals("cbz", true) -> Format.Zip(this)
extension.equals("rar", true) || extension.equals("cbr", true) -> Format.Rar(this)
extension.equals("epub", true) -> Format.Epub(this)
else -> throw Exception("Invalid chapter format")
}
}
}
private fun updateCover(chapter: SChapter, manga: SManga): File? {
return when (val format = getFormat(chapter)) {