mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-20 05:59:17 +01:00
Fix coil key for manga with same thumbnail
Since we're using the same thumbnail url for all md entries right now
This commit is contained in:
parent
627ea5fe33
commit
3ad24840a3
@ -71,7 +71,7 @@ class CoverCache(val context: Context) {
|
|||||||
val db = Injekt.get<DatabaseHelper>()
|
val db = Injekt.get<DatabaseHelper>()
|
||||||
var deletedSize = 0L
|
var deletedSize = 0L
|
||||||
val urls = db.getLibraryMangas().executeOnIO().mapNotNull {
|
val urls = db.getLibraryMangas().executeOnIO().mapNotNull {
|
||||||
it.thumbnail_url?.let { url -> return@mapNotNull it.key() }
|
it.thumbnail_url?.let { url -> return@mapNotNull DiskUtil.hashKeyForDisk(url) }
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
val files = cacheDir.listFiles()?.iterator() ?: return@launch
|
val files = cacheDir.listFiles()?.iterator() ?: return@launch
|
||||||
@ -200,17 +200,14 @@ class CoverCache(val context: Context) {
|
|||||||
* @return cover image.
|
* @return cover image.
|
||||||
*/
|
*/
|
||||||
fun getCoverFile(manga: Manga): File {
|
fun getCoverFile(manga: Manga): File {
|
||||||
|
val hashKey = DiskUtil.hashKeyForDisk((manga.thumbnail_url.orEmpty()))
|
||||||
return if (manga.favorite) {
|
return if (manga.favorite) {
|
||||||
File(cacheDir, manga.key())
|
File(cacheDir, hashKey)
|
||||||
} else {
|
} else {
|
||||||
getOnlineCoverFile(manga)
|
File(onlineCoverDirectory, hashKey)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getOnlineCoverFile(manga: Manga): File {
|
|
||||||
return File(onlineCoverDirectory, manga.key())
|
|
||||||
}
|
|
||||||
|
|
||||||
fun deleteFromCache(name: String?) {
|
fun deleteFromCache(name: String?) {
|
||||||
if (name.isNullOrEmpty()) return
|
if (name.isNullOrEmpty()) return
|
||||||
val file = getCoverFile(MangaImpl().apply { thumbnail_url = name })
|
val file = getCoverFile(MangaImpl().apply { thumbnail_url = name })
|
||||||
|
@ -5,7 +5,6 @@ import eu.kanade.tachiyomi.R
|
|||||||
import eu.kanade.tachiyomi.source.SourceManager
|
import eu.kanade.tachiyomi.source.SourceManager
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
||||||
import eu.kanade.tachiyomi.util.storage.DiskUtil
|
|
||||||
import tachiyomi.source.model.MangaInfo
|
import tachiyomi.source.model.MangaInfo
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
@ -190,7 +189,7 @@ interface Manga : SManga {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun key(): String {
|
fun key(): String {
|
||||||
return DiskUtil.hashKeyForDisk(thumbnail_url.orEmpty())
|
return "manga-id-$id"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used to display the chapter's title one way or another
|
// Used to display the chapter's title one way or another
|
||||||
|
Loading…
Reference in New Issue
Block a user