summaryrefslogtreecommitdiff
path: root/audioconversion.sh
diff options
context:
space:
mode:
authorJoshua Drake <joshua.ellis.drake@gmail.com>2022-12-24 04:54:03 -0600
committerJoshua Drake <joshua.ellis.drake@gmail.com>2022-12-24 04:54:03 -0600
commit6e3d0fd829339e08265a30f18bb7f50a74c4cccf (patch)
tree0838d98225f0043207705dbc25020b0a56c1c026 /audioconversion.sh
parent02a306f4f93f56b82ea7832b6d006ec515d0c7b8 (diff)
Added file renaming and invalid character removal.
Diffstat (limited to 'audioconversion.sh')
-rw-r--r--audioconversion.sh14
1 files changed, 10 insertions, 4 deletions
diff --git a/audioconversion.sh b/audioconversion.sh
index 3847898..00de26a 100644
--- a/audioconversion.sh
+++ b/audioconversion.sh
@@ -13,12 +13,18 @@ d1=${dir#"$1"}
mkdir -v "$2$d1"
done
+#Rename files in accordance with our template
+find "$1" -mindepth 2 -name '*.flac' -o -name '*.m4a' -o -name '*.wav' -o -name '*.mp4' -o -name '*.mp3' | while read -r track;
+do
+ trackrename "--format=%(track_number)2.2d - %(track_name)s.%(suffix)s" "$track"
+done
+
#Remove potential charset conflicts
-find "$1" -mindepth 2 -name '*_.flac' -o -name '*_.m4a' -o -name '*_.wav' -o -name '*_.mp4' -o -name '*_.mp3' | while read -r track;
+find "$1" -type f -name '*.flac' -o -name '*.m4a' -o -name '*.wav' -o -name '*.mp4' -o -name '*.mp3' | while read -r track;
do
- ext="${track##*.}"
- new="${track%%_*}.${ext}"
- mv "${track}" "${new}"
+ song=$(basename "$track")
+ path=$(dirname "$track")
+ mv "$track" "$path/$(echo "$song" | sed -e 's/[^A-Za-z0-9._-]/\ /g')"
done
#Link to all pictures, lyric files, etcetera.