[Pythonmac-SIG] accessing iPhoto star rating through appscript?

Dethe Elza delza at livingcode.org
Thu Apr 19 02:00:42 CEST 2007


Following up on my earlier reply, here is a script to print out all  
the star ratings:

import plistlib, os
tunes = plistlib.readPlist(os.path.expanduser('/~/Music/iTunes/iTunes  
Music Library.xml'))
for track in tunes.Tracks.values():
     if hasattr(track, 'Rating'):
         print '%s: %d stars' % (track.Name, track.Rating / 20)
     else:
         print '%s: not rated' % track.Name

--Dethe


"...coding isn't the poor handmaiden of design or analysis. Coding is
where your fuzzy, comfortable ideas awaken in the harsh dawn of reality.
It is where you learn what your computer can do. If you stop coding,
you stop learning."     Kent Beck, Smalltalk Best Practice Patterns




More information about the Pythonmac-SIG mailing list