Pull the remaining needed information.
This commit is contained in:
parent
20161e48c5
commit
0f83256e05
77
refactor_music_library.sh
Normal file → Executable file
77
refactor_music_library.sh
Normal file → Executable file
@ -102,7 +102,7 @@ function migrate_music {
|
|||||||
|
|
||||||
new_file="$title$EXT"
|
new_file="$title$EXT"
|
||||||
|
|
||||||
# Retrieve and clean the Track#
|
# Retrieve and clean the Track Number
|
||||||
track=""
|
track=""
|
||||||
# Get raw value
|
# Get raw value
|
||||||
track="`exiftool -Track "$file"`"
|
track="`exiftool -Track "$file"`"
|
||||||
@ -120,19 +120,90 @@ function migrate_music {
|
|||||||
new_file="$track. $new_file"
|
new_file="$track. $new_file"
|
||||||
|
|
||||||
# Add the Album and Year.
|
# Add the Album and Year.
|
||||||
|
album=""
|
||||||
|
album="`exiftool -Album "$file"`"
|
||||||
|
album="${album//Album /}"
|
||||||
|
album="${album// : /}"
|
||||||
|
album="${album//[^[:alnum:][:space:].]/}"
|
||||||
|
album="`echo $album`"
|
||||||
|
while [[ "$album" == *" "* ]]; do
|
||||||
|
album="${album// / }"
|
||||||
|
done
|
||||||
|
echo "*** Album=$album"
|
||||||
|
|
||||||
|
year=""
|
||||||
|
year="`exiftool -Year "$file"`"
|
||||||
|
year="${year//Year /}"
|
||||||
|
year="${year// : /}"
|
||||||
|
year="${year//[^[:alnum:][:space:].]/}"
|
||||||
|
year="`echo $year`"
|
||||||
|
while [[ "$year" == *" "* ]]; do
|
||||||
|
year="${year// / }"
|
||||||
|
done
|
||||||
|
echo "*** Year=$year"
|
||||||
|
|
||||||
|
parent=""
|
||||||
|
if [[ -s $year && -s $album ]]; then
|
||||||
|
parent="$year - $album"
|
||||||
|
else
|
||||||
|
parent="$year$album"
|
||||||
|
fi
|
||||||
|
|
||||||
new_file="$parent/$new_file"
|
new_file="$parent/$new_file"
|
||||||
|
|
||||||
# Add the Artist and Genre.
|
# Add the Artist.
|
||||||
|
artist=""
|
||||||
|
artist="`exiftool -Artist "$file"`"
|
||||||
|
artist="${artist//Artist /}"
|
||||||
|
artist="${artist// : /}"
|
||||||
|
artist="${artist//[^[:alnum:][:space:].]/}"
|
||||||
|
artist="`echo $artist`"
|
||||||
|
while [[ "$artist" == *" "* ]]; do
|
||||||
|
artist="${artist// / }"
|
||||||
|
done
|
||||||
|
echo "*** Artist=$artist"
|
||||||
|
|
||||||
|
band=""
|
||||||
|
band="`exiftool -Band "$file"`"
|
||||||
|
band="${band//Band /}"
|
||||||
|
band="${band// : /}"
|
||||||
|
band="${band//[^[:alnum:][:space:].]/}"
|
||||||
|
band="`echo $band`"
|
||||||
|
while [[ "$band" == *" "* ]]; do
|
||||||
|
band="${band// / }"
|
||||||
|
done
|
||||||
|
echo "*** Band=$band"
|
||||||
|
|
||||||
|
album_artist=""
|
||||||
|
album_artist="`exiftool -Albumartist "$file"`"
|
||||||
|
album_artist="${album_artist//Albumartist /}"
|
||||||
|
album_artist="${album_artist// : /}"
|
||||||
|
album_artist="${album_artist//[^[:alnum:][:space:].]/}"
|
||||||
|
album_artist="`echo $album_artist`"
|
||||||
|
while [[ "$album_artist" == *" "* ]]; do
|
||||||
|
album_artist="${album_artist// / }"
|
||||||
|
done
|
||||||
|
echo "*** Albumartist=$album_artist"
|
||||||
|
|
||||||
|
# Prefer Artist, then Band, then Albumartist
|
||||||
|
grandparent=""
|
||||||
|
if [[ -s $album ]]; then
|
||||||
|
grandparent="$album"
|
||||||
|
elif [[ -s $band ]]; then
|
||||||
|
grandparent="$band"
|
||||||
|
elif [[ -s $album_artist ]]; then
|
||||||
|
grandparent="$album_artist"
|
||||||
|
else
|
||||||
|
grandparent="Unknown"
|
||||||
|
fi
|
||||||
|
|
||||||
new_file="$grandparent/$new_file"
|
new_file="$grandparent/$new_file"
|
||||||
|
|
||||||
# Move the file.
|
# Move the file.
|
||||||
new_file="$NEW/$new_file"
|
new_file="$NEW/$new_file"
|
||||||
$command "$file" "$new_file"
|
$command -v "$file" "$new_file"
|
||||||
|
|
||||||
|
echo "*** Finished file!"
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "* Moving INTERIM files to NEW."
|
echo "* Moving INTERIM files to NEW."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user