Commits


add consume mode the consume mode implicitly drops the tracks from the playlist when played 'till the end (note that skipping over a track doesn't trigger the consume mode - yet?)


amused.1: misc tweaks


drop restart from the list of 'status-like' commands now it's an alias for 'seek 0', so it doesn't return the status.


pledge early This changed amused to pledge "stdio rpath" early in main() and then drop down to "stdio" in ctlaction, by removing the pledge call in parse. Simplifies a bit the logic and runs more code under pledge.


include unistd.h for close spotted on aarch64/glibc


improve 'amused monitor' documentation


s/imsg_name/event_name


monitor: fix reported event rethink a bit which event are reported and when. - drop 'toggle' event as it's not useful; now 'amused toggle' will report the play/pause event. - replace 'flush' with 'load'. there's no real difference between a flush and an empty load. (also, less event the better) - some events (next/prev/jump) are reported earlier to avoid possible issues (when messing around with the playing queue we can end up in every possible state.) - report 'seek' only after it really happened (i.e. after the player process sent the new position.) There's still a possible race here (we can receive a previous IMSG_POS and think it's the reply to the seek) but it it's hard/impossible to work around. - drop 'restart'. we have 'seek' now which is better (and actually restart is implemented on top of seek.) - add 'seek' to the default list of events.


amused-monitor: no need to list all the events `amused monitor' defaults to report all the events, that should be enough.


refactor control_notify it's awkward to call it with the address of the imsgev struct inside the ctl_conn struct. Just relay the info to every client in monitor mode. After all, if a client is in monitor mode *and* issues commands, it's not strange that they're echoed back (note that this is currently impossible, the command line client can either issue commands or be in monitor mode.)


amused-monitor: add a round function and simplify some bits


amused-monitor: drop unused `min' function


amused-monitor: rewrite excerpt function instead of passing "half" of the context wanted, just take the number of lines wanted. switch to a circular buffer to store the lines instead of shelling out (badly) to grep -C.


initialize status_format early in the main() otherwise we may leave it NULL (it's set only in ctl_status) and crash in print_status.


handle when the duration is zero