diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-01-30 12:21:21 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-01-30 12:21:21 +0000 |
commit | 4cdecaf4c7815917932a3b80812ecbd840dab4e7 (patch) | |
tree | 8cc026fc0ac98a732aa4e559c5f49b5826e3b994 /src/fs/gnunet-helper-fs-publish.c | |
parent | 2dac3d6eb9599b50e064b9ddb8796a12c480874e (diff) | |
download | gnunet-4cdecaf4c7815917932a3b80812ecbd840dab4e7.tar.gz gnunet-4cdecaf4c7815917932a3b80812ecbd840dab4e7.zip |
-all meta data extraction should happen in helper, removing from API
Diffstat (limited to 'src/fs/gnunet-helper-fs-publish.c')
-rw-r--r-- | src/fs/gnunet-helper-fs-publish.c | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/src/fs/gnunet-helper-fs-publish.c b/src/fs/gnunet-helper-fs-publish.c index a1a2c1a80..546c2ba88 100644 --- a/src/fs/gnunet-helper-fs-publish.c +++ b/src/fs/gnunet-helper-fs-publish.c | |||
@@ -88,6 +88,36 @@ static struct EXTRACTOR_PluginList *plugins; | |||
88 | 88 | ||
89 | 89 | ||
90 | /** | 90 | /** |
91 | * Add meta data that libextractor finds to our meta data | ||
92 | * container. | ||
93 | * | ||
94 | * @param cls closure, our meta data container | ||
95 | * @param plugin_name name of the plugin that produced this value; | ||
96 | * special values can be used (i.e. '<zlib>' for zlib being | ||
97 | * used in the main libextractor library and yielding | ||
98 | * meta data). | ||
99 | * @param type libextractor-type describing the meta data | ||
100 | * @param format basic format information about data | ||
101 | * @param data_mime_type mime-type of data (not of the original file); | ||
102 | * can be NULL (if mime-type is not known) | ||
103 | * @param data actual meta-data found | ||
104 | * @param data_len number of bytes in data | ||
105 | * @return always 0 to continue extracting | ||
106 | */ | ||
107 | static int | ||
108 | add_to_md (void *cls, const char *plugin_name, enum EXTRACTOR_MetaType type, | ||
109 | enum EXTRACTOR_MetaFormat format, const char *data_mime_type, | ||
110 | const char *data, size_t data_len) | ||
111 | { | ||
112 | struct GNUNET_CONTAINER_MetaData *md = cls; | ||
113 | |||
114 | (void) GNUNET_CONTAINER_meta_data_insert (md, plugin_name, type, format, | ||
115 | data_mime_type, data, data_len); | ||
116 | return 0; | ||
117 | } | ||
118 | |||
119 | |||
120 | /** | ||
91 | * Free memory of the 'tree' structure | 121 | * Free memory of the 'tree' structure |
92 | * | 122 | * |
93 | * @param tree tree to free | 123 | * @param tree tree to free |
@@ -322,9 +352,8 @@ extract_files (struct ScanTreeNode *item) | |||
322 | 352 | ||
323 | /* this is the expensive operation, *afterwards* we'll check for aborts */ | 353 | /* this is the expensive operation, *afterwards* we'll check for aborts */ |
324 | meta = GNUNET_CONTAINER_meta_data_create (); | 354 | meta = GNUNET_CONTAINER_meta_data_create (); |
325 | GNUNET_FS_meta_data_extract_from_file (meta, | 355 | if (NULL != plugins) |
326 | item->filename, | 356 | EXTRACTOR_extract (plugins, item->filename, NULL, 0, &add_to_md, meta); |
327 | plugins); | ||
328 | slen = strlen (item->filename) + 1; | 357 | slen = strlen (item->filename) + 1; |
329 | size = GNUNET_CONTAINER_meta_data_get_serialized_size (meta); | 358 | size = GNUNET_CONTAINER_meta_data_get_serialized_size (meta); |
330 | if ( (-1 == size) || | 359 | if ( (-1 == size) || |