From b0fca5127fa5ba5bd4e93ebcd5e858f112096de4 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Thu, 27 Jan 2022 00:05:02 -0800 Subject: [PATCH] SQLite Store: Fix updating track entries Track entries are updated when files are added and their metadata is later loaded. The refresh cycle was failing, because dbIndex was unset in the new tracks, for some reason. Now it will set this when updating the track item, assuming it read from the database in the first place. This fixes metadata being loaded properly on adding tracks to the playlist, as well as reloading track data manually. Fixes #218, hopefully. Signed-off-by: Christopher Snowhill --- Utils/SQLiteStore.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Utils/SQLiteStore.m b/Utils/SQLiteStore.m index 04bc0bafe..888980bca 100644 --- a/Utils/SQLiteStore.m +++ b/Utils/SQLiteStore.m @@ -1254,11 +1254,16 @@ static SQLiteStore *g_sharedStore = NULL; return; } - if (trackId != [track dbIndex]) + if (trackId != [track dbIndex] && [track dbIndex] != 0) { [self removeString:urlId]; return; } + + if ([track dbIndex] == 0) + { + [track setDbIndex:trackId]; + } st = stmt[stmt_select_track_data];