[Pythonmac-SIG] "Trashing" a file

2005-05-06 Thread Niko Matsakis
Dear Mailing List, I am working on a python program that needs to trash some files. Ideally, I would like it to move them to the Trash, but I'm not quite sure what the best way to do this is. For context, I am using appscript to talk to iTunes and load its list of songs. This works great.

Re: [Pythonmac-SIG] "Trashing" a file

2005-05-07 Thread Niko Matsakis
Thanks; I'll give this a try. Converting an Alias to a path isn't too difficult, there's an example in one of the sample appscripts I believe. Niko On May 7, 2005, at 1:00 AM, Bob Ippolito wrote: > On May 6, 2005, at 6:31 PM, Niko Matsakis wrote: > >> I am worki

[Pythonmac-SIG] appscript: selecting many songs in iTunes

2006-01-16 Thread Niko Matsakis
I have a program which identifies duplicates in iTunes and attempts to delete them automatically. It seems to work like a charm, except for one problem: once I have identified the set of songs to delete, I have to go through them one-by-one and delete them. So, if I have accumulated the d

Re: [Pythonmac-SIG] appscript: selecting many songs in iTunes

2006-01-16 Thread Niko Matsakis
> >> To that end, it seems like what I want to do is something like: >> >> allsongs.filter (its.database_ID in songdbids]).delete () >> >> except I don't think that the 'in' operator works, > > See ch.8 of the appscript manual for a list of supported comparison > forms. Not all Pyth

Re: [Pythonmac-SIG] appscript: selecting many songs in iTunes

2006-01-17 Thread Niko Matsakis
>> and it looks like I'm missing a get() in there in any case. > > Depends what you're trying to get. iTunes scripting interface is > pretty extensive, but a lot of the implementation is rather crude > and many commands won't work on more than one object at a time. So > the above might work

Re: [Pythonmac-SIG] appscript: selecting many songs in iTunes

2006-01-17 Thread Niko Matsakis
Shoot, fired that last e-mail off a bit early. Please ignore in favor of this more complete version. > Depends what you're trying to get. iTunes scripting interface is > pretty extensive, but a lot of the implementation is rather crude > and many commands won't work on more than one object

Re: [Pythonmac-SIG] appscript: selecting many songs in iTunes

2006-01-17 Thread Niko Matsakis
>> If this *is* just a limitation in iTunes, I have to admit I'm a >> bit of a loss as to how to proceed. > > Did you try the alternative script I suggested? How did that fare? Well, your alternative doesn't quite do what I want. The duplicates don't actually have the same database_ID: instea

Re: [Pythonmac-SIG] appscript: selecting many songs in iTunes

2006-01-18 Thread Niko Matsakis
> Well, I'll benchmark the two approaches against my full library and > report back on the results :). The question is whether having more > AppleEvents will be slower than selecting way too much data. > Neither is stupendously fast; the bottleneck is definitely issuing the individual delete co

Re: [Pythonmac-SIG] appscript: selecting many songs in iTunes

2006-01-18 Thread Niko Matsakis
> Still sounds very slow. What OS & iTunes versions; how big's the > playlist and what % is duplicates? I mocked up a 550-item playlist > containing 500 duplicates and my script took 50 secs to get through > that (iTunes 6.0.1; OS 10.4.3); 10 secs if I close the playlist > window first so i