Compare commits
No commits in common. "0fd1fae6dc28bc11f04621dfdc276355857fc0bd" and "0dd962fb8cf62f1e58de6683a234524ceee650ec" have entirely different histories.
0fd1fae6dc
...
0dd962fb8c
158
atom
158
atom
@ -183,7 +183,163 @@ set +H
|
||||
(( cfgdump )) && exit
|
||||
|
||||
# check sanity
|
||||
sanityCheck
|
||||
if [ ! -d "$tempdir" ] && ! mkdir -p "$tempdir"
|
||||
then
|
||||
echo "[FATAL] Could not create temp directory $tempdir" >&2
|
||||
(( sanityfail++ ))
|
||||
fi
|
||||
if [ ! -f "$database" ] && [ ! -d "${database%/*}" ] && ! mkdir -p "${database%/*}"
|
||||
then
|
||||
echo "[FATAL] Directory holding database file does not exist and could" \
|
||||
"not be created" >&2
|
||||
(( sanityfail++ ))
|
||||
fi
|
||||
if [ ! -d "$sourcepath" ]
|
||||
then
|
||||
echo "[FATAL] Source path $sourcepath does not exist or is not a directory" >&2
|
||||
(( sanityfail++ ))
|
||||
fi
|
||||
if ! which sed >/dev/null
|
||||
then
|
||||
echo "[FATAL] Required tool sed is not installed or not in PATH
|
||||
I never thought this would actually hit someone..." >&2
|
||||
(( sanityfail++ ))
|
||||
fi
|
||||
if ! which sox >/dev/null
|
||||
then
|
||||
echo "[FATAL] Required tool sox is not installed or not in PATH" >&2
|
||||
(( sanityfail++ ))
|
||||
fi
|
||||
if ! which ogginfo >/dev/null
|
||||
then
|
||||
echo "[WARNING] Tool ogginfo (from vorbis-tools) is not" \
|
||||
"installed or not in PATH
|
||||
WebM metadata disabled" >&2
|
||||
disableogginfo=1
|
||||
(( sanitywarn++ ))
|
||||
fi
|
||||
if ! which soxi >/dev/null
|
||||
then
|
||||
echo "[WARNING] Tool soxi (from sox) is not" \
|
||||
"installed or not in PATH
|
||||
Vorbis metadata disabled" >&2
|
||||
disablesoxi=1
|
||||
(( sanitywarn++ ))
|
||||
fi
|
||||
if (( oggencneeded )) && ! which oggenc >/dev/null
|
||||
then
|
||||
echo "[WARNING] Tool oggenc (from vorbis-tools) is not" \
|
||||
"installed or not in PATH
|
||||
Vorbis targets disabled" >&2
|
||||
disableoggenc=1
|
||||
(( sanitywarn++ ))
|
||||
fi
|
||||
if ! which opusinfo >/dev/null
|
||||
then
|
||||
echo "[WARNING] Tool opusinfo (from opus-tools) is not" \
|
||||
"installed or not in PATH
|
||||
Opus metadata disabled" >&2
|
||||
disableopusinfo=1
|
||||
(( sanitywarn++ ))
|
||||
fi
|
||||
if (( opusencneeded )) && ! which opusenc >/dev/null
|
||||
then
|
||||
echo "[WARNING] Tool opusenc (from opus-tools) is not" \
|
||||
"installed or not in PATH
|
||||
Opus targets disabled" >&2
|
||||
disableopusenc=1
|
||||
(( sanitywarn++ ))
|
||||
fi
|
||||
if ! which opusdec >/dev/null
|
||||
then
|
||||
echo "[WARNING] Tool opusdec (from opus-tools) is not" \
|
||||
"installed or not in PATH
|
||||
Opus support disabled" >&2
|
||||
disableopusdec=1
|
||||
(( sanitywarn++ ))
|
||||
fi
|
||||
if (( lameneeded )) && ! which lame >/dev/null
|
||||
then
|
||||
echo "[WARNING] Tool lame is not installed or not in PATH
|
||||
MP3 targets disabled" >&2
|
||||
disablelame=1
|
||||
(( sanitywarn++ ))
|
||||
fi
|
||||
if ! which metaflac >/dev/null
|
||||
then
|
||||
echo "[WARNING] Tool metaflac (from FLAC) is not installed" \
|
||||
"or not in PATH
|
||||
FLAC metadata disabled" >&2
|
||||
disableflac=1
|
||||
(( sanitywarn++ ))
|
||||
fi
|
||||
if ! which mpcdec >/dev/null
|
||||
then
|
||||
echo "[WARNING] Tool mpcdec (from Musepack) is not" \
|
||||
"installed or not in PATH
|
||||
Musepack support disabled" >&2
|
||||
disablempcdec=1
|
||||
(( sanitywarn++ ))
|
||||
fi
|
||||
if ! which mkvextract >/dev/null
|
||||
then
|
||||
echo "[WARNING] Tool mkvextract (from MKVToolNix) is not" \
|
||||
"installed or not in PATH
|
||||
WebM metadata disabled
|
||||
WebM support disabled" >&2
|
||||
disablemkvextract=1
|
||||
(( sanitywarn++ ))
|
||||
fi
|
||||
if ! which ffprobe >/dev/null
|
||||
then
|
||||
echo "[WARNING] Tool ffprobe (from FFmpeg) is not installed or not in PATH
|
||||
Video metadata disabled
|
||||
MPEG metadata disabled
|
||||
MusePack metadata disabled
|
||||
Unknown format metadata disabled" >&2
|
||||
disableffprobe=1
|
||||
(( sanitywarn++ ))
|
||||
fi
|
||||
if ! which ffmpeg >/dev/null
|
||||
then
|
||||
echo "[WARNING] Tool ffmpeg is not installed or not in PATH
|
||||
Video support disabled" >&2
|
||||
disablevideo=1
|
||||
(( sanitywarn++ ))
|
||||
fi
|
||||
if (( textunidecodeneeded )) && ! perl -MText::Unidecode -e 'exit;' 2>/dev/null
|
||||
then
|
||||
echo "[WARNING] Perl module Text::Unidecode is not available
|
||||
Renaming to ASCII-only disabled" >&2
|
||||
unset destinationascii
|
||||
destinationascii=0
|
||||
textunidecodeneeded=0
|
||||
(( sanitywarn++ ))
|
||||
fi
|
||||
if (( sanityfail ))
|
||||
then
|
||||
echo "
|
||||
Sanity checks raised ${sanitywarn:-0} warnings, $sanityfail failures. Dying now." >&2
|
||||
exit $ESANITY
|
||||
elif (( sanitywarn ))
|
||||
then
|
||||
echo "
|
||||
Sanity checks raised $sanitywarn warnings... Hit Control-C to abort." >&2
|
||||
if ! (( cron ))
|
||||
then
|
||||
timeout=$(( sanitywarn * 10 ))
|
||||
echo -n "Starting in $(printf %3i $timeout)" \
|
||||
$'seconds...\b\b\b\b\b\b\b\b\b\b\b' >&2
|
||||
while (( timeout ))
|
||||
do
|
||||
echo -n $'\b\b\b'"$(printf %3i $timeout)" >&2
|
||||
sleep 1
|
||||
(( timeout-- ))
|
||||
done
|
||||
echo -en "\r\033[K"
|
||||
fi
|
||||
fi
|
||||
|
||||
openDatabase
|
||||
|
||||
for destination in "${destinations[@]}"
|
||||
|
||||
@ -1,164 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
sanityCheck() {
|
||||
if [ ! -d "$tempdir" ] && ! mkdir -p "$tempdir"
|
||||
then
|
||||
echo "[FATAL] Could not create temp directory $tempdir" >&2
|
||||
(( sanityfail++ ))
|
||||
fi
|
||||
if [ ! -f "$database" ] && [ ! -d "${database%/*}" ] \
|
||||
&& ! mkdir -p "${database%/*}"
|
||||
then
|
||||
echo "[FATAL] Directory holding database file does not exist"\
|
||||
"and could not be created" >&2
|
||||
(( sanityfail++ ))
|
||||
fi
|
||||
if [ ! -d "$sourcepath" ]
|
||||
then
|
||||
echo "[FATAL] Source path $sourcepath does not exist or is"\
|
||||
"not a directory" >&2
|
||||
(( sanityfail++ ))
|
||||
fi
|
||||
if ! which sed >/dev/null
|
||||
then
|
||||
echo "[FATAL] Required tool sed is not installed or not in PATH
|
||||
I never thought this would actually hit someone..." >&2
|
||||
(( sanityfail++ ))
|
||||
fi
|
||||
if ! which sox >/dev/null
|
||||
then
|
||||
echo "[FATAL] Required tool sox is not installed or not in"\
|
||||
"PATH" >&2
|
||||
(( sanityfail++ ))
|
||||
fi
|
||||
if ! which ogginfo >/dev/null
|
||||
then
|
||||
echo "[WARNING] Tool ogginfo (from vorbis-tools) is not"\
|
||||
"installed or not in PATH
|
||||
WebM metadata disabled" >&2
|
||||
disableogginfo=1
|
||||
(( sanitywarn++ ))
|
||||
fi
|
||||
if ! which soxi >/dev/null
|
||||
then
|
||||
echo "[WARNING] Tool soxi (from sox) is not" \
|
||||
"installed or not in PATH
|
||||
Vorbis metadata disabled" >&2
|
||||
disablesoxi=1
|
||||
(( sanitywarn++ ))
|
||||
fi
|
||||
if (( oggencneeded )) && ! which oggenc >/dev/null
|
||||
then
|
||||
echo "[WARNING] Tool oggenc (from vorbis-tools) is not" \
|
||||
"installed or not in PATH
|
||||
Vorbis targets disabled" >&2
|
||||
disableoggenc=1
|
||||
(( sanitywarn++ ))
|
||||
fi
|
||||
if ! which opusinfo >/dev/null
|
||||
then
|
||||
echo "[WARNING] Tool opusinfo (from opus-tools) is not" \
|
||||
"installed or not in PATH
|
||||
Opus metadata disabled" >&2
|
||||
disableopusinfo=1
|
||||
(( sanitywarn++ ))
|
||||
fi
|
||||
if (( opusencneeded )) && ! which opusenc >/dev/null
|
||||
then
|
||||
echo "[WARNING] Tool opusenc (from opus-tools) is not" \
|
||||
"installed or not in PATH
|
||||
Opus targets disabled" >&2
|
||||
disableopusenc=1
|
||||
(( sanitywarn++ ))
|
||||
fi
|
||||
if ! which opusdec >/dev/null
|
||||
then
|
||||
echo "[WARNING] Tool opusdec (from opus-tools) is not" \
|
||||
"installed or not in PATH
|
||||
Opus support disabled" >&2
|
||||
disableopusdec=1
|
||||
(( sanitywarn++ ))
|
||||
fi
|
||||
if (( lameneeded )) && ! which lame >/dev/null
|
||||
then
|
||||
echo "[WARNING] Tool lame is not installed or not in PATH
|
||||
MP3 targets disabled" >&2
|
||||
disablelame=1
|
||||
(( sanitywarn++ ))
|
||||
fi
|
||||
if ! which metaflac >/dev/null
|
||||
then
|
||||
echo "[WARNING] Tool metaflac (from FLAC) is not installed"\
|
||||
"or not in PATH
|
||||
FLAC metadata disabled" >&2
|
||||
disableflac=1
|
||||
(( sanitywarn++ ))
|
||||
fi
|
||||
if ! which mpcdec >/dev/null
|
||||
then
|
||||
echo "[WARNING] Tool mpcdec (from Musepack) is not" \
|
||||
"installed or not in PATH
|
||||
Musepack support disabled" >&2
|
||||
disablempcdec=1
|
||||
(( sanitywarn++ ))
|
||||
fi
|
||||
if ! which mkvextract >/dev/null
|
||||
then
|
||||
echo "[WARNING] Tool mkvextract (from MKVToolNix) is not"\
|
||||
"installed or not in PATH
|
||||
WebM metadata disabled
|
||||
WebM support disabled" >&2
|
||||
disablemkvextract=1
|
||||
(( sanitywarn++ ))
|
||||
fi
|
||||
if ! which ffprobe >/dev/null
|
||||
then
|
||||
echo "[WARNING] Tool ffprobe (from FFmpeg) is not installed"\
|
||||
"or not in PATH
|
||||
Video metadata disabled
|
||||
MPEG metadata disabled
|
||||
MusePack metadata disabled
|
||||
Unknown format metadata disabled" >&2
|
||||
disableffprobe=1
|
||||
(( sanitywarn++ ))
|
||||
fi
|
||||
if ! which ffmpeg >/dev/null
|
||||
then
|
||||
echo "[WARNING] Tool ffmpeg is not installed or not in PATH
|
||||
Video support disabled" >&2
|
||||
disablevideo=1
|
||||
(( sanitywarn++ ))
|
||||
fi
|
||||
if (( textunidecodeneeded )) && ! perl -MText::Unidecode -e 'exit;' 2>/dev/null
|
||||
then
|
||||
echo "[WARNING] Perl module Text::Unidecode is not available
|
||||
Renaming to ASCII-only disabled" >&2
|
||||
unset destinationascii
|
||||
destinationascii=0
|
||||
textunidecodeneeded=0
|
||||
(( sanitywarn++ ))
|
||||
fi
|
||||
if (( sanityfail ))
|
||||
then
|
||||
echo "
|
||||
Sanity checks raised ${sanitywarn:-0} warnings, $sanityfail failures. Dying now." >&2
|
||||
exit $ESANITY
|
||||
elif (( sanitywarn ))
|
||||
then
|
||||
echo "
|
||||
Sanity checks raised $sanitywarn warnings... Hit Control-C to abort." >&2
|
||||
if ! (( cron ))
|
||||
then
|
||||
timeout=$(( sanitywarn * 10 ))
|
||||
echo -n "Starting in $(printf %3i $timeout)" \
|
||||
$'seconds...\b\b\b\b\b\b\b\b\b\b\b' >&2
|
||||
while (( timeout ))
|
||||
do
|
||||
echo -n $'\b\b\b'"$(printf %3i $timeout)" >&2
|
||||
sleep 1
|
||||
(( timeout-- ))
|
||||
done
|
||||
echo -en "\r\033[K"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@ -62,7 +62,6 @@ done
|
||||
|
||||
getConfig
|
||||
|
||||
sanityCheck
|
||||
openDatabase
|
||||
|
||||
(( update )) && getFiles
|
||||
|
||||
@ -58,7 +58,7 @@ do
|
||||
done
|
||||
|
||||
getConfig
|
||||
sanityCheck
|
||||
|
||||
openDatabase
|
||||
|
||||
sourcepath=''
|
||||
|
||||
@ -59,7 +59,7 @@ do
|
||||
done
|
||||
|
||||
getConfig
|
||||
sanityCheck
|
||||
|
||||
openDatabase
|
||||
|
||||
echo 'SELECT id,filename FROM destination_files WHERE filename IS NOT NULL;' >&3
|
||||
|
||||
@ -59,7 +59,7 @@ do
|
||||
done
|
||||
|
||||
getConfig
|
||||
sanityCheck
|
||||
|
||||
openDatabase
|
||||
|
||||
checkwanted() {
|
||||
|
||||
@ -139,7 +139,7 @@ done
|
||||
}
|
||||
|
||||
getConfig
|
||||
sanityCheck
|
||||
|
||||
openDatabase
|
||||
|
||||
columns="${show[@]//*/-}"
|
||||
|
||||
@ -75,7 +75,7 @@ do
|
||||
done
|
||||
|
||||
getConfig
|
||||
sanityCheck
|
||||
|
||||
openDatabase
|
||||
|
||||
if (( update ))
|
||||
|
||||
@ -94,7 +94,7 @@ done
|
||||
}
|
||||
|
||||
getConfig
|
||||
sanityCheck
|
||||
|
||||
openDatabase
|
||||
|
||||
if (( update ))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user