1 /*
2  *  Copyright (C) 2009-2014  Christian Heckendorf <heckendorfc@gmail.com>
3  *
4  *  This program is free software: you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation, either version 3 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef _UTIL_H
19 #define _UTIL_H
20 
21 #include "defs.h"
22 
23 int experr(const char *epath, int eerrno);
24 int isURL(const char *in);
25 char *expand(char *in);
26 int fileFormat(struct pluginitem **list, const char *argv);
27 int getID(const char *arg);
28 int strToID(const char *argv);
29 char *getFilename(const char *path);
30 int *getMulti(char *arg, int *length);
31 int getFileTypeByName(const char *name);
32 int getGroupSongIDs(char *args, const int arglen, struct IDList *id_struct);
33 
34 int findPluginIDByType(int type);
35 struct pluginitem *findPluginByID(struct pluginitem *list, int id);
36 int getPlugin(struct dbitem *dbi, const int index, void **module);
37 int getPluginModule(void **module, char *lib);
38 struct pluginitem **openPlugins();
39 struct pluginitem *closePlugin(struct pluginitem *head);
40 void closePluginList(struct pluginitem *head);
41 
42 void cleanTempSelect(const int tempid);
43 int mergeTempSelect(int ida, int idb);
44 int insertTempSelect(const int *ids, const int idlen);
45 int insertTempSelectQuery(const char *query);
46 int insertTempSelectQueryCount(const char *query,int *count);
47 void db_clean(char *str, const char *data, const size_t size);
48 void db_safe(char *str, const char *data, const size_t size);
49 
50 void miFree(struct musicInfo *mi);
51 void miClean(struct musicInfo *mi);
52 
53 #endif
54