[Pythonmac-SIG] Any appscript / iTunes experts out there?

Matt Barnicle mattb at wageslavery.org
Wed Mar 5 03:08:28 CET 2008


>> Anyone know how to add artwork to a file??
>
>
> I just did something like this myself a few days ago. :) A quick
> snippet from my script:
>
> iTunes = app('iTunes')
> artworksForTrack = iTunes.current_track.artworks.get()
> artwork = artworksForTrack[0].get()
> dataString = artwork.data.get().data
> # Assume fname is your file name
> f = open(fname, 'wb')
> # When we write, we chop off the first 221 bytes to get rid of the
> pict header
> f.write(dataString[222:])
> f.close()
>
> Hope it helps!
>
>
> Matt Patenaude, Developer for OS X and the Web
> Blog: mattpat.net
> Portfolio: mattpatenaude.com

Hi Matt.  Yes, that certainly helps, thank you.  Although, what I'm trying
to do is add artwork to a track, not retrieve it and write it to a file as
your example is doing.  But this will also come in handy one day for
sure..

- m@



More information about the Pythonmac-SIG mailing list