Compare commits
2 Commits
2c5854c835
...
b90d4d553a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b90d4d553a | ||
|
|
012036b500 |
85
toys/checkgenre
Executable file
85
toys/checkgenre
Executable file
@ -0,0 +1,85 @@
|
||||
#!/usr/bin/env 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"
|
||||
|
||||
cffile="$HOME/.atom/atom.cfg"
|
||||
LC_ALL=C
|
||||
|
||||
shopt -s extglob
|
||||
|
||||
for function in "$LIBDIR"/*/*
|
||||
do
|
||||
source "$function"
|
||||
done
|
||||
|
||||
while getopts 'D' opt
|
||||
do
|
||||
case $opt in
|
||||
D) (( debug++ )) ;;
|
||||
esac
|
||||
done
|
||||
|
||||
getConfig
|
||||
|
||||
openDatabase
|
||||
|
||||
sourcepath=''
|
||||
|
||||
|
||||
for destination in ${!destinationpath[@]}
|
||||
do
|
||||
case ${destinationformat[$destination]} in
|
||||
ogg) mimetype='audio/ogg vorbis' ;;
|
||||
opus) mimetype='audio/ogg opus' ;;
|
||||
mp3) mimetype='audio/mpeg' ;;
|
||||
esac
|
||||
while read filename
|
||||
do
|
||||
getTags
|
||||
expr='^[0-9]+$'
|
||||
if [[ $genre =~ $expr ]]
|
||||
then
|
||||
echo "$filename ($genre)"
|
||||
Update destination_files last_change 0 <<-EOWhere
|
||||
filename = $filename
|
||||
EOWhere
|
||||
fi
|
||||
done < <(
|
||||
find "${destinationpath[$destination]}" \
|
||||
-name '*.ogg' \
|
||||
-o -name '*.mp3' \
|
||||
-o -name '*.opus'
|
||||
)
|
||||
done
|
||||
|
||||
closeDatabase
|
||||
Loading…
x
Reference in New Issue
Block a user