Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Script to extract cover art from music, organized as artist/album/track
#!/bin/zsh
for ar in ./*; do
if [ -d $ar ]; then
for al in $ar/*; do
alname=$(echo $al | cut -d'/' -f3)
coverart=$al/$alname.jpg
firstfile=$al/$(ls $al | head -1)
echo "dir:\t\t$al"
echo "coverart:\t$coverart"
echo "first file:\t$firstfile"
echo "\n"
ffmpeg -i "$firstfile" "$coverart"
done
else
echo "Ignoring file" $ar
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment