From a406a9291527c9c155a0b3747c6b6a50d5ad7f0f Mon Sep 17 00:00:00 2001 From: Joshua Drake Date: Mon, 21 Nov 2022 02:14:20 -0600 Subject: Code now properly checks for pre-existing audio in target directory... I'm not good with bash :) --- audioconversion.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'audioconversion.sh') diff --git a/audioconversion.sh b/audioconversion.sh index b4e1e87..daf3dd1 100644 --- a/audioconversion.sh +++ b/audioconversion.sh @@ -9,19 +9,19 @@ do #echo $dir; d1=${dir#$1} #echo "$2$d1" -&>mkdir -v "$2$d1" +mkdir -v "$2$d1" 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 file; do #echo "$2${file#$1}" -&>ln -p "$file" "$2${file#$1}" +ln -P "$file" "$2${file#$1}" done echo "Copying pre-existing mp3s and unlinkable files..." find $1 -iname '*.mp3' -o -iname '*.log' -o -iname '*.m3u' -o -iname '*.m3u8' -o -iname '*.accurip' -o -iname '*pdf' -o -iname '*.rtf'| while read file; do -&>cp "$file" "$2${file#$1}" +cp "$file" "$2${file#$1}" done find $1 -iname 'desktop.ini' -o -iname 'Thumbs.db' -o -iname '*nfo'| while read file; do @@ -30,11 +30,12 @@ done echo "Converting audio... Please be Patient!" find $1 -mindepth 2 -type d -print0| while read -d '' -r dir; do - if [ $(find "$dir" | wc -l) == $(find "$2${dir#$1}" | wc -l) ] + #echo $(( $(find "$dir"/*.flac | wc -l) + $(find "$dir"/*.m4a | wc -l) + $(find "$dir"/*.wav | wc -l) )) + if [ $(( $(find "$dir"/*.flac | wc -l) + $(find "$dir"/*.m4a | wc -l) + $(find "$dir"/*.wav | wc -l) + $(find "$dir"/*.mp3 | wc -l) )) == $(find "$2${dir#$1}"/*mp3 | wc -l) ] && [ $(find "$2${dir#$1}"/*.mp3 | wc -l) > 0 ] then echo "$2${dir#$1} already contains converted files!" else track2track -t mp3 -q extreme -j 20 -d "$2${dir#$1}" "$dir"/*.flac "$dir"/*.wav "$dir"/*.mp4 "$dir"/*.m4a "$dir"/*.wv "$dir"/*.ape fi done -fi +fi \ No newline at end of file -- cgit v1.2.3