[source] setup

This commit is contained in:
Vincent Riquer 2013-06-17 13:40:57 +02:00
parent 9cde5ba272
commit da49eb7086

53
lib/setup/setupSource Normal file
View File

@ -0,0 +1,53 @@
#!/bin/bash
setupSource() {
cat <<-EODesc
[Source]
Here we will define which directory AtOM should look for media files, and
what it should completely ignore.
EODesc
cat <<-EODesc
Path (path):
Which directory to scan for new media files.
EODesc
comeagain() {
read \
-e \
-i"${sourcepath:-/var/lib/mpd/music}" \
-p'Music collection (<TAB> for completion): ' \
sourcepath
if ! [ -d "$sourcepath" ]
then
echo "$sourcepath does not exist or is not a" \
"directory!" >&2
comeagain
fi
}
comeagain
cat <<-EODesc
Skip (path):
Files in these directories will be ignored.
Path is relative to $sourcepath.
This prompt will loop until an empty string is encountered.
EODesc
cd "$sourcepath"
for (( i=0 ; 1 ; i++ ))
do
read \
-e \
${skippeddirectories[i]+-i"${skippeddirectories[i]}"}\
-p'Skip: ' \
value
if [ -n "$value" ]
then
skippeddirectories[i]="$value"
else
break
fi
done
cd - >/dev/null
}