dotfiles/home/default/scripts/standardize-music
2024-09-21 15:56:51 -04:00

41 lines
890 B
Bash
Executable File

#!/usr/bin/env sh
set -oux pipefail
count=`ls -1 *.OGG 2>/dev/null | wc -l`
if [ $count != 0 ]; then
rename OGG ogg *.OGG
fi
count=`ls -1 *.ogg 2>/dev/null | wc -l`
if [ $count != 0 ]; then
for i in *.ogg; do
ffmpeg -y -i "$i" "${i%.*}.m4a" -map_metadata 0:s:a:0 && rm "$i"
done
fi
count=`ls -1 *.WEBM 2>/dev/null | wc -l`
if [ $count != 0 ]; then
rename WEBM webm *.WEBM
fi
count=`ls -1 *.webm 2>/dev/null | wc -l`
if [ $count != 0 ]; then
for i in *.webm; do
ffmpeg -y -i "$i" "${i%.*}.m4a" -map_metadata 0:s:a:0 && rm "$i"
done
fi
count=`ls -1 *.OPUS 2>/dev/null | wc -l`
if [ $count != 0 ]; then
rename OPUS opus *.OPUS
fi
count=`ls -1 *.opus 2>/dev/null | wc -l`
if [ $count != 0 ]; then
for i in *.opus; do
ffmpeg -y -i "$i" "${i%.*}.m4a" -map_metadata 0:s:a:0 && rm "$i"
done
fi
rsgain easy -p no_album -m MAX -S ./