quodlibet / quodlibet

Music player and music library manager for Linux, Windows, and macOS
https://quodlibet.readthedocs.io
GNU General Public License v2.0
1.44k stars 224 forks source link

Support multiple actions in a single CLI invocation #3031

Open Phidica opened 5 years ago

Phidica commented 5 years ago

I expected to be able to run quodlibet --set-volume=50 --seek=00:00 on the command line with a running instance open and have the volume set and the song restarted.

However, it seems only the first of any options on the command line sent to a running instance is executed. Further options have no effect, unless the first option is --run.

Looking at the source code in quodlibet/quodlibet/cli.py, I note that each option on the command line is added to cmds_todo with the queue() function. Then, each option in cmds_todo is put through control() to send it to the remote instance. However, if the first option sent this way succeeds in execution, then exit_() is called and no further options are run.

Since the language in the source code involves the term "queue", it seems unusual to me that the current implementation does not allow queuing of options. Is this intended? If so, must it stay this way or can it be changed to allow option queuing?

frestr commented 5 years ago

Yeah, this seems like a bug. As you imply, exit_() should be called after all of the commands have been run or when one of them fails

When chaining multiple dependent commands, it's possible that some of them might not run properly because of timing issues (e.g. a play after a slow query), but I wouldn't worry too much about that.