sad

simple audio daemon
git clone git://git.2f30.org/sad
Log | Files | Refs | LICENSE

sad-add (528B)


      1 #!/bin/sh
      2 sock="/tmp/sad-sock"
      3 paths="$HOME/music"
      4 
      5 if ! test -S "$sock"; then
      6 	echo "$0: no unix domain socket at: ${sock}" >&2
      7 	exit 1
      8 fi
      9 
     10 while read -r p; do
     11 	# absolute paths.
     12 	d=$(readlink -f "$p")
     13 	test -d "$d" || continue
     14 	# find mpg, ogg, flac, wav files in specified path make an add command
     15 	# and pipe it to the UDS.
     16 	find "$d" -type f \
     17 		\( -iname "*.mp3" -or \
     18 		-iname "*.ogg" -or \
     19 		-iname "*.flac" -or \
     20 		-iname "*.wav" \) \
     21 		-exec printf 'add %s\n' {} \; | \
     22 		nc -U "$sock"
     23 done <<!__EOF__
     24 $paths
     25 !__EOF__