Commit Briefs

Omar Polo

don't try to match the prev/next song; been broken since tx in load was added

originally i tried to match the previous or next song in the playing queue after a load command if the current song was not matched. The idea is ok-ish, but the implementation was broken and become a no-op after some recent refactoring in that area.



Omar Polo

pledge audio too

while for my particular use-case this has always worked with only "stdio recvfd", sio_open(3) mentions that if no further sio_open calls are made all pledges can be dropped except for "audio", so let's keep it.



Omar Polo

simplify phrasing


Omar Polo

remove the got_stop hack

now player_playnext has enough information to decide wheter to call player_senderr or player_sendeof.


Omar Polo

change play_*() so that they return an integer

this will allow to remove the `got_stop' hack in player.c


Omar Polo

drop now unused #include <sndio.h>

with the recent refactoring, sndio is only visible in player.c




Omar Polo

fix argc check

argc can be -1 if we called noarg with argc=0, because optind is 1.


Omar Polo

correctly handle arguments for sub-commands

things like "--" should be skipped etc, easier to rely on getopt(3).




Omar Polo

rework how the daemon is automatically spawned

The previous way introduce possible races if multiple `amused' instances try to start the daemon. The new approach is heavily lifted from how tmux does it, but with some minor differences. If the initial connect fails we try to grab a lock to safely execute the daemon only one time. In fact we try to connect one more time even when we hold the lock because another instance can grab the lock, start the daemon and release it between the failure of connect and the first flock. It also changes slightly how the program behaves and how the -d option works. Now running `amused' without arguments is a synonym for `amused status' and the -d option only works if no arguments were given and if the daemon wasn't running.