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!
