Support adding tracks to pending playlists in offline mode
Backend: - Add add_tracks_to_pending_playlist method to OfflineStore - Reads current track lists, appends new tracks, updates DB - Add corresponding Tauri command and register in lib.rs Frontend: - Detect pending playlists by negative ID in handleAddToPlaylist - Call add_tracks_to_pending_playlist for pending playlists - Properly separate Qobuz and local tracks before adding - Fixes error trying to call playlist_add_local_track with negative ID
This commit is contained in:
1 parent
3613dd5fdb
commit
59cf94e7ca
4 files changed
+201
-120
No files matched your search
@@ -206,7 +206,19 @@
|
||||
error = null;
|
||||
|
||||
try {
|
||||
if (isLocalTracks) {
|
||||
// Check if this is a pending playlist (negative ID)
|
||||
if (selectedPlaylistId < 0) {
|
||||
const pendingId = -selectedPlaylistId; // Convert back to positive
|
||||
const qobuzTrackIds = isLocalTracks ? [] : trackIds;
|
||||
const localTrackIds = isLocalTracks ? trackIds : [];
|
||||
|
||||
await invoke('add_tracks_to_pending_playlist', {
|
||||
pendingId,
|
||||
qobuzTrackIds,
|
||||
localTrackIds
|
||||
});
|
||||
} else if (isLocalTracks) {
|
||||
// Regular playlist with local tracks
|
||||
// Get current total count (Qobuz + local) to append at correct position
|
||||
const playlist = userPlaylists.find(p => p.id === selectedPlaylistId);
|
||||
const qobuzCount = playlist?.tracks_count ?? 0;
|
||||
@@ -222,6 +234,7 @@
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// Regular playlist with Qobuz tracks
|
||||
await invoke('add_tracks_to_playlist', {
|
||||
playlistId: selectedPlaylistId,
|
||||
trackIds
|
||||
|
||||
Reference in new issue
Block a user