[Pythonmac-SIG] Adding a track to an iTunes playlist (appscript)

has hengist.podd at virgin.net
Thu Oct 20 15:42:07 CEST 2005


David wrote:

>>>You need something like:
>>>
>>>a_track = app('Itunes').playlists['Library'].tracks[0]
>>>a_playlist = app('Itunes').playlists['Whatever']
>>>app('Itunes').duplicate(a_track, to=a_playlist)
>>>
>>
>>
>>Yup. Or:
>>
>>a_track = app('Itunes').playlists['Library'].tracks[0]
>>a_playlist = app('Itunes').playlists['Whatever']
>>a_track.duplicate(to=a_playlist)
>>
>
>Did you try that with your iTunes?
>
>Both of the methods above give me the same error message:

Oops, there's an unrelated error in the above scripts - elements are one-indexed, not zero-indexed. (iTunes returns the wrong error code, btw; should be -1728, not -1708.) Change the first line to:

a_track = app('Itunes').playlists['Library'].tracks[1]

and it works.

HTH

has
-- 
http://freespace.virgin.net/hamish.sanderson/


More information about the Pythonmac-SIG mailing list