use : as separator in localfields value before parsing as confsimple
This commit is contained in:
parent
b105481207
commit
1ab7ea0558
@ -3204,11 +3204,14 @@ skippedPaths = ~/somedir/∗.txt
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry><term><literal>localfields</literal></term>
|
<varlistentry><term><literal>localfields</literal></term>
|
||||||
<listitem><para>This allows setting fields for all documents
|
<listitem><para>This allows setting fields for all
|
||||||
under a given directory. Typical usage would be to set an
|
documents under a given directory. Typical usage would be
|
||||||
"rclaptg" field, to be used in <filename>mimeview</filename> to
|
to set an "rclaptg" field, to be used in
|
||||||
select a specific viewer. Ie:
|
<filename>mimeview</filename> to select a specific
|
||||||
<literal>localfields=rclaptg=gnus;other=val</literal>, then
|
viewer. If several fields are to be set, they should be
|
||||||
|
separated with a ':' character (which there is currently no way to
|
||||||
|
escape). Ie:
|
||||||
|
<literal>localfields= rclaptg=gnus:other = val</literal>, then
|
||||||
select specifier viewer with
|
select specifier viewer with
|
||||||
<literal>mimetype|tag=...</literal> in
|
<literal>mimetype|tag=...</literal> in
|
||||||
<filename>mimeview</filename>.</para>
|
<filename>mimeview</filename>.</para>
|
||||||
|
|||||||
@ -214,6 +214,8 @@ bool FsIndexer::indexFiles(list<string>& files)
|
|||||||
LOGDEB2(("FsIndexer::indexFiles: [%s]\n", it->c_str()));
|
LOGDEB2(("FsIndexer::indexFiles: [%s]\n", it->c_str()));
|
||||||
|
|
||||||
m_config->setKeyDir(path_getfather(*it));
|
m_config->setKeyDir(path_getfather(*it));
|
||||||
|
if (m_havelocalfields)
|
||||||
|
localfieldsfromconf();
|
||||||
walker.setSkippedNames(m_config->getSkippedNames());
|
walker.setSkippedNames(m_config->getSkippedNames());
|
||||||
|
|
||||||
// Check path against indexed areas and skipped names/paths
|
// Check path against indexed areas and skipped names/paths
|
||||||
@ -285,22 +287,18 @@ void FsIndexer::localfieldsfromconf()
|
|||||||
string sfields;
|
string sfields;
|
||||||
if (!m_config->getConfParam("localfields", sfields))
|
if (!m_config->getConfParam("localfields", sfields))
|
||||||
return;
|
return;
|
||||||
list<string> lfields;
|
// Substitute ':' with '\n' inside the string. There is no way to escape ':'
|
||||||
if (!stringToStrings(sfields, lfields)) {
|
for (string::size_type i = 0; i < sfields.size(); i++)
|
||||||
LOGERR(("FsIndexer::localfieldsfromconf: bad syntax for [%s]\n",
|
if (sfields[i] == ':')
|
||||||
sfields.c_str()));
|
sfields[i] = '\n';
|
||||||
return;
|
// Parse the result with a confsimple and add the results to the metadata
|
||||||
}
|
ConfSimple conf(sfields, 1, true);
|
||||||
for (list<string>::const_iterator it = lfields.begin();
|
list<string> nmlst = conf.getNames("");
|
||||||
it != lfields.end(); it++) {
|
for (list<string>::const_iterator it = nmlst.begin();
|
||||||
ConfSimple conf(*it, 1, true);
|
it != nmlst.end(); it++) {
|
||||||
list<string> nmlst = conf.getNames("");
|
conf.get(*it, m_localfields[*it]);
|
||||||
for (list<string>::const_iterator it1 = nmlst.begin();
|
LOGDEB(("FsIndexer::localfieldsfromconf: [%s] => [%s]\n",
|
||||||
it1 != nmlst.end(); it1++) {
|
(*it).c_str(), m_localfields[*it].c_str()));
|
||||||
conf.get(*it1, m_localfields[*it1]);
|
|
||||||
LOGDEB2(("FsIndexer::localfieldsfromconf: [%s] => [%s]\n",
|
|
||||||
(*it1).c_str(), m_localfields[*it1].c_str()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user