Updates for yggdrasil
This commit is contained in:
@@ -19,30 +19,21 @@ echo Genre: $pgenre
|
||||
echo
|
||||
|
||||
for i in $@; do
|
||||
echo Checking "$i"
|
||||
if [ ! -f "$i" ]; then
|
||||
echo File doesn\'t exist. $i
|
||||
continue;
|
||||
fi
|
||||
ffartist="$(ffprobe -hide_banner -i $i 2>&1 | grep artist | grep -v 'album_artist' | cut -f 2 -d ':' | sed -e 's/^[[:space:]]*//' | sed -e 's/*[[:space:]]$//')"
|
||||
ffalbum="$(ffprobe -hide_banner -i $i 2>&1 | grep album | grep -v 'album_artist' | cut -f 2 -d ':' | sed -e 's/^[[:space:]]*//' | sed -e 's/*[[:space:]]$//')"
|
||||
ffgenre="$(ffprobe -hide_banner -i $i 2>&1 | grep genre | head -n 1 | cut -f 2 -d ':' | sed -e 's/^[[:space:]]*//' | sed -e 's/*[[:space:]]$//')"
|
||||
echo For \[$i\]...
|
||||
fartist="$(exiftool -Artist "$i" | sed 's/^Artist\s\+:\s\+//')"
|
||||
falbum="$(exiftool -Album "$i" | sed 's/^Album\s\+:\s\+//')"
|
||||
fgenre="$(exiftool -Genre "$i" | sed 's/^Genre\s\+:\s\+//')"
|
||||
unset tags
|
||||
echo Found artist \[$ffartist\]
|
||||
if [ "$partist" != "$ffartist" ]; then
|
||||
export tags=$tags" -metadata artist=\"$partist\""
|
||||
if [ "$partist" != "$fartist" ] || [ "$falbum" != "$palbum" ] || [ "$fgenre" != "$pgenre" ]; then
|
||||
echo Found artist \[$fartist\]
|
||||
echo Found album \[$falbum\]
|
||||
echo Found genre \[$fgenre\]
|
||||
echo Updating...
|
||||
mid3v2 -a "$partist" -A "$palbum" -g "$pgenre" "$i" &>/dev/null
|
||||
echo
|
||||
fi
|
||||
echo Found album \[$ffalbum\]
|
||||
if [ "$ffalbum" != "$palbum" ]; then
|
||||
export tags=$tags" -metadata album=\"$palbum\""
|
||||
fi
|
||||
echo Found genre \[$ffgenre\]
|
||||
if [ "$ffgenre" != "$pgenre" ]; then
|
||||
export tags=$tags" -metadata genre=\"$pgenre\""
|
||||
fi
|
||||
if [ "$tags" != "" ]; then
|
||||
bash -c "ffmpeg -hide_banner -i \"$i\"$tags \"$i.ffmpeg.mp3\""
|
||||
mv "$i.ffmpeg.mp3" "$i"
|
||||
fi
|
||||
echo
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user