More ways to add tracks to existing/new playlists

In my workflow I find myself in a need to be able to add the whole current queue to an existing playlist. Usually I play a whole album by replace-play the current queue and then quickly go through it by swipe-deleting the unneeded tracks. What’s left I would like to add to an existing playlist. Currently there are roundabout ways to accomplish this. For example, I can go the the Playlists section and add the target playlist on top of the current queue, then return to the queue and save it to the same target playlist.

Another possibility is to work directly with the target playlist loaded in the queue and instead of replace-play the album, add it to the bottom and then remove the unneeded tracks, then save. The reason I prefer adding stuff to existing playlist through the Add to playlist functionality is because otherwise it’s easy to accidently replace-play something and then all changes are lost (idea for the future could be to add Undo inside the toast message which says that the playlist has been replaced).

A possible way to add this functionality seems by adding Add to playlist item in the queue context menu (the left image below). This would append the whole current queue to the selected playlist. Possibly the Save item becomes unnecessary in that case because one can simply create new playlist from Add to playlist.

Another thing that may be handy would be to add shortcut for adding a single track from the queue to a playlist (the right image above).

Yet this feature is not that necessary because one can still add the track to a playlist at the price of several more clicks by going to 🛈 and then or the track popup menu, and select Add to playlist, then tapping back to return to the queue. But it will be nice if the Add to playlist was accessible directly from the queued track popup.

Hi,

Thank you for the detailed description.

Both issues will be addressed in the next MAFA version.

1 Like

On second thought the Save item should remain in order to be able to completely rewrite an existing playlist.

In the the latest Release 1.7.8 the option to add to a playlist was added to the actions dialog:

image

There’s now also a warning before replacing the player queue when selecting “Play now”:

image

Unfortunately, adding the player queue to a playlist (instead of replacing) is not supported by MPD.

Thank you for all the additions in the new version!

Unfortunately, adding the player queue to a playlist (instead of replacing) is not supported by MPD.

OK, I see. Is there any special reason to avoid simply running for each through the queue and adding the tracks one by one to the playlist?

It’s possible but may become unreliable in some edge cases, for example when the queue is very long, or if, during the iteration, changes are made to the queue, or the connection is lost.

Using a command list may be a better workaround:

command_list_begin
save temp_list
clear
load target_list
load temp_list
rm target_list
save target_list
clear
load temp_list
rm temp_list
command_list_end

This might work, except that it will disrupt playback and the queue state will have to be preserved (current track, and player state).

I see, thanks for the explanation. I’m only tangentially familiar with the MPD protocol but would it be possible instead of manipulating lists in the way above, to simply batch-add them in a command list? Something like:

command_list_begin
playlistadd playlist.m3u "/track-uri1"
playlistadd playlist.m3u "/track-uri2"
playlistadd playlist.m3u "/track-uri3"
...
command_list_end

where the track-uris are read from the current queue - either through a MPD command or from your app’s runtime data. Generating the commands from the runtime data may even be preferable because it ensures that the user will be adding to the playlist what they see (in case someone else changes the queue just before the command), and this is what they want to accomplish after all. I imagine that this shouldn’t disrupt playback since it doesn’t manipulate the queue.