ambevar-dotfiles/.scripts/tc-audio-scan

47 lines
925 B
Bash
Executable File

#!/bin/sh
_usage() {
cat<<EOF
Usage: ${0##*/} FOLDERS
Print audio files found in FOLDERS with
- constant bitrate;
- embedded covers;
- leading zeros in tags.
EOF
}
if [ $# -eq 0 ] || [ "$1" = "-h" ]; then
_usage
exit
fi
if ! command -v mediainfo >/dev/null 2>&1; then
echo >&2 "mediainfo required."
exit 1
fi
for j; do
while IFS= read -r i; do
BUFFER="$(mediainfo "$i")"
[ -n "$(echo "$BUFFER" | grep "Bit rate mode *: Constant")" ] && echo "$i : CBR"
[ -n "$(echo "$BUFFER" | grep "Cover *: Yes")" ] && echo "$i : Cover"
[ -n "$(echo "$BUFFER" | grep "Track name/Position *: 0+")" ] && echo "$i : Leading zeros"
done <<EOF
$(find "$j" \( \
-iname '*.mp3' -o \
-iname '*.flac' -o \
-iname '*.wv' -o \
-iname '*.aac' -o \
-iname '*.wav' -o \
-iname '*.wma' -o \
-iname '*.ogg' -o \
-iname '*.ac3' -o \
-iname '*.dts' -o \
-iname '*.ape' -o \
-iname '*.mpc' \) )
EOF
done