Structure for a grabber. More...
#include <grabber_common.h>
Data Fields | |
const char * | name |
Textual identification of the grabber. | |
int | caps_flag |
Flags to define the capabilities of the grabber. | |
int(* | init )(void *priv) |
Init function for the grabber. | |
void(* | uninit )(void *priv) |
Uninit function for the grabber. | |
int(* | grab )(void *priv, file_data_t *data) |
Grabbing function for the grabber. | |
void(* | loop )(void *priv) |
Function called for each end of scan loop. | |
void * | priv |
Private data for the grabber. | |
int | enable |
Different of 0 if the grabber is enabled. | |
unsigned int | stat_success |
Total of successes for the session. | |
unsigned int | stat_failure |
Total of failures for the session. | |
struct timespec | stat_difftime |
Total time used by the grabber. |
Structure for a grabber.
Definition at line 79 of file grabber_common.h.
Flags to define the capabilities of the grabber.
Definition at line 85 of file grabber_common.h.
Different of 0 if the grabber is enabled.
Definition at line 155 of file grabber_common.h.
int(* grabber_list_t::grab)(void *priv, file_data_t *data) |
Grabbing function for the grabber.
This function is called in order to populate the attributes meta_grabber
and list_downloader
in the data
structure. All others attributes must be considered as read-only! Only them are thread-safe for writing.
To add new metadata in the database, the function vh_metadata_add() must be used on meta_grabber
.
It is proibited to download files (images for example) with this function. Only textual metadata are proceeded here. But the reference on an image can be saved in the meta_grabber attribute. To download a file, the URL and the destination must be prepared for the downloader with the function vh_file_dl_add() in order to populate the list_downloader
attribute. The files will be downloaded after the grabbing step.
To read meta_parser
(attribute populated by the parser), you must use the function vh_metadata_get().
[in] | priv | Private structure registered with the grabber. |
[in] | data | File structure where some data must be populated. |
Definition at line 134 of file grabber_common.h.
int(* grabber_list_t::init)(void *priv) |
Init function for the grabber.
This initialization is called only at the init of an instance of valhalla. The private structure (priv
) must be created before this initialization.
[in] | priv | Private structure registered with the grabber. |
Definition at line 96 of file grabber_common.h.
void(* grabber_list_t::loop)(void *priv) |
Function called for each end of scan loop.
This function is optional, it is called after each scanner loop if there are more than one loop. This function is never called after the last loop. It is useful to make some cleanup in the grabber before the next scan.
[in] | priv | Private structure registered with the grabber. |
Definition at line 145 of file grabber_common.h.
const char* grabber_list_t::name |
Textual identification of the grabber.
Definition at line 83 of file grabber_common.h.
void* grabber_list_t::priv |
Private data for the grabber.
The data is registered at the same time that the grabber.
Definition at line 152 of file grabber_common.h.
struct timespec grabber_list_t::stat_difftime |
Total time used by the grabber.
Definition at line 161 of file grabber_common.h.
unsigned int grabber_list_t::stat_failure |
Total of failures for the session.
Definition at line 159 of file grabber_common.h.
unsigned int grabber_list_t::stat_success |
Total of successes for the session.
Definition at line 157 of file grabber_common.h.
void(* grabber_list_t::uninit)(void *priv) |
Uninit function for the grabber.
This unititialization is called only at the uninit of an instance of valhalla. The private structure (priv
) must be released in this function.
[in] | priv | Private structure registered with the grabber. |
Definition at line 107 of file grabber_common.h.