Changeset View
Changeset View
Standalone View
Standalone View
src/extractor.cpp
Show All 14 Lines | |||||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | * Lesser General Public License for more details. | 16 | * Lesser General Public License for more details. | ||
17 | * | 17 | * | ||
18 | * You should have received a copy of the GNU Lesser General Public | 18 | * You should have received a copy of the GNU Lesser General Public | ||
19 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | 19 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
20 | * | 20 | * | ||
21 | */ | 21 | */ | ||
22 | 22 | | |||
23 | #include "propertymaputil_p.h" | ||||
24 | | ||||
23 | #include <QCoreApplication> | 25 | #include <QCoreApplication> | ||
24 | #include <QCommandLineParser> | 26 | #include <QCommandLineParser> | ||
25 | #include <QMimeDatabase> | 27 | #include <QMimeDatabase> | ||
26 | #include <QDataStream> | 28 | #include <QDataStream> | ||
27 | #include <QDebug> | 29 | #include <QDebug> | ||
28 | #include <QFile> | 30 | #include <QFile> | ||
29 | 31 | | |||
30 | #include <KFileMetaData/SimpleExtractionResult> | 32 | #include <KFileMetaData/SimpleExtractionResult> | ||
Show All 28 Lines | 42 | { | |||
59 | Q_FOREACH (KFileMetaData::Extractor *ex, exList) { | 61 | Q_FOREACH (KFileMetaData::Extractor *ex, exList) { | ||
60 | ex->extract(&result); | 62 | ex->extract(&result); | ||
61 | } | 63 | } | ||
62 | 64 | | |||
63 | QFile out; | 65 | QFile out; | ||
64 | out.open(stdout, QIODevice::WriteOnly); | 66 | out.open(stdout, QIODevice::WriteOnly); | ||
65 | QDataStream stream(&out); | 67 | QDataStream stream(&out); | ||
66 | 68 | | |||
67 | QVariantMap map; | 69 | auto map = toNamedVariantMap(result.properties()); | ||
68 | QMapIterator<KFileMetaData::Property::Property, QVariant> it(result.properties()); | 70 | QMapIterator<KFileMetaData::Property::Property, QVariant> it(result.properties()); | ||
69 | while (it.hasNext()) { | | |||
70 | it.next(); | | |||
71 | KFileMetaData::PropertyInfo pi(it.key()); | | |||
72 | map.insertMulti(pi.name(), it.value()); | | |||
73 | } | | |||
74 | 71 | | |||
75 | KFileMetaData::UserMetaData md(url); | 72 | KFileMetaData::UserMetaData md(url); | ||
76 | QStringList tags = md.tags(); | 73 | QStringList tags = md.tags(); | ||
77 | if (!tags.isEmpty()) { | 74 | if (!tags.isEmpty()) { | ||
78 | map.insert("tags", tags); | 75 | map.insert("tags", tags); | ||
79 | } | 76 | } | ||
80 | 77 | | |||
81 | int rating = md.rating(); | 78 | int rating = md.rating(); | ||
Show All 14 Lines |