Skip to content

Commit

Permalink
Re-add "remove from playlist"
Browse files Browse the repository at this point in the history
  • Loading branch information
probablykasper committed Sep 25, 2024
1 parent 3d9b902 commit b823b65
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
25 changes: 12 additions & 13 deletions src/components/TrackList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -153,22 +153,21 @@
}
} else if (
check_shortcut(e, 'Backspace') &&
$selection.size > 0 &&
!$filter &&
selection.items.size > 0 &&
$filter === '' &&
tracks_page.playlistKind === 'playlist'
) {
e.preventDefault()
// const s = $selection.count > 1 ? 's' : ''
// const result = ipc_renderer.invoke('showMessageBox', false, {
// type: 'info',
// message: `Remove ${$selection.count} song${s} from the list?`,
// buttons: ['Remove Song' + s, 'Cancel'],
// defaultId: 0,
// })
// const indexes = selection.getSelectedIndexes()
// if ((await result).response === 0) {
// remove_from_open_playlist(indexes)
// }
const s = selection.items.size > 1 ? 's' : ''
const result = ipc_renderer.invoke('showMessageBox', false, {
type: 'info',
message: `Remove ${selection.items.size} song${s} from the list?`,
buttons: ['Remove Song' + s, 'Cancel'],
defaultId: 0,
})
if ((await result).response === 0) {
remove_from_playlist(params.playlist_id, Array.from(selection.items))
}
} else if (check_shortcut(e, 'Backspace', { cmd_or_ctrl: true }) && $selection.size > 0) {
e.preventDefault()
handle_action('Delete from Library')
Expand Down
7 changes: 3 additions & 4 deletions src/lib/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,9 @@ export async function add_tracks_to_playlist(
}
}
export function remove_from_playlist(playlist_id: TrackListID, item_ids: ItemId[]) {
// call((addon) => addon.remove_from_playlist(playlist_id, item_ids))
// page.refresh_ids_and_keep_selection()
// pageSelection.clear()
// methods.save()
call((addon) => addon.remove_from_playlist(playlist_id, item_ids))
tracklist_items_updated.emit()
methods.save()
}
export function delete_tracks_with_item_ids(item_ids: ItemId[]) {
call((addon) => addon.delete_tracks_with_item_ids(item_ids))
Expand Down

0 comments on commit b823b65

Please sign in to comment.