104 lines
1.6 KiB
Bash
Executable File
104 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# config structures
|
|
declare -A \
|
|
destinationchannels \
|
|
destinationfat32compat \
|
|
destinationcopymime \
|
|
destinationformat \
|
|
destinationfrequency \
|
|
destinationid \
|
|
destinationloss \
|
|
destinationmaxbps \
|
|
destinationnormalize \
|
|
destinationpath \
|
|
destinationquality \
|
|
destinationrename \
|
|
destinationnoresample \
|
|
destinationrenamepath \
|
|
destinationskipmime \
|
|
|| {
|
|
echo "Check your Bash version. You need >= 4.0" >&2
|
|
exit $EBASHVERS
|
|
}
|
|
|
|
declare -r \
|
|
DOCDIR=./doc \
|
|
LIBDIR=./lib \
|
|
SHAREDIR=./share
|
|
declare -r \
|
|
exampleconf=$DOCDIR/example.cfg \
|
|
schema=$SHAREDIR/schema.sql \
|
|
\
|
|
oldIFS="$IFS"
|
|
|
|
LC_ALL=C
|
|
|
|
shopt -s extglob
|
|
|
|
for function in "$LIBDIR"/*/*
|
|
do
|
|
source "$function"
|
|
done
|
|
|
|
getConfig
|
|
|
|
openDatabase
|
|
|
|
getFiles
|
|
|
|
echo '
|
|
SELECT
|
|
source_files.id,
|
|
source_files.filename,
|
|
mime_types.mime_text
|
|
FROM
|
|
source_files
|
|
INNER JOIN mime_types
|
|
ON source_files.mime_type = mime_types.id
|
|
;
|
|
SELECT "AtOM:NoMoreFiles";
|
|
' >&3
|
|
|
|
while read -u4 line
|
|
do
|
|
if [[ $line == AtOM:NoMoreFiles ]]
|
|
then
|
|
break
|
|
fi
|
|
fileid=${line%%|*}
|
|
rest="${line#*|}|"
|
|
filename=${rest%%|*}
|
|
rest=${rest#*|}
|
|
mimetype=${rest%%|*}
|
|
rest=${rest#*|}
|
|
case "$mimetype" in
|
|
'audio/mpeg')
|
|
if [[ ${filename##*.} != mp3 ]]
|
|
then
|
|
echo "$filename: MP3 (.mp3)"
|
|
fi
|
|
;;
|
|
'application/ogg vorbis')
|
|
if [[ ${filename##*.} != ogg ]]
|
|
then
|
|
echo "$filename: Ogg Vorbis (.ogg)"
|
|
fi
|
|
;;
|
|
'application/ogg opus')
|
|
if [[ ${filename##*.} != opus ]]
|
|
then
|
|
echo "$filename: Opus (.opus)"
|
|
fi
|
|
;;
|
|
'audio/x-flac')
|
|
if [[ ${filename##*.} != flac ]]
|
|
then
|
|
echo "$filename: FLAC (.flac)"
|
|
fi
|
|
;;
|
|
esac
|
|
done
|
|
|
|
closeDatabase
|