Only check additonal band slots if the more important ones are empty. Fix bug in if statement, was checking wrong variable.

This commit is contained in:
Hyperling 2025-04-13 11:47:33 -07:00
parent fa175639d8
commit bdc18dd727

View File

@ -187,30 +187,34 @@ function migrate_music {
echo "*** Artist=$artist" echo "*** Artist=$artist"
band="" band=""
band="`exiftool -Band "$file"`" if [[ -z "$artist" ]]; then
band="${band//Band /}" band="`exiftool -Band "$file"`"
band="${band// : /}" band="${band//Band /}"
band="${band//[^[:alnum:][:space:].]/}" band="${band// : /}"
band="`echo $band`" band="${band//[^[:alnum:][:space:].]/}"
while [[ "$band" == *" "* ]]; do band="`echo $band`"
band="${band// / }" while [[ "$band" == *" "* ]]; do
done band="${band// / }"
echo "*** Band=$band" done
echo "*** Band=$band"
fi
album_artist="" album_artist=""
album_artist="`exiftool -Albumartist "$file"`" if [[ -z "$artist" && -z "$band" ]]; then
album_artist="${album_artist//Albumartist /}" album_artist="`exiftool -Albumartist "$file"`"
album_artist="${album_artist// : /}" album_artist="${album_artist//Albumartist /}"
album_artist="${album_artist//[^[:alnum:][:space:].]/}" album_artist="${album_artist// : /}"
album_artist="`echo $album_artist`" album_artist="${album_artist//[^[:alnum:][:space:].]/}"
while [[ "$album_artist" == *" "* ]]; do album_artist="`echo $album_artist`"
album_artist="${album_artist// / }" while [[ "$album_artist" == *" "* ]]; do
done album_artist="${album_artist// / }"
echo "*** Albumartist=$album_artist" done
echo "*** Albumartist=$album_artist"
fi
# Prefer Artist, then Band, then Albumartist # Prefer Artist, then Band, then Albumartist
grandparent="" grandparent=""
if [[ -n $album ]]; then if [[ -n $artist ]]; then
grandparent="$artist" grandparent="$artist"
elif [[ -n $band ]]; then elif [[ -n $band ]]; then
grandparent="$band" grandparent="$band"