Fixed bugs, working great now on full library.
This commit is contained in:
parent
6a0a12ad7a
commit
0a55a188bf
@ -23,7 +23,8 @@
|
|||||||
## Variables ##
|
## Variables ##
|
||||||
|
|
||||||
PROG="`basename $0`"
|
PROG="`basename $0`"
|
||||||
DIR="`dirname $0`"
|
#DIR="`dirname $0`"
|
||||||
|
DIR="`pwd`"
|
||||||
EXT=".mp3"
|
EXT=".mp3"
|
||||||
ADD="(Fixed)"
|
ADD="(Fixed)"
|
||||||
TIME="`which time`"
|
TIME="`which time`"
|
||||||
@ -119,14 +120,20 @@ time find $DIR -name "*${EXT}" | while read file; do
|
|||||||
title="`exiftool -Title "$file"`"
|
title="`exiftool -Title "$file"`"
|
||||||
title="${title//Title /}"
|
title="${title//Title /}"
|
||||||
title="${title// : /}"
|
title="${title// : /}"
|
||||||
|
title="${title//[^[:alnum:][:space:].]/}"
|
||||||
title="`echo $title`"
|
title="`echo $title`"
|
||||||
echo "Title=$title"
|
echo "Title=$title"
|
||||||
|
|
||||||
# Create the new file with the correct filename.
|
# Create the new file with the correct filename.
|
||||||
new_filename="$track. $title$EXT"
|
new_file="`dirname "$file"`/$track. $title$EXT"
|
||||||
|
|
||||||
if [[ ! -z "$track" && ! -z "$title" ]]; then
|
if [[ ! -z "$track" && ! -z "$title" ]]; then
|
||||||
echo "Creating '`basename "$new_filename"`'."
|
if [[ "$file" == "$new_file" ]]; then
|
||||||
mv -v "$file" "$new_filename"
|
echo "SKIP: Filename already correct! :)"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
echo "Creating '`basename "$new_file"`'."
|
||||||
|
mv -v "$file" "$new_file"
|
||||||
elif [[ -z "$track" && ! -z "$title" ]]; then
|
elif [[ -z "$track" && ! -z "$title" ]]; then
|
||||||
echo "No Track# found, leaving Title alone."
|
echo "No Track# found, leaving Title alone."
|
||||||
continue
|
continue
|
||||||
@ -135,10 +142,10 @@ time find $DIR -name "*${EXT}" | while read file; do
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Confirm the new file exists and remove the old file if so
|
# Confirm the new file exists and remove the old file if so
|
||||||
if [[ -e "$new_filename" ]]; then
|
if [[ -e "$new_file" ]]; then
|
||||||
echo "Success!"
|
echo "Success!"
|
||||||
else
|
else
|
||||||
error "$new_filename was not created successfully." 5
|
error "$new_file was not created successfully." 5
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user