extending the try/catch block at adding paths to db
This commit is contained in:
parent
7226cd4c40
commit
331b016a95
1 changed files with 6 additions and 5 deletions
|
@ -781,12 +781,13 @@ fun Context.addPathToDB(path: String) {
|
||||||
else -> TYPE_IMAGES
|
else -> TYPE_IMAGES
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
val mediumDao = galleryDB.MediumDao()
|
val mediumDao = galleryDB.MediumDao()
|
||||||
val isFavorite = mediumDao.isFavorite(path)
|
val isFavorite = mediumDao.isFavorite(path)
|
||||||
val videoDuration = if (type == TYPE_VIDEOS) path.getVideoDuration() else 0
|
val videoDuration = if (type == TYPE_VIDEOS) path.getVideoDuration() else 0
|
||||||
val medium = Medium(null, path.getFilenameFromPath(), path, path.getParentPath(), System.currentTimeMillis(), System.currentTimeMillis(),
|
val medium = Medium(null, path.getFilenameFromPath(), path, path.getParentPath(), System.currentTimeMillis(), System.currentTimeMillis(),
|
||||||
File(path).length(), type, videoDuration, isFavorite, 0L)
|
File(path).length(), type, videoDuration, isFavorite, 0L)
|
||||||
try {
|
|
||||||
mediumDao.insert(medium)
|
mediumDao.insert(medium)
|
||||||
} catch (ignored: Exception) {
|
} catch (ignored: Exception) {
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue