]> arthur.barton.de Git - netatalk.git/blob - etc/spotlight/slmod_rdf_map.c
Add filetype searching and searching by dates
[netatalk.git] / etc / spotlight / slmod_rdf_map.c
1 /*
2   Copyright (c) 2012 Frank Lahm <franklahm@gmail.com>
3
4   This program is free software; you can redistribute it and/or modify
5   it under the terms of the GNU General Public License as published by
6   the Free Software Foundation; either version 2 of the License, or
7   (at your option) any later version.
8
9   This program is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   GNU General Public License for more details.
13 */
14
15 #ifdef HAVE_CONFIG_H
16 #include "config.h"
17 #endif /* HAVE_CONFIG_H */
18
19 #include <unistd.h>
20
21 #include "slmod_rdf_map.h"
22
23 #define NOTSUPPORTED NULL
24 #define SPECIAL      NULL
25
26 struct spotlight_rdf_map spotlight_rdf_map[] = {
27     /* srm_spotlight_attr               srm_type,   srm_rdf_attr */
28     {"*",                               srmt_str,   "File:Name"},
29     {"kMDItemTextContent",              srmt_fts,   ""},
30
31     /* Filesystem metadata */
32     {"kMDItemFSLabel",                  srmt_num,   NOTSUPPORTED},
33     {"kMDItemDisplayName",              srmt_str,   "File:Name"},
34     {"kMDItemFSName",                   srmt_str,   "File:Name"},
35     {"kMDItemFSContentChangeDate",      srmt_date,  "File:Modified"},
36
37     /* Common metadata */
38     {"kMDItemContentCreationDate",      srmt_date,  "Doc:Created"},
39     {"kMDItemContentModificationDate",  srmt_date,  "File:Modified"},
40     {"kMDItemAttributeChangeDate",      srmt_date,  "File:Modified"},
41     {"kMDItemAuthors",                  srmt_str,   "Doc:Author"},
42     {"kMDItemCopyright",                srmt_str,   "File:Copyright"},
43     {"kMDItemCountry",                  srmt_str,   "Image:Country"},
44     {"kMDItemCreator",                  srmt_str,   "DC:Creator"},
45     {"kMDItemDurationSeconds",          srmt_num,   "Audio:Duration"},
46     {"kMDItemNumberOfPages",            srmt_num,   "Doc:PageCount"},
47     {"kMDItemTitle",                    srmt_str,   "DC:Title"},
48     {"_kMDItemGroupId",                 srmt_type,  "File:Mime"},
49     {"kMDItemContentTypeTree",          srmt_type,  "File:Mime"},
50
51     /* Image metadata */
52     {"kMDItemPixelWidth",               srmt_num,   "Image:Width"},
53     {"kMDItemPixelHeight",              srmt_num,   "Image:Height"},
54     {"kMDItemColorSpace",               srmt_str,   NOTSUPPORTED},
55     {"kMDItemBitsPerSample",            srmt_num,   NOTSUPPORTED},
56     {"kMDItemFocalLength",              srmt_num,   "Image:FocalLength"}, /* RDF: float */
57     {"kMDItemISOSpeed",                 srmt_num,   "Image:ISOSpeed"},
58     {"kMDItemOrientation",              srmt_bool,  "Image:Orientation"},
59     {"kMDItemResolutionWidthDPI",       srmt_num,   NOTSUPPORTED},
60     {"kMDItemResolutionHeightDPI",      srmt_num,   NOTSUPPORTED},
61     {"kMDItemExposureTimeSeconds",      srmt_num,   "Image:ExposureTime"}, /* RDF: fload */
62
63     /* Audio metadata */
64     {"kMDItemComposer",                 srmt_str,   NOTSUPPORTED},
65     {"kMDItemMusicalGenre",             srmt_str,   "Audio:Genre"},
66
67     {NULL, srmt_str, NULL}
68 };
69
70 struct MDTypeMap MDTypeMap[] = {
71     {"1",                       "equals",      "message/rfc822"},
72     {"2",                       "equals",      "text/x-vcard"},
73     {"3",                       NOTSUPPORTED}, /* PrefPane */
74     {"4",                       NOTSUPPORTED}, /* Font. There's no single mime type to match all font formats, ugh! */
75     {"5",                       NOTSUPPORTED}, /* Bookmark */
76     {"6",                       "equals",      "text/x-vcard"},
77     {"7",                       "startsWith",  "video"},
78     {"8",                       NOTSUPPORTED}, /* Executable */
79     {"9",                       NOTSUPPORTED}, /* Folder */
80     {"10",                      "startsWith",  "audio"},
81     {"11",                      "equals",      "application/pdf"},
82     {"12",                      NOTSUPPORTED}, /* Presentation */
83     {"13",                      "startsWith",  "image"},
84     {"public.jpeg",             "equals",      "image/jpeg"},
85     {"public.tiff",             "equals",      "image/tiff"},
86     {"com.compuserve.gif",      "equals",      "image/gif"},
87     {"public.png",              "equals",      "image/png"},
88     {"com.microsoft.bmp",       "equals",      "image/bmp"},
89     {"public.content",          "inSet",       "application/msword,application/pdf,application/vnd.ms-excel,application/vnd.oasis.opendocument.text,application/vnd.sun.xml.writer"},
90     {"public.mp3",              "equals",      "audio/mpeg"},
91     {"public.mpeg-4-audio",     "equals",      "audio/x-aac"},
92     {"com.apple.application",   NOTSUPPORTED},
93     {"public.text",             "startsWith",  "text"},
94     {"public.plain-text",       "equals",      "text/plain"},
95     {"public.rtf",              "equals",      "text/rtf"},
96     {"public.html",             "equals",      "text/html"},
97     {"public.xml",              "equals",      "text/xml"},
98     {"public.source-code",      NOTSUPPORTED},
99     {NULL,                      NULL}
100 };