From da49eb7086661f1002d5f3d58e56ee068056f3cc Mon Sep 17 00:00:00 2001 From: Vincent Riquer Date: Mon, 17 Jun 2013 13:40:57 +0200 Subject: [PATCH] [source] setup --- lib/setup/setupSource | 53 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 lib/setup/setupSource diff --git a/lib/setup/setupSource b/lib/setup/setupSource new file mode 100644 index 0000000..a94d410 --- /dev/null +++ b/lib/setup/setupSource @@ -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 ( 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 +}