How to reload album artwork (automatically) (iTunes/iOS)
Hi.
This is not so much a question, more like a solution I wanted to share. Maybe it will help somebody else.
So I had noticed that since iTunes 12.x artwork for a lot of songs/albums was missing in iTunes. I don't know why but I do know it also effects artwork on my iOS devices. If the album artwork is missing in iTunes it will also be missing on my iPhone.
Solutions I found included deleting the iTunes artwork cache folder but that didn't help in my case. The only thing that helped was to do a "Get info" on the first track of the ablum whose artwork was missing. That somehow forces iTunes to reload the artwork for this album. But as you can image, unless you only have a dozen albums this can get very tiresome and annoying very soon, especially if - for whatever reason - it happens all over again and the artwork goes missing again. Also, there are tracks/albums (esp. compilations) that will only show artwork if you do the "Get info" on more than just the first track (couldn't figure out why).
This is a case that calls for automation (Applescript). So I wrote a little script I would like to share with you. I hope it will save you some time & frustration.
Please note:
- I've only tested this on my music/audio book files (I don't keep movies in my library once I've watched them).
- The script will show you some kind of progress bar but only if you save it as an app in scrip editor. Saved as a normal script (I think) it will still work but it won't show a progress bar.
- If there are errors it will report them in a text log file on your Desktop so you know which tracks are giving you trouble and what kind of errors you're dealing with.
How to use it:
1. Select one track of every album whose artwork is missing (it doesn't matter which track).
2. Tell the script to reload artwork just for the first track of every album (the first option).
3. Scroll allround in iTunes, change the view or whatever it takes to determine if there are still albums that have no artwork.
4. Again: select one track of every album whose artwork is missing (it doesn't matter which track).
5. Run the script again and this time choose the second option: reload artwork for all songs of each album selected.
I found there may still be a handful of albums that will not show artwork. But only very very few (2 albums in my case).
The good thing is that reloading artwork into iTunes with this script does not change the song files. Meaning among other things: you can reload artwork as many times as you like with this script, it won't affect the size of your backup (as it would if it changed the files).
So here is the script (Applescript):
set normal to true
set progress completed steps to 0
set progress description to "Reloading artwork for selected tracks..."
set thechoice to (display dialog "Reload artwork for" buttons {"First track only", "For every track", "Cancel"} default button 1 with icon note)
set theButtonName to the button returned of thechoice
if theButtonName is "Cancel" then
error number -128
else if theButtonName is not "First track only" then
set normal to false
end if
tell application "iTunes"
if selection is not {} then
set sel to selection
set songs_selected to (number of items in sel) as number
repeat with this_track in sel
tell this_track
set albumName to album of this_track as text
if normal is true then
set firstTrack to my getFT(albumName)
else
set firstTrack to my getFT_all(albumName)
end if
end tell
my progresscounter(songs_selected)
end repeat
beep 2
end if
end tell
on getFT(albumName)
tell application "iTunes"
try
set firstTracks to item 1 of ((every track of library playlist 1 ¬
whose album is albumName) as list)
set xy to firstTracks's artworks
delay 0.1
on error errMsg number errorNumber
set theLine to (do shell script ¬
"date +'%Y-%m-%d %H:%M:%S'" as string) & " " & quoted form of ("ERROR!
Details:
Album: '" & albumName & "'
" & "ERROR MESSAGE: " & quoted form of errMsg & "
-----------------
")
do shell script "echo " & theLine & " >> ~/Desktop/Errors_iTunes_ArtworkReload.log"
end try
end tell
end getFT
on getFT_all(albumName)
tell application "iTunes"
try
set firstTracks to items of ((every track of library playlist 1 ¬
whose album is albumName) as list)
repeat with thisitem in firstTracks
set xy to thisitem's artworks
delay 0.1
end repeat
on error errMsg number errorNumber
set theLine to (do shell script ¬
"date +'%Y-%m-%d %H:%M:%S'" as string) & " " & quoted form of ("ERROR!
Details:
Album: '" & albumName & "'
" & "ERROR MESSAGE: " & quoted form of errMsg & "
-----------------
")
do shell script "echo " & theLine & " >> ~/Desktop/Errors_iTunes_ArtworkReload.log"
end try
end tell
end getFT_all
on progresscounter(total)
set progress total steps to total as integer
set progress completed steps to (progress completed steps) + 1
end progresscounterHope it helps.
OS X Mountain Lion (10.8.2), null