Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trouble with Scripting Bridge




On 31 aug 2008, at 03.12, Peter Stirling wrote:

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).


<tester.zip>
From test.m :
NSPredicate* predicate = [NSPredicate predicateWithFormat:@"gapless=YES"];


this should probably be : ..... predicateWithFormat:@"gapless==YES"];
-----------------------------------
See the amazing new SF reel: Invasion of the man eating cucumbers from outer space.
On congratulations for a fantastic parody, the producer replies : "What parody?"


Tommy Nordgren
email@hidden



_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Trouble with Scripting Bridge (From: Peter Stirling <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.