summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.c5
-rw-r--r--servers.c11
-rw-r--r--servers.h3
3 files changed, 17 insertions, 2 deletions
diff --git a/main.c b/main.c
index 1a7ba2c..6b40e86 100644
--- a/main.c
+++ b/main.c
@@ -2,6 +2,7 @@
#include "httpd.h"
#include "command_service.h"
#include "conf.h"
+#include "servers.h"
#include <glib.h>
#include <glib-object.h>
@@ -20,6 +21,8 @@ int main(int argc, char **argv) {
conf_load();
+ servers_init();
+
music_init();
music_scan_root();
@@ -36,6 +39,8 @@ int main(int argc, char **argv) {
server_stop();
music_free();
+ servers_free();
+
conf_free();
return 0;
diff --git a/servers.c b/servers.c
index 554bfcc..d3d69ee 100644
--- a/servers.c
+++ b/servers.c
@@ -1,4 +1,5 @@
#include "servers.h"
+#include "conf.h"
static GSList *servers = NULL;
@@ -30,7 +31,15 @@ gboolean server_remove(struct server *server) {
return TRUE;
}
-void server_clear() {
+void servers_init() {
+ gsize length;
+ gchar **s = conf_get_string_list("audist", "servers", &length);
+ for(int i = 0; i < length; i++) {
+ g_debug(" server %d: %s", i, s[i]);
+ }
+}
+
+void server_free() {
for(GSList *node = servers; node; node = g_slist_next(node)) {
struct server *s = node->data;
g_free(s->host);
diff --git a/servers.h b/servers.h
index 11dc3af..b6e809b 100644
--- a/servers.h
+++ b/servers.h
@@ -10,6 +10,7 @@ struct server {
gboolean server_add(const gchar *host, const guint16 port);
gboolean server_remove(struct server *server);
-void server_clear();
+void servers_init();
+void servers_free();
#endif