-
Notifications
You must be signed in to change notification settings - Fork 23
/
glyr.h
117 lines (96 loc) · 4.66 KB
/
glyr.h
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
/***********************************************************
* This file is part of glyr
* + a commnadline tool and library to download various sort of musicrelated metadata.
* + Copyright (C) [2011] [Christopher Pahl]
* + Hosted at: https://github.com/sahib/glyr
*
* glyr 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.
*
* glyr 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 glyr. If not, see <http://www.gnu.org/licenses/>.
**************************************************************/
#ifndef GLYR_H
#define GLYR_H
// all structs used by glyr are here
#include "types.h"
#ifdef __cplusplus
extern "C"
{
#endif
// Call this at startup
// calling more than once it won't do anything
void Gly_init(void);
// call this once you called Gly_init and you're done
void Gly_cleanup(void);
// Call this once you want to use libglyr
void Gly_init(void);
// Cleanup curl, libglyr does not use any global vars,
// but libcurl does. That's the only reason why there is a init/cleanup:
// both aren't threadsafe. (It's safe to Init at programstart and to do atexit(Gly_cleanup))
void Gly_cleanup(void);
// the actual main of glyr
GlyCacheList * Gly_get(GlyQuery * settings, enum GLYR_ERROR * error);
// Initialize settings struct to sane defaults
void Gly_init_query(GlyQuery * glyrs);
// free all memory that may been still allocated in struct
void Gly_destroy_query(GlyQuery * sets);
// GlyCacheList related
void Gly_free_list(GlyCacheList * lst);
GlyMemCache * Gly_clist_at(GlyCacheList * clist, int iter);
// Cache related
GlyMemCache * Gly_new_cache(void);
GlyMemCache * Gly_copy_cache(GlyMemCache * source);
void Gly_free_cache(GlyMemCache * c);
/* Gly_opt methods */
int GlyOpt_dlcallback(GlyQuery * settings, DL_callback dl_cb, void * userp);
int GlyOpt_type(GlyQuery * s, enum GLYR_GET_TYPE type);
int GlyOpt_artist(GlyQuery * s, char * artist);
int GlyOpt_album(GlyQuery * s, char * album);
int GlyOpt_title(GlyQuery * s, char * title);
int GlyOpt_cmaxsize(GlyQuery * s, int size);
int GlyOpt_cminsize(GlyQuery * s, int size);
int GlyOpt_parallel(GlyQuery * s, unsigned long val);
int GlyOpt_timeout(GlyQuery * s, unsigned long val);
int GlyOpt_redirects(GlyQuery * s, unsigned long val);
int GlyOpt_lang(GlyQuery * s, char * langcode);
int GlyOpt_number(GlyQuery * s, unsigned int num);
int GlyOpt_verbosity(GlyQuery * s, unsigned int level);
int GlyOpt_from(GlyQuery * s, const char * from);
int GlyOpt_color(GlyQuery * s, bool iLikeColorInMyLife);
int GlyOpt_plugmax(GlyQuery * s, int plugmax);
int GlyOpt_download(GlyQuery * s, bool download);
int GlyOpt_groupedDL(GlyQuery * s, bool groupedDL);
int GlyOpt_formats(GlyQuery * s, const char * formats);
int GlyOpt_fuzzyness(GlyQuery * s, int fuzz);
int GlyOpt_duplcheck(GlyQuery * s, bool duplcheck);
int GlyOpt_call_direct_use(GlyQuery * s, bool use);
int GlyOpt_call_direct_provider(GlyQuery * s, const char * provider);
int GlyOpt_call_direct_url(GlyQuery * s, const char * URL);
int GlyOpt_gtrans_source_lang(GlyQuery * s, const char * source);
int GlyOpt_gtrans_target_lang(GlyQuery * s, const char * target);
// get information about available plugins
GlyPlugin * Gly_get_provider_by_id(enum GLYR_GET_TYPE ID);
// Download a URL and sae it in Memcache
GlyMemCache * Gly_download(const char * url, GlyQuery * s);
// Short descriptive version of an error ID
const char * Gly_strerror(enum GLYR_ERROR ID);
// Returns the actual name of the group pointed by ID
const char * Gly_groupname_by_id(enum GLYR_GROUPS ID);
// return library version
const char * Gly_version(void);
// write binary file, this is for use in language bindings mainly, which partly can't easily write them themself
int Gly_write(GlyQuery * s, GlyMemCache * data, const char * path);
// Also include the translation API
#include "translate.h"
#ifdef _cplusplus
}
#endif
#endif