1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
/*
This file is part of fake-extractor.
Copyright (C) 2013 David Barksdale <amatus@amatus.name>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <extractor.h>
/**
* Load the default set of plugins. The default can be changed
* by setting the LIBEXTRACTOR_LIBRARIES environment variable;
* If it is set to "env", then this function will return
* EXTRACTOR_plugin_add_config (NULL, env, flags).
*
* If LIBEXTRACTOR_LIBRARIES is not set, the function will attempt
* to locate the installed plugins and load all of them.
* The directory where the code will search for plugins is typically
* automatically determined; it can be specified explicitly using the
* "LIBEXTRACTOR_PREFIX" environment variable.
*
* This environment variable must be set to the precise directory with
* the plugins (i.e. "/usr/lib/libextractor", not "/usr"). Note that
* setting the environment variable will disable all of the methods
* that are typically used to determine the location of plugins.
* Multiple paths can be specified using ':' to separate them.
*
* @param flags options for all of the plugins loaded
* @return the default set of plugins, NULL if no plugins were found
*/
struct EXTRACTOR_PluginList *
EXTRACTOR_plugin_add_defaults (enum EXTRACTOR_Options flags)
{
return NULL;
}
/**
* Add a library for keyword extraction.
*
* @param prev the previous list of libraries, may be NULL
* @param library the name of the library (short handle, i.e. "mime")
* @param options options to give to the library
* @param flags options to use
* @return the new list of libraries, equal to prev iff an error occured
*/
struct EXTRACTOR_PluginList *
EXTRACTOR_plugin_add (struct EXTRACTOR_PluginList * prev,
const char *library,
const char *options,
enum EXTRACTOR_Options flags)
{
return prev;
}
/**
* Load multiple libraries as specified by the user.
*
* @param config a string given by the user that defines which
* libraries should be loaded. Has the format
* "[[-]LIBRARYNAME[(options)][:[-]LIBRARYNAME[(options)]]]*".
* For example, 'mp3:ogg' loads the
* mp3 and the ogg plugins. The '-' before the LIBRARYNAME
* indicates that the library should be removed from
* the library list.
* @param prev the previous list of libraries, may be NULL
* @param flags options to use
* @return the new list of libraries, equal to prev iff an error occured
* or if config was empty (or NULL).
*/
struct EXTRACTOR_PluginList *
EXTRACTOR_plugin_add_config (struct EXTRACTOR_PluginList *prev,
const char *config,
enum EXTRACTOR_Options flags)
{
return prev;
}
/**
* Remove a plugin from a list.
*
* @param prev the current list of plugins
* @param library the name of the plugin to remove (short handle)
* @return the reduced list, unchanged if the plugin was not loaded
*/
struct EXTRACTOR_PluginList *
EXTRACTOR_plugin_remove (struct EXTRACTOR_PluginList *prev,
const char *library)
{
return prev;
}
/**
* Remove all plugins from the given list (destroys the list).
*
* @param plugin the list of plugins
*/
void
EXTRACTOR_plugin_remove_all (struct EXTRACTOR_PluginList *plugins)
{
}
/**
* Extract keywords from a file using the given set of plugins.
*
* @param plugins the list of plugins to use
* @param filename the name of the file, can be NULL if data is not NULL
* @param data data of the file in memory, can be NULL (in which
* case libextractor will open file) if filename is not NULL
* @param size number of bytes in data, ignored if data is NULL
* @param proc function to call for each meta data item found
* @param proc_cls cls argument to proc
*/
void
EXTRACTOR_extract (struct EXTRACTOR_PluginList *plugins,
const char *filename,
const void *data,
size_t size,
EXTRACTOR_MetaDataProcessor proc,
void *proc_cls)
{
}
/**
* Simple EXTRACTOR_MetaDataProcessor implementation that simply
* prints the extracted meta data to the given file. Only prints
* those keywords that are in UTF-8 format.
*
* @param handle the file to write to (stdout, stderr), must NOT be NULL,
* must be of type "FILE *".
* @param plugin_name name of the plugin that produced this value
* @param type libextractor-type describing the meta data
* @param format basic format information about data
* @param data_mime_type mime-type of data (not of the original file);
* can be NULL (if mime-type is not known)
* @param data actual meta-data found
* @param data_len number of bytes in data
* @return non-zero if printing failed, otherwise 0.
*/
int
EXTRACTOR_meta_data_print (void * handle,
const char *plugin_name,
enum EXTRACTOR_MetaType type,
enum EXTRACTOR_MetaFormat format,
const char *data_mime_type,
const char *data,
size_t data_len)
{
return 0;
}
|