dotfiles/home/default/scripts/standardize-music

40 lines
853 B
Plaintext
Raw Normal View History

2024-04-25 10:58:58 -04:00
#!/usr/bin/env sh
set -oux pipefail
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
ffmpeg -y -i "$i" "${i%.*}.m4a" -map_metadata 0:s:a:0 && 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-05-23 11:30:18 -04:00
ffmpeg -y -i "$i" "${i%.*}.m4a" -map_metadata 0:s:a:0 && 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-05-23 11:30:18 -04:00
ffmpeg -y -i "$i" "${i%.*}.m4a" -map_metadata 0:s:a:0 && rm "$i"
2024-04-25 10:58:58 -04:00
done
fi