William Reardon wrote: > I'm attempting to programmatically rate a song in iTunes. I hacked together > the following snippet in Applescript, but after reading the docs, I can't > figure out how to convert the "every file..." mechanic to the py-appscript > equivalent. Any suggestions? > > tell application "iTunes" > set ts to (every file track of playlist "Library" whose name is track_name > and artist is track_artist and album is track_album) > repeat with t in ts > set rating of t to track_rating > end repeat > end tell
That can probably tidy up to: tell application "iTunes" set rating of (every file track of library playlist 1 whose name is track_name and artist is track_artist and album is track_album) to track_rating end tell Run it through ASTranslate (with some appropriate values) and clean up the resulting Python code, and you should get this: app(u'iTunes').library_playlists[1].file_tracks[((its.name == track_name).AND(its.artist == track_artist)).AND(its.album == track_album)].rating.set(track_rating) HTH has _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig