[Pythonmac-SIG] Appscript, adding files to iTunes
has
hengist.podd at virgin.net
Thu Apr 27 12:56:12 CEST 2006
Daniel Thorpe wrote:
>Hi, I'm wondering if anyone can help me with an Appscript / iTunes
>utility I'm trying to write. Does anyone know how I add m4a files to
>my iTunes library using appscript?
>
>So far, I have a list of filenames, which I want to add to my library
>(which I've got a reference to). According to app('iTunes').add.help
>() I have to pass the function a list of Alias(s). I think this means
>Finder alias files, but I can't seem to be able to create them using
>app('Finder').make().
Nope, no relation to Finder. 'Alias' is an AE type. Ch.6 of the appscript manual lists the common AE type <-> Python mappings.
Example:
from appscript import *
from macfile import *
files = [Alias(u'/Users/foo/some.mp3'), Alias(u'/Users/foo/another.mp3'), ...]
itunes = app('iTunes')
itunes.add(files, to=itunes.playlists['Library'])
HTH
has
--
http://freespace.virgin.net/hamish.sanderson/
More information about the Pythonmac-SIG
mailing list