mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-26 06:43:45 +03:00
Fix local covers
This commit is contained in:
parent
9efbc4ca0f
commit
9df85a6d47
4 changed files with 13 additions and 15 deletions
|
@ -53,7 +53,6 @@ class LocalAnimeSource(private val context: Context) : AnimeCatalogueSource {
|
|||
if (cover == null) {
|
||||
cover = File("${dir.absolutePath}/${anime.url}", COVER_NAME)
|
||||
}
|
||||
if (!cover.exists()) {
|
||||
// It might not exist if using the external SD card
|
||||
cover.parentFile?.mkdirs()
|
||||
input.use {
|
||||
|
@ -61,7 +60,6 @@ class LocalAnimeSource(private val context: Context) : AnimeCatalogueSource {
|
|||
input.copyTo(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
return cover
|
||||
}
|
||||
|
||||
|
@ -244,7 +242,7 @@ class LocalAnimeSource(private val context: Context) : AnimeCatalogueSource {
|
|||
private fun getFormat(file: File) = with(file) {
|
||||
when {
|
||||
isDirectory -> Format.Directory(this)
|
||||
SUPPORTED_FILE_TYPES.contains(extension.lowercase(Locale.ENGLISH)) -> Format.Anime(this)
|
||||
isSupportedFile(extension) -> Format.Anime(this.parentFile!!)
|
||||
else -> throw Exception(context.getString(R.string.local_invalid_episode_format))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,6 @@ class LocalSource(private val context: Context) : CatalogueSource {
|
|||
if (cover == null) {
|
||||
cover = File("${dir.absolutePath}/${manga.url}", COVER_NAME)
|
||||
}
|
||||
if (!cover.exists()) {
|
||||
// It might not exist if using the external SD card
|
||||
cover.parentFile?.mkdirs()
|
||||
input.use {
|
||||
|
@ -64,7 +63,6 @@ class LocalSource(private val context: Context) : CatalogueSource {
|
|||
input.copyTo(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
return cover
|
||||
}
|
||||
|
||||
|
|
|
@ -394,6 +394,7 @@ class AnimePresenter(
|
|||
if (anime.isLocal()) {
|
||||
LocalAnimeSource.updateCover(context, anime, it)
|
||||
anime.updateCoverLastModified(db)
|
||||
coverCache.clearMemoryCache()
|
||||
} else if (anime.favorite) {
|
||||
coverCache.setCustomCoverToCache(anime, it)
|
||||
anime.updateCoverLastModified(db)
|
||||
|
|
|
@ -388,6 +388,7 @@ class MangaPresenter(
|
|||
if (manga.isLocal()) {
|
||||
LocalSource.updateCover(context, manga, it)
|
||||
manga.updateCoverLastModified(db)
|
||||
coverCache.clearMemoryCache()
|
||||
} else if (manga.favorite) {
|
||||
coverCache.setCustomCoverToCache(manga, it)
|
||||
manga.updateCoverLastModified(db)
|
||||
|
|
Loading…
Reference in a new issue