[Pythonmac-SIG] Two appscript problems, plus a stupid question
has
hengist.podd at virgin.net
Sat Mar 25 18:03:53 CET 2006
Andrew Barnert wrote:
>In my iTunes scripts, I do this by generating a big
>filter:
>[...]
Come to think of it, you can simplify the OR test a bit, since AND() and OR() can take more than one argument:
itunes = app('iTunes')
dids = [66, 67, 68, 69, 70]
idfilters = [its.database_ID == did for did in dids]
idfilter = idfilters[0]
if idfilters[1:]:
idfilter = idfilter.OR(*idfilters[1:])
print itunes.playlists[1].tracks.filter(idfilter).name()
HTH
has
--
http://freespace.virgin.net/hamish.sanderson/
More information about the Pythonmac-SIG
mailing list