Page 1 of 1

Adding multiple song at once

Posted: February 21st, 2017, 5:13 pm
by kingu_gidora
Hi all,

I am working on my own client (in the Gauche dialect of Scheme, but that is very important).

I use connection to port 6600 to communicate with MPD (don't have access to any pre-made library with my language).

My question is: What is the mpd command syntax that I need to use if I want to add multiple songs to mpd but toggle the 'idle playlist' command only once?

Now I'm looping through all the song and issue a 'add ...' command for each. But this toggle the 'idle playlist' everytime.

Thanks in advance for your help!

Re: Adding multiple song at once

Posted: February 22nd, 2017, 8:44 am
by max
You can't.

Every modification triggers the according "idle" event. That is important. If there were a way to skip that, it would make the client's view of the server state inconsistent.

If your client wishes to receive idle notifications less quickly, it's in his power to throttle them. But the server can't, without violating the protocol contract.

Re: Adding multiple song at once

Posted: February 25th, 2017, 2:16 pm
by kingu_gidora
Thanks,

However I found out how to fix my issue

The wanted behavior was achieved by using command list

https://www.musicpd.org/doc/protocol/command_lists.html

Code: Select all

command_list_start
 add "song1"
 add "song2"
 add "song3"
command_list_end
Will add 3 songs but 'idle playlist' will be toggled only once

Re: Adding multiple song at once

Posted: February 26th, 2017, 1:18 pm
by max
This is just coincidence. Nothing in the protocol guarantees that. If you rely on it, you're doing a mistake.