aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/conf.h3
-rw-r--r--src/main.c2
-rw-r--r--src/playlist.c17
-rw-r--r--src/playlist.h4
-rw-r--r--src/playlist_save.c2
-rw-r--r--src/stored_playlist.c15
-rw-r--r--src/stored_playlist.h8
7 files changed, 32 insertions, 19 deletions
diff --git a/src/conf.h b/src/conf.h
index e9c750368..a133198bd 100644
--- a/src/conf.h
+++ b/src/conf.h
@@ -69,6 +69,9 @@
#define CONF_BOOL_UNSET -1
#define CONF_BOOL_INVALID -2
+#define DEFAULT_PLAYLIST_MAX_LENGTH (1024*16)
+#define DEFAULT_PLAYLIST_SAVE_ABSOLUTE_PATHS false
+
struct block_param {
char *name;
char *value;
diff --git a/src/main.c b/src/main.c
index 550453dfe..04a8de33e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -22,6 +22,7 @@
#include "idle.h"
#include "command.h"
#include "playlist.h"
+#include "stored_playlist.h"
#include "database.h"
#include "update.h"
#include "player_thread.h"
@@ -230,6 +231,7 @@ int main(int argc, char *argv[])
mapper_init();
initPermissions();
initPlaylist();
+ spl_global_init();
#ifdef ENABLE_ARCHIVE
archive_plugin_init_all();
#endif
diff --git a/src/playlist.c b/src/playlist.c
index 98fac5b7b..2eecc3bea 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -67,17 +67,11 @@
#define PLAYLIST_HASH_MULT 4
-#define DEFAULT_PLAYLIST_MAX_LENGTH (1024*16)
-#define DEFAULT_PLAYLIST_SAVE_ABSOLUTE_PATHS false
-
/** random number generator fur shuffling */
static GRand *g_rand;
/** the global playlist object */
static struct playlist playlist;
-unsigned playlist_max_length;
-
-bool playlist_saveAbsolutePaths = DEFAULT_PLAYLIST_SAVE_ABSOLUTE_PATHS;
static void playPlaylistOrderNumber(int orderNum);
@@ -110,18 +104,13 @@ void initPlaylist(void)
{
g_rand = g_rand_new();
- playlist_max_length = config_get_positive(CONF_MAX_PLAYLIST_LENGTH,
- DEFAULT_PLAYLIST_MAX_LENGTH);
-
- queue_init(&playlist.queue, playlist_max_length);
+ queue_init(&playlist.queue,
+ config_get_positive(CONF_MAX_PLAYLIST_LENGTH,
+ DEFAULT_PLAYLIST_MAX_LENGTH));
playlist.queued = -1;
playlist.current = -1;
- playlist_saveAbsolutePaths =
- config_get_bool(CONF_SAVE_ABSOLUTE_PATHS,
- DEFAULT_PLAYLIST_SAVE_ABSOLUTE_PATHS);
-
event_pipe_register(PIPE_EVENT_TAG, playlist_tag_event);
}
diff --git a/src/playlist.h b/src/playlist.h
index 9d87c1e51..e257e5392 100644
--- a/src/playlist.h
+++ b/src/playlist.h
@@ -83,10 +83,6 @@ struct playlist {
int queued;
};
-extern bool playlist_saveAbsolutePaths;
-
-extern unsigned playlist_max_length;
-
void initPlaylist(void);
void finishPlaylist(void);
diff --git a/src/playlist_save.c b/src/playlist_save.c
index 0913fcd09..d2fe4c9ba 100644
--- a/src/playlist_save.c
+++ b/src/playlist_save.c
@@ -17,7 +17,7 @@
*/
#include "playlist_save.h"
-#include "playlist.h"
+#include "stored_playlist.h"
#include "song.h"
#include "mapper.h"
#include "path.h"
diff --git a/src/stored_playlist.c b/src/stored_playlist.c
index 26dcb34d3..f802add94 100644
--- a/src/stored_playlist.c
+++ b/src/stored_playlist.c
@@ -24,6 +24,7 @@
#include "ls.h"
#include "database.h"
#include "idle.h"
+#include "conf.h"
#include <assert.h>
#include <sys/types.h>
@@ -33,6 +34,20 @@
#include <string.h>
#include <errno.h>
+static unsigned playlist_max_length;
+bool playlist_saveAbsolutePaths = DEFAULT_PLAYLIST_SAVE_ABSOLUTE_PATHS;
+
+void
+spl_global_init(void)
+{
+ playlist_max_length = config_get_positive(CONF_MAX_PLAYLIST_LENGTH,
+ DEFAULT_PLAYLIST_MAX_LENGTH);
+
+ playlist_saveAbsolutePaths =
+ config_get_bool(CONF_SAVE_ABSOLUTE_PATHS,
+ DEFAULT_PLAYLIST_SAVE_ABSOLUTE_PATHS);
+}
+
static struct stored_playlist_info *
load_playlist_info(const char *parent_path_fs, const char *name_fs)
{
diff --git a/src/stored_playlist.h b/src/stored_playlist.h
index 26dd163a1..40372d376 100644
--- a/src/stored_playlist.h
+++ b/src/stored_playlist.h
@@ -32,6 +32,14 @@ struct stored_playlist_info {
time_t mtime;
};
+extern bool playlist_saveAbsolutePaths;
+
+/**
+ * Perform some global initialization, e.g. load configuration values.
+ */
+void
+spl_global_init(void);
+
/**
* Returns a list of stored_playlist_info struct pointers. Returns
* NULL if an error occured.