[Pythonmac-SIG] ScriptingBridge vs. AppScript

Jon Smith smithharder at gmail.com
Fri Oct 10 20:10:01 CEST 2008


Saddly, I get the same error with :t2 =
app('iTunes').sources()[0].playlists()[0].tracks()
print len(t2)

Which I think is a more Apples to Apples comparison. I suspect something
different is being done in the ScriptingBridge than in appscript. I'll give
the pre-release appscript a try and see if there is a difference.

-Joe

On Thu, Oct 9, 2008 at 8:59 PM, Ned Deily <nad at acm.org> wrote:

> In article
> <fa198ccc0810091945w7a9f9e70qb07a1825ef01c113 at mail.gmail.com>,
>  "Jon Smith" <smithharder at gmail.com> wrote:
> > I've been using Appscript and have been incredibly happy with it. However
> > I'm having a ton of problems getting the list of tracks from my library.
> I
> > was assuming the problem was with my library/iTunes itself however I can
> get
> > the track list with ScriptingBridge. Am I doing something wrong? Why
> would
> > ScriptingBridge work and AppScript Timeout? Any ideas.
> >
> > #!/usr/bin/env python
> > from ScriptingBridge import *
> > from appscript import *
> >
> > def main(argv=None):
> >     itunes =
> > SBApplication.applicationWithBundleIdentifier_("com.apple.iTunes")
> >     lib = itunes.sources()[0].playlists()[0]
> >     tracks = lib.tracks()
> >     print len(tracks)
> >     tracks2 =
> >
> app(u'/Applications/iTunes.app').library_playlists['Library'].file_tracks.get(
> > )
>
> FWIW, appscript seems to have no problems for me returning a track list
> of length 21361.  You're not quite doing an Apple-to-app(le)script
> comparison, though.  I get a somewhat faster response from iTunes if I
> construct an appscript reference similar to your SB one:
>
>   app('iTunes').sources()[0].playlists()[0].tracks()
>
> This is using the pre-release appscript 0.19 with the python.org python
> 2.5.2 on 10.5.5 Intel.
>
> I see your track count is 38447.  2**16 > 38447 > 2**15, so could there
> possibly be some overflow problem somewhere?
>
> --
>  Ned Deily,
>  nad at acm.org
>
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20081010/1e63fcd9/attachment.htm>


More information about the Pythonmac-SIG mailing list