Commit Briefs

Omar Polo

amused monitor: allow to pass a list of event as filter

it's easier / simpler for scripts to do $ amused monitor next,prev,jump rather than $ amused monitor | egrep --line-buffered 'next|prev|jump'


Omar Polo

add back missing memzero


Omar Polo

use a more readable strncmp to look for prefixes

also while here stick an `else' before the second clausole. We're supposed to trim out only '> ' and ' ', but the missing else would also trim out ' ' after a '> '!


Omar Polo

get rid of realpath during load

it has a non-ignorable cost over NFS (sdk@ reported ~30 seconds to load 64k songs, and up to 5 minutes over wifi!) and don't provide us any real gain: files can still vanish after being imported or may appear later. The only advantage of realpath was that it would clean up the path from segments like "/./" and resolve the ".." components, but that's a minor issue anyway. prodded by, discussed with and tested by sdk@, thanks a lot!


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.


Omar Polo

keep the current song if load input was generated by show -p

`amused show -p' generates a listing in the form of song > current song song ... This adds an heuristic to `amused load' so that the current song can be set if it's prefixed by "> ". It's particularly useful when re-importing the state from a previous run.


Omar Polo

flush stdout after each monitor event

otherwise the output may get buffered by a pipe and it's not pretty.


Omar Polo

add the `monitor' command