From 1a7e7a4b70c0a4a43e580103a664aaede6de42a6 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Sat, 15 Jan 2022 02:08:58 -0800 Subject: [PATCH] SQLite store: Fix playlist syncing --- Utils/SQLiteStore.m | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Utils/SQLiteStore.m b/Utils/SQLiteStore.m index 44e5f3e6b..da60b375b 100644 --- a/Utils/SQLiteStore.m +++ b/Utils/SQLiteStore.m @@ -1293,6 +1293,19 @@ static SQLiteStore *g_sharedStore = NULL; return; } + + // Now to replace the playlist entries + for (size_t i = 0; i < [databaseMirror count]; ++i) + { + PlaylistEntry *oldpe = [databaseMirror objectAtIndex:i]; + if ([oldpe dbIndex] == trackId) + { + PlaylistEntry *newpe = [track mutableCopy]; + [newpe setIndex:i]; + [newpe setEntryId:[oldpe entryId]]; + [databaseMirror replaceObjectAtIndex:i withObject:newpe]; + } + } } } @@ -1885,6 +1898,9 @@ static SQLiteStore *g_sharedStore = NULL; callback(-1); return; } + + [databaseMirror replaceObjectAtIndex:i withObject:newpe]; + callback(progress); } }