commit 3e05da45dfcf81667f313fdb3bb8a13fb74badd2
parent 8b2ccd107f1158798302ba5462dcbc8d83d2816a
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Fri, 23 Jan 2015 13:21:53 +0100
scripts/sad-add: check if path is a unix domain socket before trying stuff
Diffstat:
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/scripts/sad-add b/scripts/sad-add
@@ -2,12 +2,17 @@
sock="/tmp/sad-sock"
paths="$HOME/music"
+if ! test -S "$sock"; then
+ echo "$0: no unix domain socket at: ${sock}" >&2
+ exit 1
+fi
+
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 mpg, ogg, flac, 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 \