Adjust download cache to ignore irrelevant files
Fixes #8530 (cherry picked from commit 9da232dcd88421a86312b2c5237107f73b20a4a1) # Conflicts: # i18n/src/main/res/values/strings.xml
This commit is contained in:
parent
33f57f6df7
commit
584bf7dc13
@ -299,10 +299,17 @@ class DownloadCache(
|
|||||||
|
|
||||||
mangaDirs.values.forEach { mangaDir ->
|
mangaDirs.values.forEach { mangaDir ->
|
||||||
val chapterDirs = mangaDir.dir.listFiles().orEmpty()
|
val chapterDirs = mangaDir.dir.listFiles().orEmpty()
|
||||||
.mapNotNull { chapterDir ->
|
.mapNotNull {
|
||||||
chapterDir.name
|
when {
|
||||||
?.replace(".cbz", "")
|
// Ignore incomplete downloads
|
||||||
?.takeUnless { it.endsWith(Downloader.TMP_DIR_SUFFIX) }
|
it.name?.endsWith(Downloader.TMP_DIR_SUFFIX) == true -> null
|
||||||
|
// Folder of images
|
||||||
|
it.isDirectory -> it.name
|
||||||
|
// CBZ files
|
||||||
|
it.isFile && it.name?.endsWith(".cbz") == true -> it.name!!.replace(".cbz", "")
|
||||||
|
// Anything else is irrelevant
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.toMutableSet()
|
.toMutableSet()
|
||||||
|
|
||||||
|
@ -503,8 +503,7 @@
|
|||||||
<string name="cache_deleted">Cache cleared. %1$d files have been deleted</string>
|
<string name="cache_deleted">Cache cleared. %1$d files have been deleted</string>
|
||||||
<string name="cache_delete_error">Error occurred while clearing</string>
|
<string name="cache_delete_error">Error occurred while clearing</string>
|
||||||
<string name="pref_auto_clear_chapter_cache">Clear chapter cache on app close</string>
|
<string name="pref_auto_clear_chapter_cache">Clear chapter cache on app close</string>
|
||||||
<string name="pref_invalidate_download_cache">Invalidate download cache</string>
|
<string name="pref_invalidate_download_cache">Invalidate downloads index</string>
|
||||||
<string name="pref_invalidate_download_cache_summary">Forces the app to reindex downloads</string>
|
|
||||||
<string name="pref_clear_database">Clear database</string>
|
<string name="pref_clear_database">Clear database</string>
|
||||||
<string name="pref_clear_database_summary">Delete history for entries that are not saved in your library</string>
|
<string name="pref_clear_database_summary">Delete history for entries that are not saved in your library</string>
|
||||||
<string name="clear_database_source_item_count">%1$d non-library entries in database</string>
|
<string name="clear_database_source_item_count">%1$d non-library entries in database</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user