> Do you think this is more efficient than simply storing the previously modified date and doing a string comparison?
It's what has been used in the past, but that doesn't mean to say it's more efficient. The plugins architecture needs improving a lot so any ideas to make it easier as you work would be welcome. > I also have one more question. I'm having trouble adding objects to the catalog. I don't believe objectsForEntry: I'd suggest using NSLog(@"text here"); when debugging. Also, try using breakpoints and running Quicksilver from within XCode in debug mode. See http://qsapp.com/wiki/Building_Quicksilver and http://qsapp.com/wiki/Debugging_Quicksilver#Debugging_Plugins If you haven't come across it already, I'd keep The plugin development reference close by (it's linked to in the 2nd of those links above) As for your question: Quicksilver needs some way of knowing when/why you want to call the objectsForEntry method. The two cases are when you right arrow into an object, or when you enable a Catalog item in the Catalog Preferences. For this 2nd case, you need a QSPresetAddition in the .plist Again, the Plugin Development Reference describes this. I also use both method (right arrow into 1Password.app and check boxes in the catalog prefs) in my 1Password plugin. One good way to see how plugins work is to read existing plugin code. On a side note, I've already asked Nicholas for the original iTunes module source, so should hopefully get it soon. When he's next online I'll ping him. The work you're doing here is still valuable though as it'll probably use newer methods and APIs for tying into iTunes On 12 June 2011 10:54, James Parker <[email protected]> wrote: > Do you think this is more efficient than simply storing the previously > modified date and doing a string comparison? > > I also have one more question. I'm having trouble adding objects to the > catalog. I don't believe objectsForEntry: is being called (I added a > notification for debugging). In the plist, I added the type to > QSRegistration > QSTypeDefinitions and QSObjectHandlers. Do I need to add it > somewhere else? I just uploaded the project to github if you want to take a > look: > > https://github.com/jprider63/Quicksilver-iTunes-Module > > JP > > > On Sat, Jun 11, 2011 at 7:13 PM, Patrick Robertson < > [email protected]> wrote: > >> You should do this within the indexIsValidFromDate >> method. >> >> I do something similar in my 1Password plugin, Check out line 30 onwards >> from >> https://github.com/pjrobertson/1Password-Plugin/blob/master/OnePasswordSource.m >> I do exactly the same thing, but for a different file. >> >> Quicksilver checks using that method regularly to see if it needs to >> bother re-scanning using the objectsForEntry: method. If the method >> mentioned above returns TRUE then the objectsForEntry method is run, >> otherwise nothing changes. >> >> On 12 June 2011 09:06, jp63 <[email protected]> wrote: >> >>> Hi >>> >>> Yup, I had heard there was some need for it so I thought I'd try and >>> contribute. The theory behind me doing this was to test whether the >>> iTunes library had been modified and only rescan it if it had been >>> modified. Do you think there's a better way using the Quicksilver >>> catalog date? >>> >>> JP >>> >>> On Jun 11, 1:45 pm, Henning Jungkurth <[email protected]> >>> wrote: >>> > Hi, >>> > >>> > trying to rewrite the iTunes Plugin? :-) >>> > >>> > What you're doing seems fine. I just don't understand why you are >>> > trying to do that. Quicksilver saves the date it updated a catalog >>> > entry by itself. For what do you need the modification date in your >>> > quicksilver object? >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > On Sat, Jun 11, 2011 at 6:56 PM, jp63 <[email protected]> wrote: >>> > > Hi >>> > >>> > > I'm writing my first quicksilver plugin and I was wondering if the >>> > > following is acceptable: >>> > >>> > > // iTunesModuleSource.m >>> > >>> > > - (NSArray *) objectsForEntry:(NSDictionary *)theEntry{ >>> > > .... >>> > > // Get last modified date of iTunes library. >>> > > NSError *err = nil; >>> > > NSDictionary *xmlAttributes = [[ NSFileManager defaultManager ] >>> > > attributesOfItemAtPath:location error:&err ]; >>> > > if ( err) { >>> > > [ theEntry setValue:@"Error retrieving last modified date of >>> > > iTunes library." forKey:NSFileModificationDate ];// Can i do this??? >>> > > } >>> > > else { >>> > > [ theEntry setValue:[ xmlAttributes >>> > > objectForKey:NSFileModificationDate ] >>> > > forKey:NSFileModificationDate ];// Can i do this??? >>> > > } >>> > > } >>> > >>> > > Is it okay for me to add a value to theEntry for the key >>> > > NSFileModificationDate? In indexIsValidFromDate:forEntry:, I test to >>> > > see if the iTunes library has been modified since the last time it's >>> > > been read. >>> > >>> > > Thanks ahead of time! >> >> >> >
