From b26b769691e8b130d6f1dab0bb943b44a9f5d82f Mon Sep 17 00:00:00 2001 From: Joshua Drake Date: Fri, 21 Apr 2023 07:58:16 -0500 Subject: Script now removes potentially invalid characters after conversion. --- audioconversion.sh | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/audioconversion.sh b/audioconversion.sh index 1b29f86..6f41fd6 100644 --- a/audioconversion.sh +++ b/audioconversion.sh @@ -13,14 +13,6 @@ d1=${dir#"$1"} mkdir -v "$2$d1" done -#Remove potential charset conflicts -find "$1" -type f -iname '*.flac' -o -iname '*.m4a' -o -iname '*.wav' -o -iname '*.mp4' -o -iname '*.mp3' | while read -r track; -do - 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. echo "Creating Links for non-audio files..." find "$1" -iname '*.png' -o -iname '*.jpg' -o -iname '*html' -o -iname '*.lrc' -o -iname '*.txt' -o -iname '*.cue' -o -iname '*.exe' -o -iname '*.mpg' -o -iname '*.bmp' -o -iname '*.ico' | while read -r file; @@ -80,9 +72,18 @@ find "$1" -type f -iname '*.flac' -printf '%h\n' | sort -u | while read -r dir echo "$2${dir#"$1"} Contains an equal number of mp3s..." fi done - + echo "File Conversion Done! Starting renaming process..." #Rename files in accordance with our template find "$2" -mindepth 1 -iname '*.flac' -o -iname '*.m4a' -o -iname '*.wav' -o -iname '*.mp4' -o -iname '*.mp3' | while read -r track; do trackrename "--format=%(track_number)2.2d - %(track_name)s.%(suffix)s" "$track" +done + +echo "Resolving character conflicts..." +#Remove potential charset conflicts +find "$2" -type f -iname '*.flac' -o -iname '*.m4a' -o -iname '*.wav' -o -iname '*.mp4' -o -iname '*.mp3' | while read -r track; +do + song=$(basename "$track") + path=$(dirname "$track") + mv "$track" "$path/$(echo "$song" | sed -e 's/[^A-Za-z0-9._-]/\ /g')" done \ No newline at end of file -- cgit v1.2.3