mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-18 21:49:19 +01:00
Fix storing covers for local manga (#6127)
getCoverFile only returns a cover if it already exists, meaning the block of code to write it from the inputstream never executes. If getCoverFile returns null, then use previous behaviour of setting it to cover.jpg so that if the file doesn't exist it's created
This commit is contained in:
parent
58a871c8cc
commit
f0a5557e60
@ -39,6 +39,7 @@ class LocalSource(private val context: Context) : CatalogueSource {
|
||||
|
||||
private val SUPPORTED_ARCHIVE_TYPES = setOf("zip", "rar", "cbr", "cbz", "epub")
|
||||
|
||||
private const val COVER_NAME = "cover.jpg"
|
||||
private val LATEST_THRESHOLD = TimeUnit.MILLISECONDS.convert(7, TimeUnit.DAYS)
|
||||
|
||||
fun updateCover(context: Context, manga: SManga, input: InputStream): File? {
|
||||
@ -47,9 +48,11 @@ class LocalSource(private val context: Context) : CatalogueSource {
|
||||
input.close()
|
||||
return null
|
||||
}
|
||||
val cover = getCoverFile(File("${dir.absolutePath}/${manga.url}"))
|
||||
|
||||
if (cover != null && cover.exists()) {
|
||||
var cover = getCoverFile(File("${dir.absolutePath}/${manga.url}"))
|
||||
if (cover == null) {
|
||||
cover = File("${dir.absolutePath}/${manga.url}", COVER_NAME)
|
||||
}
|
||||
if (cover != null && !cover.exists()) {
|
||||
// It might not exist if using the external SD card
|
||||
cover.parentFile?.mkdirs()
|
||||
input.use {
|
||||
|
Loading…
Reference in New Issue
Block a user