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


_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to