iTunes Album Art With Amazon Covers Using PHP/JS

How to get album art for your favorite mp3 album? It's pretty easy. There's lot of little programs and scripts to add custom covers for albums, but when you have hundreds of thousands albums it's better to make some batch programming.

How to setup itunes album art in 3 easy steps?
  1. Put all your mp3's in artist - album names.
  2. Download album cover from
  3. Put this cover for all tracks in itunes album.
Let's play with api

Ok, so let's get started. First of all we need Amazon Web Services account.After the registration progress we can create cust
om app that will search and download covers of our albums. We'll be using amazon web services api with our secret Access Key ID and Secret Access Key. We want to have a little PHP crawler that will go through all of folders and search for album art.
Fille called getCovers.php:
We can execute this script from command line
c:> php getCovers.php "c:\mp3"

first parameter is our main folder name where we have stored all our mp3 albums. In each folder an cover.jpg file will appear.
Now, we must put this covers to iTunes. We can do it manually by right click on song and adding cover from disc. Of course it's not very efficient way to do that specially when we have tons of mp3's. So we can use apple scripting advantages. Specially when we work on Windows we'll use COM api for iTunes. You can obtains Apple's COM SDK from here if you are curious what can be done with iTunes.

iTunes remote control via JScript

Now we have to iterate trough all files in our iTunes library and put cover.jpg file to each of them. We'll use simple Windows JScript with Apples COM interface and FileSystemObject to operate on our disc. Let's call out script putCovers.js:

We can execute this script from command line
c:> cscript putCovers.js

It will take a while depending on your mp3 database size. Now you see all covers in your Cover Flow View in iTunes and you can synchronize albums to your iPod touch or iPhone for even better album view experience :)

3 komentarze:

duhastmich said...

this scrript isnt working as u hv mentioned... can u plz help me out..... if its working at with you...

Josh said...

You have to have a Web Services ID. Make sure you have that to use it.

NJ said...

nice article! Do you know whether the AddArtworkFromFile() function writes the artwork into the id3 tag of the mp3 or whether it uses the "external" itunes artwork variant with the .itc2 files?
thanks and greetings