libglyr Reference Manual | ||||
---|---|---|---|---|
Top | Description |
#include <glyr/glyr.h> #define GLYR_GLYR_H GlyrMemCache * glyr_cache_copy (GlyrMemCache *cache
); void glyr_cache_free (GlyrMemCache *cache
); GlyrMemCache * glyr_cache_new (void
); void glyr_cache_print (GlyrMemCache *cache
); void glyr_cache_set_data (GlyrMemCache *cache
,const char *data
,int len
); void glyr_cache_set_dsrc (GlyrMemCache *cache
,const char *download_source
); void glyr_cache_set_img_format (GlyrMemCache *cache
,const char *img_format
); void glyr_cache_set_prov (GlyrMemCache *cache
,const char *provider
); void glyr_cache_set_rating (GlyrMemCache *cache
,int rating
); void glyr_cache_set_type (GlyrMemCache *cache
,GLYR_DATA_TYPE type
); void glyr_cache_update_md5sum (GlyrMemCache *cache
); int glyr_cache_write (GlyrMemCache *cache
,const char *path
); void glyr_cleanup (void
); const char * glyr_data_type_to_string (GLYR_DATA_TYPE type
); GlyrMemCache * glyr_download (const char *url
,GlyrQuery *s
); void glyr_free_list (GlyrMemCache *head
); GlyrMemCache * glyr_get (GlyrQuery *settings
,GLYR_ERROR *error
,int *length
); GLYR_FIELD_REQUIREMENT glyr_get_requirements (GLYR_GET_TYPE type
); const char * glyr_get_type_to_string (GLYR_GET_TYPE type
); void glyr_info_free (GlyrFetcherInfo *info
); GlyrFetcherInfo * glyr_info_get (void
); void glyr_init (void
); char * glyr_md5sum_to_string (unsigned char *md5sum
); GLYR_ERROR glyr_opt_album (GlyrQuery *s
,char *album
); GLYR_ERROR glyr_opt_allowed_formats (GlyrQuery *s
,const char *formats
); GLYR_ERROR glyr_opt_artist (GlyrQuery *s
,char *artist
); GLYR_ERROR glyr_opt_db_autoread (GlyrQuery *s
,bool read_from_db
); GLYR_ERROR glyr_opt_db_autowrite (GlyrQuery *s
,bool write_to_db
); GLYR_ERROR glyr_opt_dlcallback (GlyrQuery *settings
,DL_callback dl_cb
,void *userp
); GLYR_ERROR glyr_opt_download (GlyrQuery *s
,bool download
); GLYR_ERROR glyr_opt_force_utf8 (GlyrQuery *s
,bool force_utf8
); GLYR_ERROR glyr_opt_from (GlyrQuery *s
,const char *from
); GLYR_ERROR glyr_opt_fuzzyness (GlyrQuery *s
,int fuzz
); GLYR_ERROR glyr_opt_img_maxsize (GlyrQuery *s
,int size
); GLYR_ERROR glyr_opt_img_minsize (GlyrQuery *s
,int size
); GLYR_ERROR glyr_opt_lang (GlyrQuery *s
,char *langcode
); GLYR_ERROR glyr_opt_lang_aware_only (GlyrQuery *s
,bool lang_aware_only
); GLYR_ERROR glyr_opt_lookup_db (GlyrQuery *s
,GlyrDatabase *db
); GLYR_ERROR glyr_opt_musictree_path (GlyrQuery *s
,const char *musictree_path
); GLYR_ERROR glyr_opt_normalize (GlyrQuery *s
,GLYR_NORMALIZATION norm
); GLYR_ERROR glyr_opt_number (GlyrQuery *s
,unsigned int num
); GLYR_ERROR glyr_opt_parallel (GlyrQuery *s
,unsigned long parallel_jobs
); GLYR_ERROR glyr_opt_plugmax (GlyrQuery *s
,int plugmax
); GLYR_ERROR glyr_opt_proxy (GlyrQuery *s
,const char *proxystring
); GLYR_ERROR glyr_opt_qsratio (GlyrQuery *s
,float ratio
); GLYR_ERROR glyr_opt_redirects (GlyrQuery *s
,unsigned long redirects
); GLYR_ERROR glyr_opt_timeout (GlyrQuery *s
,unsigned long timeout
); GLYR_ERROR glyr_opt_title (GlyrQuery *s
,char *title
); GLYR_ERROR glyr_opt_type (GlyrQuery *s
,GLYR_GET_TYPE type
); GLYR_ERROR glyr_opt_useragent (GlyrQuery *s
,const char *useragent
); GLYR_ERROR glyr_opt_verbosity (GlyrQuery *s
,unsigned int level
); void glyr_query_destroy (GlyrQuery *query
); void glyr_query_init (GlyrQuery *query
); void glyr_signal_exit (GlyrQuery *query
); const char * glyr_strerror (GLYR_ERROR ID
); GLYR_DATA_TYPE glyr_string_to_data_type (const char *string
); void glyr_string_to_md5sum (const char *string
,unsigned char *md5sum
); bool glyr_type_is_image (GLYR_GET_TYPE type
); const char * glyr_version (void
);
GlyrMemCache * glyr_cache_copy (GlyrMemCache *cache
);
Allocate a new cache and
copy all contents (= deep copy) from the original cache
,
The pointers next and prev are set to NULL.
|
The cache to copy |
Returns : |
A newly allocated cache. |
void glyr_cache_free (GlyrMemCache *cache
);
|
Frees the (valid allocated) cache pointed to by cache
|
GlyrMemCache * glyr_cache_new (void
);
Initializes a new memcache.
Normally you never need to do this.
Don't forget to free the cache with glyr_cache_free()
Returns : |
: A newly allocated and initialized memcache with no data. |
void glyr_cache_print (GlyrMemCache *cache
);
A debug method to print all fields of cache
.
|
The GlyrMemCache to be printed. |
void glyr_cache_set_data (GlyrMemCache *cache
,const char *data
,int len
);
Safely sets the data of the cache. It frees the old data first, updates
the checksum and adjusts the size fields accordingly to len.
If len is a negative number strlen()
is used to determine the size.
Attention: data
is set directly! It get's freed once you free the cache. Be sure it's safe to be free'd.
|
The cache where to set the data. |
|
The data |
|
Length of data |
void glyr_cache_set_dsrc (GlyrMemCache *cache
,const char *download_source
);
Copies download_source to the dsrc field, clearing all previously allocated content safely.
|
The cache to change |
|
The string to be changed too |
void glyr_cache_set_img_format (GlyrMemCache *cache
,const char *img_format
);
Copies img_format to the img_format field, clearing all previously allocated content safely.
|
The cache to change |
|
The string to be changed too |
void glyr_cache_set_prov (GlyrMemCache *cache
,const char *provider
);
Copies provider to the prov field, clearing all previously allocated content safely.
|
The cache to change |
|
The string to be changed too |
void glyr_cache_set_rating (GlyrMemCache *cache
,int rating
);
|
The cache to change |
|
The new rating |
void glyr_cache_set_type (GlyrMemCache *cache
,GLYR_DATA_TYPE type
);
|
The cache to change |
|
The new type |
void glyr_cache_update_md5sum (GlyrMemCache *cache
);
Updates the md5sum field of cache
.
|
a valid memcahe |
int glyr_cache_write (GlyrMemCache *cache
,const char *path
);
Write cache
to the path specified by path
.
There are three special files:
"stdout" -> Outputs file to stdout
"stderr" -> Outputs file to stderr
"null" -> Outputs item nowhere
|
The data to write. |
|
The path to write data at. |
Returns : |
the number of written bytes. |
void glyr_cleanup (void
);
Cleanup all parts of the library, you can use
:
atexit()
glyr_init(); atexit(glyr_destroy);
This function is not threadsafe.
const char * glyr_data_type_to_string (GLYR_DATA_TYPE type
);
Converts a type to a string.
|
a member of the GLYR_DATA_TYPE enum, GLYR_TYPE_LYRICS for example |
Returns : |
a statically allocated string, do not free |
GlyrMemCache * glyr_download (const char *url
,GlyrQuery *s
);
Downloads the data pointed to by url
and caches in it a GlyrMemCache, which is returned to you.
Use glyr_cache_free()
to free it after use.
|
A valid url, for example returned by libglyr |
|
A settings struct managing timeout, useragent and redirects. |
Returns : |
A GlyrMemCache containing the data, or NULL on failure, use verbose output to find out why. |
void glyr_free_list (GlyrMemCache *head
);
Deletes all dynamic memory by calling glyr_cache_free()
on each cache.
|
The head of the doubly linked list that should be freed. |
GlyrMemCache * glyr_get (GlyrQuery *settings
,GLYR_ERROR *error
,int *length
);
settings
is pointer to a GlyrQuery struct filled to your needs via the glyr_opt_* methods,
Once an item is found the callback (set via glyr_opt_dlcallback()
) is called anytime a item is ready
|
The setting struct controlling glyr. (See the glyr_opt_* methods) |
|
An optional pointer to an int, which gets filled with an error message, or GLYRE_OK on success, or NULL
|
|
length An optional pointer storing the length of the returned list, or NULL
|
Returns : |
: a doubly linked list of GlyrMemCache, which should be freed by passing any element of the to glyr_free_list()
|
GLYR_FIELD_REQUIREMENT glyr_get_requirements (GLYR_GET_TYPE type
);
Different getters need different fields set. You can use this to check if the artist, album and title field of a specific getter is required or optional.
GLYR_FIELD_REQUIREMENT reqs = glyr_get_requirements(GLYR_GET_COVERART); if(reqs & GLYR_REQUIRES_ALBUM) { // do something when artist is required } else if(reqs & GLYR_OPTIONAL_TITLE) { // Title is optional } else { // None of both }
|
The type to get the requirements from |
Returns : |
A bitmask out of members of GLYR_FIELD_REQUIREMENT |
const char * glyr_get_type_to_string (GLYR_GET_TYPE type
);
Converts a get type to a string (GLYR_GET_COVERART => "cover") You must not modify the string or daemons will come to you at night!
|
a member of the GLYR_GET_TYPE enum, GLYR_GET_COVERART for example |
Returns : |
a statically allocated string, do not free nor modify |
void glyr_info_free (GlyrFetcherInfo *info
);
Free the return value of glyr_info_get()
pointed to by info
|
The return value of glyr_info_get()
|
GlyrFetcherInfo * glyr_info_get (void
);
get information about existing Fetcher and Source A Doubly linked list of Fetcher is returned, each having a field 'head', being a pointer to a doubly linked list of GlyrSourceInfos
It is best understood by an example:
Example 1. Using GlyrFetcherInfo:
static void visualize_from_options(void) { GlyrFetcherInfo * info = glyr_info_get(); if(info != NULL) { for(GlyrFetcherInfo * elem0 = info; elem0; elem0 = elem0->next) { printf("%s\n",elem0->name); for(GlyrSourceInfo * elem1 = elem0->head; elem1; elem1 = elem1->next) { printf(" [%c] %s\n",elem1->key,elem1->name); } printf("\n"); } } glyr_info_free(info); }
Returns : |
A newly allocated GlyrFetcherInfo structure, you can iterate over. |
void glyr_init (void
);
Init the library, this has to be called before any other calls from this library are made.
You should call glyr_cleanup()
once for every call of glyr_init()
This function is not threadsafe.
char * glyr_md5sum_to_string (unsigned char *md5sum
);
Convert a md5sum (raw data) to a human readable representation. String consists only of [0-9] and [a-f].
|
a md5sum (from a cache) |
Returns : |
a newly allocated string, 32 chars long. |
GLYR_ERROR glyr_opt_album (GlyrQuery *s
,char *album
);
This field is required for the following types:
Optional for the following types:
Libglyr keeps a copy of this string internally.
libglyr applies some basic normalization, like " CoOl_album CD01 (20.7)" -> "cool_album"
|
The GlyrQuery settings struct to store this option in. |
|
The album you want to search for, NULL and "" is not valid. |
Returns : |
an error ID |
GLYR_ERROR glyr_opt_allowed_formats (GlyrQuery *s
,const char *formats
);
Restricts providers to retrieve at max. plugmax
items, you might use this to get results
over several providers when glyr_opt_number()
is set to something higher than 1.
For the getters GLYR_GET_COVERART
and GLYR_GET_ARTIST_PHOTOS
only.
The allowed formats for images, in a comma separated list.
Examples:
"png;jpeg"
"png;jpeg;tiff;jpg;" (default)
'jpeg' *and* 'jpg' because some websites return strange mimetypes (should be 'jpeg' only)
|
The GlyrQuery settings struct to store this option in. |
|
A commaseparated list of allowed formats. |
Returns : |
an error ID |
GLYR_ERROR glyr_opt_artist (GlyrQuery *s
,char *artist
);
This is needed for all types of metadata. Libglyr keeps a copy of this string internally.
libglyr applies some basic normalization, like " artistX feat. artistY" -> "artistX"
|
The GlyrQuery settings struct to store this option in. |
|
The artist you want to search for, NULL and "" is not valid. |
Returns : |
an error ID |
GLYR_ERROR glyr_opt_db_autoread (GlyrQuery *s
,bool read_from_db
);
If set to true libglyr will lookup the database previously given by glyr_opt_lookup_db()
during searching in the web. If there's item that already seems to be in the DB it gets not
mixed into the results.
This does not influence the usage of the DB as local provider!
Use glyr_opt_from()
with "all;-local" to disable it.
|
The GlyrQuery settings struct to store this option in. |
|
Boolean, true for DB lookup while searching |
Returns : |
an error ID |
GLYR_ERROR glyr_opt_db_autowrite (GlyrQuery *s
,bool write_to_db
);
If a database is specified via glyr_opt_lookup_db you can choose to automatically save newly found items to the database. They will be looked up from there if you search for it again.
|
The GlyrQuery settings struct to store this option in. |
|
true, to write this to the database automatically |
Returns : |
an error ID |
GLYR_ERROR glyr_opt_dlcallback (GlyrQuery *settings
,DL_callback dl_cb
,void *userp
);
The callback should have the following form:
GLYR_ERROR my_callback(GlyrMemCache * dl, struct GlyrQuery * s);
Note that you can return certaing members of GLYR_ERROR
in the callback:
GLYRE_SKIP
: To not add this item to the results.
GLYRE_OK
: To add this item to the results and continue happily.
GLYRE_STOP_POST
: To stop right now and return the results. The current element will be added.
GLYRE_STOP_PRE
: To stop right now and return the results. The current element will NOT be added.
|
The GlyrQuery settings struct to store this option in. |
|
The callback to register, must have a prototype like this. |
|
A pointer to a custom variable you can access inside the callback via s->callback.user_pointer
|
Returns : |
an error ID |
GLYR_ERROR glyr_opt_download (GlyrQuery *s
,bool download
);
Imageproviders only return URLs, by default libglyr downloads these and
gives you the cache. By settings glyr_opt_download()
to FALSE you tell
libglyr that you want only the URLs (in a searchengine like fashion)
An check for valid images is done however.
|
The GlyrQuery settings struct to store this option in. |
|
Wether to downlaod images or just to return the found URL. |
Returns : |
an error ID |
GLYR_ERROR glyr_opt_force_utf8 (GlyrQuery *s
,bool force_utf8
);
For textitems only. Some providers (like metrolyrics) might return text with strange encodings, that can not be converted to regular UTF8, but might return a subset of UTF8. This options forces libglyr to prohibit those.
|
The GlyrQuery settings struct to store this option in. |
|
To force, or not to force. |
Returns : |
an error ID |
GLYR_ERROR glyr_opt_from (GlyrQuery *s
,const char *from
);
Tell libglyr where you want your metadata want from.
You can get a full list of providers for each getter by running glyrc
@-L
The string you can pass here looks like this example for _cover_:
"lastfm;google"
This would query to everybody's surprise"lastfm" and "google" Alternatively you may use the string "all" in it:
"all;-lastfm;"
All providers except "lastfm" (therefore the '-') are used, a '+' is also allowed, which does plain nothing.
By default all built-in providers are used.
You can access the providernames by calling glyr_info_get()
|
The GlyrQuery settings struct to store this option in. |
|
A comma separated list of provider names. |
Returns : |
an error ID |
GLYR_ERROR glyr_opt_fuzzyness (GlyrQuery *s
,int fuzz
);
libglyr features fuzzy matching to enhance search results. Look at the string "Equilibrium" and the accidentally mistyped version "Aquillibriu": Those strings will be compares using the "Levenshtein distance" (http://en.wikipedia.org/wiki/Levenshtein_distance) which basically counts the number of insert, substitute and delete operations to transform Equilibrium"" into "Aquillibriu". The distance in this case is 3 since three edit-operations are needed (one insert, substitute and deletion)
The fuzziness parameter is the maximum distance two strings may have to match. A high distance (like about 10) matches even badly mistyped strings, but also introduces bad results. Low settings however will omit some good results.
The default values is currently 4. To be more secure some correction is applied:
Examples:
artist:Adele - album:19
artist:Adele - album:21
lv-distance = 2 which is <= 4
But since the lv-distance is the same as the length "21" it won't match.
The easiest way to prevent this though, is to properly tag your music. (http://musicbrainz.org/doc/MusicBrainz_Picard).
|
The GlyrQuery settings struct to store this option in. |
|
Maximal Levenshtein-distance tolerance may have, see below. |
Returns : |
an error ID |
GLYR_ERROR glyr_opt_img_maxsize (GlyrQuery *s
,int size
);
This is only taken as a hint, returned images are not necessarily below this size, but should be around it.
|
The GlyrQuery settings struct to store this option in. |
|
The maxmimum size in pixels an image may have, assuming it to be quadratic |
Returns : |
an error ID |
GLYR_ERROR glyr_opt_img_minsize (GlyrQuery *s
,int size
);
This is only taken as a hint, returned images are not necessarily higher than this size, but should be around it.
|
The GlyrQuery settings struct to store this option in. |
|
The minimum size in pixels an image may have, assuming it to be quadratic |
Returns : |
an error ID |
GLYR_ERROR glyr_opt_lang (GlyrQuery *s
,char *langcode
);
Some providers offer localized content, or content only being available in certain countries. Examples are: last.fm, amazon and google. The language is given in ISO 639-1 codes like 'de' or 'en'. Alternatively you can set it to 'auto', which will cause libglyr to guess your language by your locale. "auto" is the default behavior.
|
The GlyrQuery settings struct to store this option in. |
|
An ISO 639-1 language code. |
Returns : |
an error ID |
GLYR_ERROR glyr_opt_lang_aware_only (GlyrQuery *s
,bool lang_aware_only
);
Note: Not for all types of metadata there may be localized content, and only fetchers, that provide text items are affected by this setting. The special provider 'local' is an exception here, it is queried, but delievers only language specific content too.
|
The GlyrQuery settings struct to store this option in. |
|
Boolean, set to true if you want language specific providers only. |
Returns : |
an error ID |
GLYR_ERROR glyr_opt_lookup_db (GlyrQuery *s
,GlyrDatabase *db
);
Bind the previosly created db
to the query s
.
By doing this you add a new 'local' provider,
that is queried before everything else and may speed up
things heavily.
You can either query it exclusively or disable it completely:
Enable exclusiv:
glyr_opt_from(s,"local");Disable:
glyr_opt_from(s,"all;-local");
|
The GlyrQuery settings struct to store this option in. |
|
a GlyrDatabase object. |
Returns : |
an error ID |
GLYR_ERROR glyr_opt_musictree_path (GlyrQuery *s
,const char *musictree_path
);
Set the path to a specific mediafile and glyr will try to fetch covers from directories around this, since many people place things like 'folder.jpg' there. Instead of the actual file you can also pass the containing directory (see the 'dirname' utility) - the path can be either absolute or relative.
From there on it works by cascading upwards - i.e. checking all files in the dir (not recursing), go up, repeat. This will be repeated $(recurse_depth) times or till it cannot go upwards. How the file is checked depends on the metadata type to search, see below.
For reference the actual C code is given (${artist} gets expanded):
Example 2. Used regexes and recurse_depth
case GLYR_GET_COVERART: search_regex = "^(folder|front|cover|.*${album}.*)\\.(jpg|png|jpeg|gif)"; recurse_depth = 2; break; case GLYR_GET_ARTIST_PHOTOS: search_regex = "^(${artist}|artist)\\.(jpg|png|jpeg|gif)$"; recurse_depth = 3; break; case GLYR_GET_ALBUM_REVIEW: search_regex = "^(${album})\\.(info|txt)$"; recurse_depth = 2; break; case GLYR_GET_ARTIST_BIO: search_regex = "^BIOGRAPHY(\\.txt)?$"; recurse_depth = 2; break; default: search_regex = NULL; recurse_depth = 0; break;
|
The GlyrQuery settings struct to store this option in. |
|
The concrete path (relative or absolute) where a mediafile reisdes (see below) |
Returns : |
an error ID |
GLYR_ERROR glyr_opt_normalize (GlyrQuery *s
,GLYR_NORMALIZATION norm
);
Defines how much artist/album/title is normalized.
GLYR_NORMALIZE_NONE: Do no normalization, except strdown and utf-8-normalization.
GLYR_NORMALIZE_MODERATE: Remove stuff like feat., featuring. Track 01 etc.
GLYR_NORMALIZE_AGGRESSIVE: Also remove everything between()
, [] and <>. Slightly destructive!
Even for None, utf-8 normalization and strdown()
is done.
The default is GLYR_NORMALIZE_AGGRESSIVE | GLYR_NORMALIZE_ALL
|
The GlyrQuery settings struct to store this option in. |
|
Any members of GLYR_NORMALIZATION, which may be binary or'd |
Returns : |
an error ID |
GLYR_ERROR glyr_opt_number (GlyrQuery *s
,unsigned int num
);
The maximum number of items to get in a glyr_get()
, resulting number of items may be below num
but not higher.
A value of 0 causes libglyr to search till infinity.
Default is 1.
|
The GlyrQuery settings struct to store this option in. |
|
Maximum number of items to get or 0 |
Returns : |
an error ID |
GLYR_ERROR glyr_opt_parallel (GlyrQuery *s
,unsigned long parallel_jobs
);
A value of 0 lets libglyr chooses this value itself. This is the default.
|
The GlyrQuery settings struct to store this option in. |
|
The number of providers that are queried in parallel. |
Returns : |
an error ID |
GLYR_ERROR glyr_opt_plugmax (GlyrQuery *s
,int plugmax
);
Restricts providers to retrieve at max. plugmax
items, you might use this to get results
over several providers when glyr_opt_number()
is set to something higher than 1.
May be removed in future releases.
|
The GlyrQuery settings struct to store this option in. |
|
Maximum number of items a single provider may retrieve. |
Returns : |
an error ID |
GLYR_ERROR glyr_opt_proxy (GlyrQuery *s
,const char *proxystring
);
The proxy to use, if any. It is passed in the form: [protocol://][user:pass@]yourproxy.domain[:port] Example:
Proxy.fh-hof.de:3128
http://hman:rootroot @ godserve.com:666
The environment variables http_proxy, ftp_proxy, all_proxy are respected, but are overwritten by this.
|
The GlyrQuery settings struct to store this option in. |
|
The proxy to use, see below for the notation. |
Returns : |
an error ID |
GLYR_ERROR glyr_opt_qsratio (GlyrQuery *s
,float ratio
);
0.00 means highest speed, querying fast providers first. 1.00 Takes possibly longer, but should deliver best results. 0.85 is the current default value.
All other values, smaller 0.0, greater 1.0 are clamped to [0.0..1.0]
|
The GlyrQuery settings struct to store this option in. |
|
A float, in the range [0.0..1.0] specifying the ratio between quality and speed. |
Returns : |
an error ID |
GLYR_ERROR glyr_opt_redirects (GlyrQuery *s
,unsigned long redirects
);
A value of 0 is allowed but may break some plugins.
|
The GlyrQuery settings struct to store this option in. |
|
Maximum number of redirects before canceling a download. |
Returns : |
an error ID |
GLYR_ERROR glyr_opt_timeout (GlyrQuery *s
,unsigned long timeout
);
Default is 20 seconds
|
The GlyrQuery settings struct to store this option in. |
|
Maximum number of seconds to wait before canceling a download. |
Returns : |
an error ID |
GLYR_ERROR glyr_opt_title (GlyrQuery *s
,char *title
);
This field is required for the following types:
Optional for the following types:
Libglyr keeps a copy of this string internally.
libglyr applies some basic normalization, like "Songtitle (blahblah remix)" -> "Songtitle"
|
The GlyrQuery settings struct to store this option in. |
|
The album you want to search for, NULL and "" is not valid. |
Returns : |
an error ID |
GLYR_ERROR glyr_opt_type (GlyrQuery *s
,GLYR_GET_TYPE type
);
Example: GLYR_GET_COVERART
|
The GlyrQuery settings struct to store this option in. |
|
The type of metadata you want to get. |
Returns : |
an error ID |
GLYR_ERROR glyr_opt_useragent (GlyrQuery *s
,const char *useragent
);
Some providers require an valid useragent, an empty string might break these therefore.
|
The GlyrQuery settings struct to store this option in. |
|
A string that is used as useragent in HTTP requests. |
Returns : |
an error ID |
GLYR_ERROR glyr_opt_verbosity (GlyrQuery *s
,unsigned int level
);
The verbosity level that is used by libglyr:
0: No output, but fatal errors.
1: Basic warnings.
2: Normal informal output
3: Basic debug output
4: Full debug output
|
The GlyrQuery settings struct to store this option in. |
|
Define how verbose the library is. |
Returns : |
an error ID |
void glyr_query_destroy (GlyrQuery *query
);
Deletes all modifications and frees dynamic memory. It can be reused, as fresh from glyr_query_init()
|
The GlyrQuery to destroy. |
void glyr_query_init (GlyrQuery *query
);
This functions may allocate dynamic memory. It should be freed with glyr_query_init()
after use.
|
The GlyrQuery to initialize to defaultsettings. |
void glyr_signal_exit (GlyrQuery *query
);
Try to stop libglyr as soon as possible. This is supposed to be called on another thread. Calling this function twice on the same query will do nothing.
This function is threadsafe - but use with care anyway, since it causes libglyr to do really a hard stop. The returned data is NOT guaranteed to yield best results.
|
The currently running query you want to stop. |
const char * glyr_strerror (GLYR_ERROR ID
);
Gets a descriptive message from an error ID.
|
a member of the GLYR_ERROR enum. |
Returns : |
a descriptive nullterminated string, do NOT pass to free |
void glyr_string_to_md5sum (const char *string
,unsigned char *md5sum
);
Convert a string to a raw-data md5sum. Must be a 32 char long string only containing [0-9] and [a-f] The new checksum is written to m5sum, which must be a buffer with a size >= 16 bytes.
|
The string containing a human readable checksum (lowercase) |
|
A at lease 16 byte sized buffer of unsigned chars |