mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 13:08:00 +01:00
fix #1449, do not wipe favorite items at fixing date taken values
This commit is contained in:
parent
68ded4bfa9
commit
08ee4c60ef
2 changed files with 7 additions and 2 deletions
|
@ -781,11 +781,13 @@ fun Context.addPathToDB(path: String) {
|
||||||
else -> TYPE_IMAGES
|
else -> TYPE_IMAGES
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val mediumDao = galleryDB.MediumDao()
|
||||||
|
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, false, 0L)
|
File(path).length(), type, videoDuration, isFavorite, 0L)
|
||||||
try {
|
try {
|
||||||
galleryDB.MediumDao().insert(medium)
|
mediumDao.insert(medium)
|
||||||
} catch (ignored: Exception) {
|
} catch (ignored: Exception) {
|
||||||
}
|
}
|
||||||
}.start()
|
}.start()
|
||||||
|
|
|
@ -21,6 +21,9 @@ interface MediumDao {
|
||||||
@Query("SELECT filename, full_path, parent_path, last_modified, date_taken, size, type, video_duration, is_favorite, deleted_ts FROM media WHERE deleted_ts != 0")
|
@Query("SELECT filename, full_path, parent_path, last_modified, date_taken, size, type, video_duration, is_favorite, deleted_ts FROM media WHERE deleted_ts != 0")
|
||||||
fun getDeletedMedia(): List<Medium>
|
fun getDeletedMedia(): List<Medium>
|
||||||
|
|
||||||
|
@Query("SELECT is_favorite FROM media WHERE full_path = :path")
|
||||||
|
fun isFavorite(path: String): Boolean
|
||||||
|
|
||||||
@Insert(onConflict = REPLACE)
|
@Insert(onConflict = REPLACE)
|
||||||
fun insert(medium: Medium)
|
fun insert(medium: Medium)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue