[Pythonmac-SIG] accessing iPhoto star rating through appscript?
Dethe Elza
delza at livingcode.org
Thu Apr 19 16:24:10 CEST 2007
On 19-Apr-07, at 2:13 AM, Simon Brunning wrote:
> Err, that's iTunes. The OP wanted iPhoto.
Oops. Sorry 'bout that. My bad.
There are a couple of differences besides file names. All the images
appear to have a default rating of 0 and images have Captions rather
than Names. Also, rating go from 0 to 5 rather than 0 to 100, so you
don't have to divide to get stars.
library = plistlib.readPlist(os.path.expanduser('~/Pictures/
iPhoto Library/AlbumData.xml'))
for photo in library['Master Image List'].values():
if hasattr(photo, 'Rating') and photo.Rating > 0:
print '%s: %d stars' % (photo.Caption, photo.Rating)
How's that?
--Dete
I can't watch television without praying for nuclear holocaust. --
Bill Hicks
More information about the Pythonmac-SIG
mailing list