sad

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

commit 1d365bfd9e2db0d1a1fb3013b04a9f613819daf6
parent 5c6ab238b0cd10acfabec2aad64d436776e8dc57
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sat Dec 27 13:33:46 +0100

scripts: add example scripts

sad-add: add directories containing songs to playlist.
sad-playlist: simple playlist viewer/searcher using dmenu.

Diffstat:
scripts/sad-add | 23+++++++++++++++++++++++
scripts/sad-playlist | 10++++++++++
2 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/scripts/sad-add b/scripts/sad-add @@ -0,0 +1,23 @@ +#!/bin/sh +sock="/tmp/sad-sock" +paths="$HOME/music +../" + +while read -r p; do + # absolute paths. + d=$(readlink -f "$p") + test -d "$d" || continue + # find mpg, ogg, wav files in specified path + # make an add command and pipe it to the UDS. + find "$d" -type f \ + \( -iname "*.mp3" -or \ + -iname "*.ogg" -or \ + -iname "*.wav" \) \ + -exec printf 'add %s\n' {} \; | \ + nc -U "$sock" +done <<!__EOF__ +$paths +!__EOF__ + + + diff --git a/scripts/sad-playlist b/scripts/sad-playlist @@ -0,0 +1,10 @@ +#!/bin/sh +sock="/tmp/sad-sock" + +song=$(echo playlist | nc -U "$sock" | \ + grep -v '^OK$' | grep -v '^ERR ' | \ + dmenu -l 20 -i -p 'Search: ') +if test x"$song" != x""; then + id=$(printf '%s' "$song" | cut -d ':' -f 1) + printf 'play %s\n' "$id" | nc -U "$sock" +fi