Trouble with Scripting Bridge
Trouble with Scripting Bridge
- Subject: Trouble with Scripting Bridge
- From: Peter Stirling <email@hidden>
- Date: Sun, 31 Aug 2008 02:12:52 +0100
Hi,
I've been trying to do some python scripting of iTunes using pyobjc
and ScriptingBridge, and I've been having some problems (I reduced
everything to objective-c on its own in order work out if it was
caused by pyobjc).
According to:
http://developer.apple.com/releasenotes/scriptingautomation/RN-ScriptingBridge/index.html
running:
sdef /Applications/iTunes.app/ | sdp -f h --basename iTunes
should generate an objective-c header file which you can use in
conjunction with [SBApplication
applicationWithBundleIdentifier:@"com.apple.iTunes"]
(which it does).
An excerpt from the file I generated (included in the zip file):
@interface iTunesTrack : iTunesItem
...
@property BOOL gapless; // is this track from a gapless album?
...
@end
So there should be an accessor method on iTunesTrack objects called
gapless that returns a BOOL.
[track respondsToSelector:@selector(gapless)] returns YES
However it doesn't seem to work, the code provided in the zip archive
(when executed on my machine), produces a list of all the gapless
tracks in my mp3 collection, but every line ALSO claims that the track
is 'not gapless'.
(The original python code that I was using seemed to get different
answers depending on ordering of operations, including calling the
accessor twice in a row on the same object giving different answers).
Am I doing something wrong? The other accessors that I call appear to
return the right data, though I've not done exhaustive testing.
(As a background to what I'm doing, I want my iTunes playlists random
except for gapless cds, which I want to be seamless, the shuffle
provided by itunes can't make that distinction for itself).
Attachment:
tester.zip
Description: Zip archive
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden