[Pythonmac-SIG] controlling iTunes with appscript

Simon Brunning simon at brunningonline.net
Tue Nov 28 18:18:44 CET 2006


On 11/28/06, Jamie Stuart <jamie at eurotalk.com> wrote:
> Hi,
> I'm completely new to Python and something is evading me completely. I'm
> using appscript to add (and convert to mp3) a bunch of .aif files to
> iTunes. I also want to create a new playlist which they are all added to
> and then tagged. This is what I have at the moment:
>
> itunes = app(id='com.apple.itunes')
> itunes.run()
> itunes.make(new=k.playlist, with_properties={k.name:'New Playlist'})
> addfile = itunes.add(Alias (outputfile), to=itunes.playlists['New
> Playlist'])
> convertfile = itunes.convert(addfile)
> itunes.delete(addfile)
>
>
> The resultant mp3 file doesn't appear in the playlist - only in the
> library.

Try creating the playlist with:

my_playlist = itunes.make(new=k.user_playlist,
with_properties={k.name:'New Playlist'})

Does this help?

> Also, how do I tag the files (title, artist, album?) as I can't
> see how this would be done.

track.name.set('New name')

> Another thing is how can I package up appscript so this thing can be
> distributed on CD-ROM?

Sorry - you're on your own with this!

-- 
Cheers,
Simon B
simon at brunningonline.net
http://www.brunningonline.net/simon/blog/


More information about the Pythonmac-SIG mailing list