Commits


drop unnecessary temp variable in main_restart_track


avoid unnecessary initialization we're just gonna memcpy all over path again a couple of lines before; a smart compiler will probably ignore the initialization anyway.


simplify main_send_player: data is always NULL


don't send the song' path to the player process we're not relying anymore on the file extension, so this information is useless for the player.


reuse main_send_player instead of filling the params for imsg_compose_event.


no point in returning int from a __dead function


drop now unused #include <sndio.h> with the recent refactoring, sndio is only visible in player.c


drop functions prototypes private to player.c and move hdl there too


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.


reuse main_senderr


don't crash when trying to play a directory with pledge(sendfd) we can't send a fd that represents a directory, so we have to check before and eventually skip.


stray newline


always call playlist_dropcurrent after main_play_song failures otherwise we keep garbage in the playing queue.


unify IMSG_ERR and IMSG_EOF handling IMSG_ERR needs a playlist_dropcurrent(), but otherwise is just the same as IMSG_EOF: the current song ended and we need to move forward. To unify, set current_song to NULL in playlist_dropcurrent, which make sense since right after it we're not playing anything.


remove siginfo handling was useful for debugging but now ther's the `status' command for it.