• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Trouble with Scripting Bridge
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trouble with Scripting Bridge


  • Subject: Re: Trouble with Scripting Bridge
  • From: Tommy Nordgren <email@hidden>
  • Date: Mon, 1 Sep 2008 02:24:56 +0200


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:
This email sent to email@hidden


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

  • Prev by Date: Re: Seemingly Simple Bindings Question
  • Next by Date: Re: activateIgnoringOtherApps
  • Previous by thread: Trouble with Scripting Bridge
  • Next by thread: NSDictionaryController + NSTableView
  • Index(es):
    • Date
    • Thread