113 lines
2.7 KiB
Bash
113 lines
2.7 KiB
Bash
#!/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"
|
|
count=${#skippeddirectories[@]}
|
|
for (( i=0 ; 1 ; i++ ))
|
|
do
|
|
read \
|
|
-e \
|
|
${skippeddirectories[i]+-i"${skippeddirectories[i]}"}\
|
|
-p'Skip: ' \
|
|
value
|
|
if [ -n "$value" ]
|
|
then
|
|
skippeddirectories[i]="$value"
|
|
elif (( i < count ))
|
|
then
|
|
unset skippeddirectories[i]
|
|
else
|
|
break
|
|
fi
|
|
done
|
|
unset count
|
|
cd - >/dev/null
|
|
cat <<-EODesc
|
|
|
|
Tag guessing pattern:
|
|
This is a pattern that will be used to guess the tag names of files
|
|
that do not have any tags. The pattern is a string with the following
|
|
variables:
|
|
%{album} - The album name
|
|
%{albumartist} - The album artist name
|
|
%{artist} - The artist name
|
|
%{disc} - The disc number - 1 digit
|
|
%{genre} - The genre name
|
|
%{releasecountry} - The country of the release - 2 letter code
|
|
%{title} - The title of the track
|
|
%{track} - The track number - 2 digits
|
|
%{year} - The year or date of the album
|
|
EODesc
|
|
read \
|
|
-e \
|
|
-i"${tagguessing} \
|
|
-p'Pattern: ' \
|
|
tagguessing
|
|
cat <<-EODesc
|
|
|
|
Tag guessing trigger(s):
|
|
Tags whose absence will trigger tag guessing.
|
|
album - The album name
|
|
albumartist - The album artist name
|
|
artist - The artist name
|
|
disc - The disc number
|
|
genre - The genre name
|
|
releasecountry - The country of the release
|
|
title - The title of the track
|
|
track - The track number
|
|
year - The year or date of the album
|
|
EODesc
|
|
count=${#tagguessingtriggers[@]}
|
|
for (( i=0 ; 1 ; i++ ))
|
|
do
|
|
read \
|
|
-e \
|
|
${tagguessingtriggers[i]+-i"${tagguessingtriggers[i]}"}\
|
|
-p'Tag guessing trigger: ' \
|
|
value
|
|
if [ -n "$value" ]
|
|
then
|
|
tagguessingtriggers[i]="$value"
|
|
elif (( i < count ))
|
|
then
|
|
unset tagguessingtriggers[i]
|
|
else
|
|
break
|
|
fi
|
|
done
|
|
unset count
|
|
}
|