Re: Trouble with Scripting Bridge
Re: Trouble with Scripting Bridge
- Subject: Re: Trouble with Scripting Bridge
- From: Fabian <email@hidden>
- Date: Wed, 3 Sep 2008 10:18:21 +0200
Looks like you are getting the track for nothing. Try changing
[track get];
to
track = [track get];
or you will just be querying the reference for gapless.
F.
On Mon, Sep 1, 2008 at 4:21 PM, Peter Stirling
<email@hidden> wrote:
> '=' and '==' are equivalent in predicate format strings (predicates are
> queries, so assignment isn't possible)
>
> I should probably have made clear in the first post:
>
> The program returns a list of all tracks that are marked as gapless from my
> mp3 collection (and only those marked gapless), the problem is that those
> objects all say that the tracks aren't gapless.
>
> On 1 Sep 2008, at 1:24 am, Tommy Nordgren wrote:
>
>>
>> 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
>
_______________________________________________
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