diff --git a/MusicPlayerV2-GUI/src/components/playerView.vue b/MusicPlayerV2-GUI/src/components/playerView.vue index 66e7d02..44ff8a4 100644 --- a/MusicPlayerV2-GUI/src/components/playerView.vue +++ b/MusicPlayerV2-GUI/src/components/playerView.vue @@ -62,7 +62,9 @@ @control="( action ) => { control( action ) }" @play-song="( song ) => { playSong( song ) }" @add-new-songs="( songs ) => addNewSongs( songs )" @playlist-reorder="( move ) => moveSong( move )" :is-logged-into-apple-music="player.isLoggedIn" - @add-new-songs-apple-music="( song ) => addNewSongFromObject( song )"> + @add-new-songs-apple-music="( song ) => addNewSongFromObject( song )" + @delete-song="song => removeSongFromPlaylist( song )" + @clear-playlist="() => clearPlaylist()"> popupReturnHandler( data )" ref="popup"> @@ -489,6 +491,31 @@ notificationHandler.emit( 'playlist-update', playlist.value ); } + const removeSongFromPlaylist = ( song: number ) => { + playlist.value = player.getQueue(); + playlist.value.splice( song, 1 ); + player.setPlaylist( playlist.value ); + if ( !isPlaying.value ) { + player.prepare( 0 ); + isPlaying.value = true; + startProgressTracker(); + } + notificationHandler.emit( 'playlist-update', playlist.value ); + } + + const clearPlaylist = () => { + playlist.value = []; + player.control( 'pause' ); + stopProgressTracker(); + isPlaying.value = false; + player.setPlaylist( [] ); + currentlyPlayingSongArtist.value = ''; + currentlyPlayingSongName.value = 'Not playing'; + coverArt.value = ''; + pos.value = 0; + notificationHandler.emit( 'playlist-update', playlist.value ); + } + emits( 'playerStateChange', isShowingFullScreenPlayer.value ? 'show' : 'hide' ); const userStore = useUserStore(); diff --git a/MusicPlayerV2-GUI/src/components/playlistView.vue b/MusicPlayerV2-GUI/src/components/playlistView.vue index 89922d4..1f6a85a 100644 --- a/MusicPlayerV2-GUI/src/components/playlistView.vue +++ b/MusicPlayerV2-GUI/src/components/playlistView.vue @@ -1,13 +1,14 @@ - Playlist + Queue upload search + delete Please select at least one song to proceed - + arrow_downward {{ song.title }} {{ getTimeUntil( song ) }} + delete { addNewSongsAppleMusic( song ) }"> @@ -34,6 +36,7 @@ +
Please select at least one song to proceed
{{ getTimeUntil( song ) }}