Skip to content

Instantly share code, notes, and snippets.

@tomoyat1
Created August 11, 2017 04:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomoyat1/fd090d3d620da1e52fcf04eee2359328 to your computer and use it in GitHub Desktop.
Save tomoyat1/fd090d3d620da1e52fcf04eee2359328 to your computer and use it in GitHub Desktop.
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