Page 1 of 1

matching attribute kMDItemDownloadedDate

PostPosted: Mon Jul 29, 2013 1:56 pm
by bobert
I don't see a way to match kMDItemDownloadedDate directly in a rule? Not even the "Other..." has this attribute available. Is there a way to add any arbitrary spotlight attribute to Other...?

Re: matching attribute kMDItemDownloadedDate

PostPosted: Mon Jul 29, 2013 3:51 pm
by sjk
Try "Date Added" under "Other…".

Re: matching attribute kMDItemDownloadedDate

PostPosted: Mon Jul 29, 2013 5:15 pm
by bobert
Thanks, but that didn't work. Looks like "Date Added" is associated with kMDItemDateAdded. I think this is the same as 'Date Added' in Hazel's one of rule conditions. There is also Content Date Added, but that seems to be same as file's added date. That doesn't work because it tends to be of the original file's date, not the downloaded date.

Downloaded Date is stored as com.apple.metadata:kMDItemDownloadedData as binary plist.

Re: matching attribute kMDItemDownloadedDate

PostPosted: Mon Jul 29, 2013 9:53 pm
by sjk
That looks right; I'd botched my earlier test. :oops:

Maybe you could work around the missing kMDItemDownloadedDate attribute in Hazel (and Spotlight searches) using Raw Query, e.g.:

Code: Select all
kMDItemDownloadedDate >= $time.today(-7)

… to match files downloaded within the last 7 days.

bobert wrote:Is there a way to add any arbitrary spotlight attribute to Other...?

Third-party Spotlight plug-ins do it, e.g.:

Code: Select all
% mdimport -A | grep -i dvdpedia
'com_bruji_pediaimporter_dvd_director'      'Director'      'DVDpedia movie director'      '(null)'
'com_bruji_pediaimporter_dvd_starring'      'Starring'      'DVDpedia movie cast'      '(null)'
'com_bruji_pediaimporter_dvd_studio'      'Studio'      'DVDpedia movie studio'      '(null)'
'com_bruji_pediaimporter_dvd_theatrical'      'Release'      'DVDpedia movie release date'      '(null)'

The second/third fields are the "Other" Attribute/Description displayed in a Spotlight search (called Name/Description in Hazel).

Writing code for one is out of my league. I'm challenged enough just trying to construct more than a basic Raw Query, which is why my earlier example is weak.

Re: matching attribute kMDItemDownloadedDate

PostPosted: Tue Jul 30, 2013 3:30 pm
by Mr_Noodle
Oddly, even though I can see it set for some files, I can't find it in the list of Spotlight attributes. It doesn't seem to show up in Spotlights UI either. I think for the time being you're best off using a script using sjk's info as a start.