mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-26 04:26:14 -05:00
start plugin infrastructure
This commit is contained in:
28
src/main.c
28
src/main.c
@@ -81,6 +81,7 @@
|
||||
#include "dynamic-art.h"
|
||||
#include "db-generic.h"
|
||||
#include "os.h"
|
||||
#include "plugin.h"
|
||||
|
||||
#ifdef HAVE_GETOPT_H
|
||||
# include "getopt.h"
|
||||
@@ -188,9 +189,14 @@ int main(int argc, char *argv[]) {
|
||||
char *logfile,*db_type,*db_parms,*web_root,*runas;
|
||||
char **mp3_dir_array;
|
||||
char *servername,*iface;
|
||||
int index;
|
||||
|
||||
char txtrecord[255];
|
||||
|
||||
|
||||
char *plugindir;
|
||||
char plugin[PATH_MAX];
|
||||
char **pluginarray;
|
||||
|
||||
int err;
|
||||
char *perr=NULL;
|
||||
|
||||
@@ -296,6 +302,26 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
}
|
||||
|
||||
/* load plugins before we drop privs? Maybe... let the
|
||||
* plugins do stuff they might need to */
|
||||
if((plugindir=conf_alloc_string("plugins","plugin_dir",NULL)) != NULL) {
|
||||
if(conf_get_array("plugins","plugins",&pluginarray)==TRUE) {
|
||||
index = 0;
|
||||
while(pluginarray[index]) {
|
||||
sprintf(plugin,"%s/%s",plugindir,pluginarray[index]);
|
||||
if(plugin_load(&perr,plugin) != PLUGIN_E_SUCCESS) {
|
||||
DPRINTF(E_LOG,L_MAIN,"Error loading plugin %s: %s\n",
|
||||
plugin, perr);
|
||||
free(perr);
|
||||
perr = NULL;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
} else {
|
||||
free(plugindir);
|
||||
}
|
||||
}
|
||||
|
||||
runas = conf_alloc_string("general","runas","nobody");
|
||||
|
||||
#ifndef WITHOUT_MDNS
|
||||
|
||||
Reference in New Issue
Block a user