update Favorite too at updating a medium
This commit is contained in:
parent
e578036a22
commit
29a521d107
3 changed files with 6 additions and 2 deletions
|
@ -697,7 +697,8 @@ fun Context.updateDBMediaPath(oldPath: String, newPath: String) {
|
||||||
val newFilename = newPath.getFilenameFromPath()
|
val newFilename = newPath.getFilenameFromPath()
|
||||||
val newParentPath = newPath.getParentPath()
|
val newParentPath = newPath.getParentPath()
|
||||||
try {
|
try {
|
||||||
mediaDB.updateMedium(oldPath, newParentPath, newFilename, newPath)
|
mediaDB.updateMedium(newFilename, newPath, newParentPath, oldPath)
|
||||||
|
favoritesDB.updateFavorite(newFilename, newPath, newParentPath, oldPath)
|
||||||
} catch (ignored: Exception) {
|
} catch (ignored: Exception) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,9 @@ interface FavoritesDao {
|
||||||
@Query("SELECT id FROM favorites WHERE full_path = :path COLLATE NOCASE")
|
@Query("SELECT id FROM favorites WHERE full_path = :path COLLATE NOCASE")
|
||||||
fun isFavorite(path: String): Boolean
|
fun isFavorite(path: String): Boolean
|
||||||
|
|
||||||
|
@Query("UPDATE OR REPLACE favorites SET filename = :newFilename, full_path = :newFullPath, parent_path = :newParentPath WHERE full_path = :oldPath COLLATE NOCASE")
|
||||||
|
fun updateFavorite(newFilename: String, newFullPath: String, newParentPath: String, oldPath: String)
|
||||||
|
|
||||||
@Delete
|
@Delete
|
||||||
fun deleteFavorites(vararg favorite: Favorite)
|
fun deleteFavorites(vararg favorite: Favorite)
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ interface MediumDao {
|
||||||
fun deleteOldRecycleBinItems(timestmap: Long)
|
fun deleteOldRecycleBinItems(timestmap: Long)
|
||||||
|
|
||||||
@Query("UPDATE OR REPLACE media SET filename = :newFilename, full_path = :newFullPath, parent_path = :newParentPath WHERE full_path = :oldPath COLLATE NOCASE")
|
@Query("UPDATE OR REPLACE media SET filename = :newFilename, full_path = :newFullPath, parent_path = :newParentPath WHERE full_path = :oldPath COLLATE NOCASE")
|
||||||
fun updateMedium(oldPath: String, newParentPath: String, newFilename: String, newFullPath: String)
|
fun updateMedium(newFilename: String, newFullPath: String, newParentPath: String, oldPath: String)
|
||||||
|
|
||||||
@Query("UPDATE OR REPLACE media SET full_path = :newPath, deleted_ts = :deletedTS WHERE full_path = :oldPath COLLATE NOCASE")
|
@Query("UPDATE OR REPLACE media SET full_path = :newPath, deleted_ts = :deletedTS WHERE full_path = :oldPath COLLATE NOCASE")
|
||||||
fun updateDeleted(newPath: String, deletedTS: Long, oldPath: String)
|
fun updateDeleted(newPath: String, deletedTS: Long, oldPath: String)
|
||||||
|
|
Loading…
Reference in a new issue