您是否考虑过使用Scripting Bridge?它内置在操作系统中,也可以与 PyObjC 一起使用。没有不同的搜索 API,因为搜索内置于 AppleScript(其子句)中,它映射到 Scripting Bridge 中的 NSPredicate。
>>> from Foundation import *
>>> from ScriptingBridge import *
>>> itunes = SBApplication.applicationWithBundleIdentifier_(u"com.apple.itunes")
>>> tracks = itunes.sources()[0].libraryPlaylists()[0].tracks()
<SBElementArray @0x468a630: every ITunesTrack of ITunesLibraryPlaylist 0 of ITunesSource 0 of application "iTunes" (157)>
>>> predicate = NSPredicate.predicateWithFormat_(u'artist == "Pink Floyd"')
>>> tracks.filteredArrayUsingPredicate_(predicate)
<SBElementArray @0x457b6c0: ITunesTrack whose 'cmpd'{ 'relo':'= ', 'obj1':'obj '{ 'want':'prop', 'from':'exmn'($$), 'form':'prop', 'seld':'pArt' }, 'obj2':'utxt'("Pink Floyd") } of ITunesLibraryPlaylist 0 of ITunesSource 0 of application "iTunes" (157)>
另外,如果您是 AppleScript 的新手,我强烈推荐 Script Debugger 的dictionary explorer。