diff --git a/music-sync.sh b/music-sync.sh index deb3806..7a76b07 100755 --- a/music-sync.sh +++ b/music-sync.sh @@ -126,8 +126,13 @@ ConvertFiles() { if [[ "/tmp/converted/$line" = */* ]]; then mkdir -p "/tmp/converted/${line%/*}"; fi; - lame -b 192 $source/$line /tmp/converted/$line 1>/dev/null 2>/dev/null - VerboseOutput "Info" "Converted $line" + if [[ ! -f "/tmp/converted/$line" || "${source}/$file" -nt "/tmp/converted/$line" ]]; then + lame -b 192 $source/$line /tmp/converted/$line 1>/dev/null 2>/dev/null + VerboseOutput "Info" "Converted $line" + else + VerboseOutput "Warning" "$line already converted" + fi; + done < "/tmp/music-sync-filelist" } @@ -155,6 +160,9 @@ if [[ $help == true ]]; then Usage exit fi +if [[ -f /tmp/music-sync-filelist ]]; then + rm /tmp/music-sync-filelist +fi CreateFileList $source $dest "" if [[ ! -f /tmp/music-sync-filelist ]]; then VerboseOutput "Info" "Nothing to do!"