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 progresscounter


Hope it helps.

OS X Mountain Lion (10.8.2), null

Posted on Apr 15, 2016 7:47 AM

Reply
6 replies

Apr 15, 2016 10:06 AM in response to Rookie X

Oh, I've just noticed that the subject line is incomplete. It should have been:


How to reload missing album artwork (automatically)


And just to avoid misunderstandings: the artwork is not missing in the files, just from the iTunes database.

The script above only makes sense if you have the artwork embedded in your music files but for some unknown reason it isn't showing (correctly) in iTunes.

Apr 15, 2016 10:26 AM in response to Limnos

Thanks. I didn't know that one. It's definitely related.


The difference is basically that my script will save you the work of choosing the right tracks to refresh (sometimes only the first track of each album is needed, but exceptionally all of them). You can simply take a playlist, choose any track without artwork and run the script once, twice if necessary. It just saves time.


Of course, the script you linked to will do the same in the end. You'll just have to manually choose the first track of every album without artwork and then run it. Then for the remaining albums without artwork you choose all of their tracks. It's just more work. In the end it's just a matter of how much time you want to spend doing this.

Apr 15, 2016 11:01 AM in response to Rookie X

1. Select one track of every album whose artwork is missing (it doesn't matter which track).

If you have 500 albums and 40 are missing tracks that's a lot of hunting and choosing vs. doing a blanket approach.


I just ran the Refresh script on 500 tracks (albeit none with anything missing) in my iTunes 7.5 (yes, 7.5) running on a late 2008 MacBook with Mavericks. It took 6 seconds. Unless you have a truly huge library of 500,000 tracks (in which case how is a manual selection stage going to not take a lot of time?), or are running everything off a G4 (and if you can afford 500,000 tracks why can't you afford a new model Mac? 😉 ) you would probably barely have time to get out of the room to the kitchen before it was done.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to reload album artwork (automatically) (iTunes/iOS)

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.