diff --git a/src/core/library/LocalLibrary.cpp b/src/core/library/LocalLibrary.cpp index c8ee038fd..af7832b2c 100644 --- a/src/core/library/LocalLibrary.cpp +++ b/src/core/library/LocalLibrary.cpp @@ -234,11 +234,15 @@ void LocalLibrary::RunQuery(QueryContextPtr context, bool notify) { } } + if (context->callback) { + context->callback(context->query); + } + if (VERBOSE_LOGGING) { - musik::debug::info(TAG, boost::str(boost::format( - "query '%1%' finished with status=%2%") - % query->Name() - % query->GetStatus())); + musik::debug::info(TAG, u8fmt( + "query '%s' finished with status=%d", + query->Name().c_str(), + query->GetStatus())); } query.reset(); diff --git a/src/core/library/query/local/SavePlaylistQuery.cpp b/src/core/library/query/local/SavePlaylistQuery.cpp index 88c825400..63a5db35b 100644 --- a/src/core/library/query/local/SavePlaylistQuery.cpp +++ b/src/core/library/query/local/SavePlaylistQuery.cpp @@ -260,7 +260,7 @@ bool SavePlaylistQuery::AddTracksToPlaylist( Statement queryMax(GET_MAX_SORT_ORDER_QUERY.c_str(), db); queryMax.BindInt64(0, playlistId); if (queryMax.Step() == db::Row) { - offset = queryMax.ColumnInt32(0); + offset = queryMax.ColumnInt32(0) + 1; } /* insert all the tracks. */ diff --git a/src/musikcube/app/overlay/PlayQueueOverlays.cpp b/src/musikcube/app/overlay/PlayQueueOverlays.cpp index 794939d6c..6df68a4c0 100644 --- a/src/musikcube/app/overlay/PlayQueueOverlays.cpp +++ b/src/musikcube/app/overlay/PlayQueueOverlays.cpp @@ -203,7 +203,8 @@ static void createNewPlaylist( [&queue, tracks, library, callback](const std::string& name) { if (name.size()) { auto query = SavePlaylistQuery::Save(library, name, tracks); - library->Enqueue(query, 0, [&queue, callback](auto query) { + library->Enqueue(query, ILibrary::QuerySynchronous, [&queue, callback](auto query) { + setLastPlaylistId(std::static_pointer_cast(query)->GetPlaylistId()); if (callback) { callback(query); } @@ -229,7 +230,9 @@ static void createNewPlaylist( [&queue, library, categoryType, categoryId](const std::string& name) { if (name.size()) { auto query = SavePlaylistQuery::Save(library, name, categoryType, categoryId); - library->Enqueue(query, 0); + library->Enqueue(query, ILibrary::QuerySynchronous, [](auto query) { + setLastPlaylistId(std::static_pointer_cast(query)->GetPlaylistId()); + }); } });