mirror of
https://gitea.blesmrt.net/mikaela/scripts.git
synced 2026-05-11 18:28:10 +02:00
music-to-mp3.bash: initial commit
This commit is contained in:
parent
f590d90799
commit
61236107bf
3
bash/.gitignore
vendored
3
bash/.gitignore
vendored
@ -21,3 +21,6 @@ systemd-resolv.conf-generate.bash
|
||||
systemd-resolv.conf-restore.bash
|
||||
traditional-resolv.conf-generate.bash
|
||||
NetworkManager-resolv.conf-restore.bash
|
||||
# music-to-mp3.bash
|
||||
*.flac
|
||||
*.mp3
|
||||
|
||||
37
bash/music-to-mp3.bash
Executable file
37
bash/music-to-mp3.bash
Executable file
@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This is just a quick script to get mp3 files for 200X or early 201X vinyl
|
||||
# player that happens to have a USB port and mp3 logo and doesn't accept
|
||||
# anything else.
|
||||
#
|
||||
# I accidentally plotted this in my head drinking tea outside.
|
||||
|
||||
set -x
|
||||
|
||||
# Without ffmpeg we are doomed to fail
|
||||
if ! hash ffmpeg 2> /dev/null; then
|
||||
echo "ffmpeg not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Convert flacs
|
||||
for flac in *.flac; do
|
||||
if [ -f "$flac.mp3" ]; then
|
||||
echo "$flac.mp3 already exists"
|
||||
else
|
||||
ffmpeg -i "$flac" "$flac.mp3"
|
||||
fi
|
||||
done
|
||||
|
||||
# Convert opus files too since yt-dlp has resulted into them
|
||||
for opus in *.opus; do
|
||||
if [ -f "$opus.mp3" ]; then
|
||||
echo "$opus.mp3 already exists"
|
||||
else
|
||||
ffmpeg -i "$opus" "$opus.mp3"
|
||||
fi
|
||||
done
|
||||
|
||||
# TODO: The output have silly extensions MUSIC.{flac,opus}.mp3
|
||||
|
||||
set +x
|
||||
Loading…
x
Reference in New Issue
Block a user