Adding multiple song at once

Discuss client development (or even MPD development if you feel so inclined), ask questions about the client libs, MPD feature requests from client developers, etc...
Post Reply
kingu_gidora
Posts: 2
Joined: February 21st, 2017, 5:03 pm

Adding multiple song at once

Post by kingu_gidora » February 21st, 2017, 5:13 pm

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!

max
Forum team
Posts: 954
Joined: January 15th, 2013, 3:43 pm

Re: Adding multiple song at once

Post by max » February 22nd, 2017, 8:44 am

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.

kingu_gidora
Posts: 2
Joined: February 21st, 2017, 5:03 pm

Re: Adding multiple song at once

Post by kingu_gidora » February 25th, 2017, 2:16 pm

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

max
Forum team
Posts: 954
Joined: January 15th, 2013, 3:43 pm

Re: Adding multiple song at once

Post by max » February 26th, 2017, 1:18 pm

This is just coincidence. Nothing in the protocol guarantees that. If you rely on it, you're doing a mistake.

Post Reply