no idea if these work, i have no flac collection so i tested this only on few sample files found on the internet
flac_info.sh
Code:
#!/bin/bash
shopt -s nullglob
while (( $# ))
do
[ -d "$1" ] && dirs+=( "$1" )
shift
done
mflac=( --no-filename --show-tag=ARTIST --show-tag=ALBUM --show-tag=TITLE --show-tag=REPLAYGAIN_ALBUM_GAIN --show-tag=REPLAYGAIN_TRACK_GAIN )
while IFS= read -rd $'\0' dr
do
files=( "$dr"/*.flac )
[ ${#files[@]} -eq 0 ] && continue
for f in "${files[@]}"
do
metaflac "${mflac[@]}" "$f"
echo "-----"
done
done < <( find "${dirs[@]}" -type d -print0 )
gain.awk (should be executable)
Code:
#!/usr/bin/awk -f
BEGIN { FS="[ =]"; ag=1000; tg=1000; }
/ARTIST=/ { a=$0; }
/TITLE=/ { t=$0; }
/ALBUM=/ { al=$0; }
/ALBUM_GAIN=/ { ag=$2; }
/TRACK_GAIN=/ { tg=$2; }
/----/ {
if( ag<x || tg<x )
{
print a; print t; print al;
printf("track gain: %s, album gain: %s\n", tg, ag);
print "---------";
}
a=""; t=""; al=""; ag=1000; tg=1000;
}
Code:
./flac_info.sh /media/Storage/Music /some/other/dir > some.file
./gain.awk -v x=-4 some.file
or in 1 line
Code:
./flac_info.sh /media/Storage/Music | ./gain.awk -v x=-4
i think the 1st method is better because you can dump data about the whole music collection to file once and then only work with that file without running everything again and again.
Bookmarks