[tracker-miners/wip/carlosg/miner-changes: 6/19] libtracker-extract: Add API to obtain hash for an extractor module
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/carlosg/miner-changes: 6/19] libtracker-extract: Add API to obtain hash for an extractor module
- Date: Thu, 18 Jun 2020 13:37:43 +0000 (UTC)
commit bc6aaeb01cce21b11a8b44ea6270da8e85c757d0
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Jun 13 12:22:09 2020 +0200
libtracker-extract: Add API to obtain hash for an extractor module
We'll be rubberstamping extracted files with these.
src/libtracker-extract/tracker-module-manager.c | 23 +++++++++++++++++++++++
src/libtracker-extract/tracker-module-manager.h | 1 +
2 files changed, 24 insertions(+)
---
diff --git a/src/libtracker-extract/tracker-module-manager.c b/src/libtracker-extract/tracker-module-manager.c
index 96c0e5f05..6df2f6f65 100644
--- a/src/libtracker-extract/tracker-module-manager.c
+++ b/src/libtracker-extract/tracker-module-manager.c
@@ -36,6 +36,7 @@ typedef struct {
GList *block_patterns;
GStrv fallback_rdf_types;
gchar *graph;
+ gchar *hash;
} RuleInfo;
typedef struct {
@@ -124,6 +125,7 @@ load_extractor_rule (GKeyFile *key_file,
rule.fallback_rdf_types = g_key_file_get_string_list (key_file, "ExtractorRule", "FallbackRdfTypes",
NULL, NULL);
rule.graph = g_key_file_get_string (key_file, "ExtractorRule", "Graph", NULL);
+ rule.hash = g_key_file_get_string (key_file, "ExtractorRule", "Hash", NULL);
/* Construct the rule */
rule.module_path = g_intern_string (module_path);
@@ -572,3 +574,24 @@ tracker_extract_module_manager_get_graph (const gchar *mimetype)
return NULL;
}
+
+const gchar *
+tracker_extract_module_manager_get_hash (const gchar *mimetype)
+{
+ GList *l, *list;
+
+ if (!tracker_extract_module_manager_init ()) {
+ return NULL;
+ }
+
+ list = lookup_rules (mimetype);
+
+ for (l = list; l; l = l->next) {
+ RuleInfo *r_info = l->data;
+
+ if (r_info->graph)
+ return r_info->hash;
+ }
+
+ return NULL;
+}
diff --git a/src/libtracker-extract/tracker-module-manager.h b/src/libtracker-extract/tracker-module-manager.h
index 95954232a..b566b1113 100644
--- a/src/libtracker-extract/tracker-module-manager.h
+++ b/src/libtracker-extract/tracker-module-manager.h
@@ -46,6 +46,7 @@ GStrv tracker_extract_module_manager_get_all_rdf_types (void);
GStrv tracker_extract_module_manager_get_rdf_types (const gchar *mimetype);
const gchar * tracker_extract_module_manager_get_graph (const gchar *mimetype);
+const gchar * tracker_extract_module_manager_get_hash (const gchar *mimetype);
GModule * tracker_extract_module_manager_get_module (const gchar *mimetype,
const gchar **rule_out,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]