dotfiles/home/default/scripts/standardize-music

54 lines
1.1 KiB
Plaintext
Raw Permalink Normal View History

2024-04-25 10:58:58 -04:00
#!/usr/bin/env sh
2024-09-03 20:34:45 -04:00
set -ou pipefail
2024-04-25 10:58:58 -04:00
2024-05-23 11:30:18 -04:00
count=`ls -1 *.OGG 2>/dev/null | wc -l`
2024-04-25 10:58:58 -04:00
if [ $count != 0 ]; then
2024-05-23 11:30:18 -04:00
rename OGG ogg *.OGG
2024-04-25 10:58:58 -04:00
fi
2024-05-23 11:30:18 -04:00
count=`ls -1 *.ogg 2>/dev/null | wc -l`
2024-04-25 10:58:58 -04:00
if [ $count != 0 ]; then
2024-05-23 11:30:18 -04:00
for i in *.ogg; do
2024-11-02 15:38:09 -04:00
ffmpeg -y -i "$i" "${i%.*}.mp3" && rm "$i"
2024-04-25 10:58:58 -04:00
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
2024-11-02 15:38:09 -04:00
ffmpeg -y -i "$i" "${i%.*}.mp3" && rm "$i"
2024-04-25 10:58:58 -04:00
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
2024-11-02 15:38:09 -04:00
ffmpeg -y -i "$i" "${i%.*}.mp3" && rm "$i"
done
fi
count=`ls -1 *.M4A 2>/dev/null | wc -l`
if [ $count != 0 ]; then
rename M4A m4a *.M4A
fi
count=`ls -1 *.m4a 2>/dev/null | wc -l`
if [ $count != 0 ]; then
for i in *.m4a; do
ffmpeg -y -i "$i" "${i%.*}.mp3" && rm "$i"
2024-04-25 10:58:58 -04:00
done
fi
2024-09-03 20:34:45 -04:00
shopt -s nullglob
2024-11-02 15:38:09 -04:00
rsgain custom -S -L -a -s i *.mp3 *.flac