delete invalid DB files in batches, not one by one

This commit is contained in:
tibbi 2020-09-25 14:39:34 +02:00
parent 8d7a5b1771
commit 03a83f5341

View file

@ -970,15 +970,20 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
}.start()
}
if (!directory.isRecycleBin()) {
getCachedMedia(directory.path, getVideosOnly, getImagesOnly) {
val mediaToDelete = ArrayList<Medium>()
it.forEach {
if (!curMedia.contains(it)) {
val path = (it as? Medium)?.path
val medium = it as? Medium
val path = medium?.path
if (path != null) {
deleteDBPath(path)
mediaToDelete.add(medium)
}
}
}
mediaDB.deleteMedia(*mediaToDelete.toTypedArray())
}
}
}