04-23-2019, 03:46 PM
(04-21-2019, 10:17 PM)JST1963 Wrote:Please find my script below. Some comments that might be of interest:(04-21-2019, 08:35 PM)Tenbagger Wrote: I wrote a short bash script to extract embedded covers into their respective folders. I'll post it here if I can locate it...
Thx for the clear answer. And yes, please, I would love to try that script.
I had my library as a flat list but as soon as I found out cover art wasn't working in that sort of setup, I put all the songs back in a folder structure "drive:\Artist\Album\Song.ext".
Didn't do it manually but I did it with a lil (very basic) routine I wrote in (die hard programmers, cover your ears now!!!) in Excel using VBA.
J
Album art is extracted using ffmpeg, which is installed as a part of moOde. My collection has been built using iTunes with Apple Lossless (ALAC). From what I can see, ffmpeg will only extract .jpg from media files. (This was a not much of a problem in my collection.)
Code:
#!/bin/bash
#
# Script must be run from the folder containing subfolders for the artists,
# again containing subfolders for albums, and eventually containing .m4a-files with album art embedded.
#
# Album art in .jpg-format from the first .m4a-file in each folder is extracted.
#
IFS=$'\n'
for ARTIST in ./*
do
ARTN=$(echo $ARTIST | cut -d'/' -f2)
if [ -d "$ARTIST" ]
then
printf "Checking artist:\t${ARTN}\n"
for ALBUM in ${ARTIST}/*
do
ALBN=$(echo $ALBUM | cut -d'/' -f3)
if [ -d "$ALBUM" ]
then
FIRST=$(ls $ALBUM/*.m4a | head -1)
printf "Extracting .jpg from:\t${ALBN}\n"
ffmpeg -y -i $FIRST ${ALBUM}/Folder.jpg
else
printf "Not album:\t\t${ALBN}\n"
fi
done
else
printf "Not artist:\t${ARTN}\n"
fi
done