Commit 1a59afa3 authored by Max Kellermann's avatar Max Kellermann

stored_playlist: moved configuration variables from playlist.c

Don't declare and export variables specific to stored playlists in playlist.c/playlist.h.
parent 85f7e964
...@@ -69,6 +69,9 @@ ...@@ -69,6 +69,9 @@
#define CONF_BOOL_UNSET -1 #define CONF_BOOL_UNSET -1
#define CONF_BOOL_INVALID -2 #define CONF_BOOL_INVALID -2
#define DEFAULT_PLAYLIST_MAX_LENGTH (1024*16)
#define DEFAULT_PLAYLIST_SAVE_ABSOLUTE_PATHS false
struct block_param { struct block_param {
char *name; char *name;
char *value; char *value;
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "idle.h" #include "idle.h"
#include "command.h" #include "command.h"
#include "playlist.h" #include "playlist.h"
#include "stored_playlist.h"
#include "database.h" #include "database.h"
#include "update.h" #include "update.h"
#include "player_thread.h" #include "player_thread.h"
...@@ -230,6 +231,7 @@ int main(int argc, char *argv[]) ...@@ -230,6 +231,7 @@ int main(int argc, char *argv[])
mapper_init(); mapper_init();
initPermissions(); initPermissions();
initPlaylist(); initPlaylist();
spl_global_init();
#ifdef ENABLE_ARCHIVE #ifdef ENABLE_ARCHIVE
archive_plugin_init_all(); archive_plugin_init_all();
#endif #endif
......
...@@ -67,17 +67,11 @@ ...@@ -67,17 +67,11 @@
#define PLAYLIST_HASH_MULT 4 #define PLAYLIST_HASH_MULT 4
#define DEFAULT_PLAYLIST_MAX_LENGTH (1024*16)
#define DEFAULT_PLAYLIST_SAVE_ABSOLUTE_PATHS false
/** random number generator fur shuffling */ /** random number generator fur shuffling */
static GRand *g_rand; static GRand *g_rand;
/** the global playlist object */ /** the global playlist object */
static struct playlist playlist; static struct playlist playlist;
unsigned playlist_max_length;
bool playlist_saveAbsolutePaths = DEFAULT_PLAYLIST_SAVE_ABSOLUTE_PATHS;
static void playPlaylistOrderNumber(int orderNum); static void playPlaylistOrderNumber(int orderNum);
...@@ -110,18 +104,13 @@ void initPlaylist(void) ...@@ -110,18 +104,13 @@ void initPlaylist(void)
{ {
g_rand = g_rand_new(); g_rand = g_rand_new();
playlist_max_length = config_get_positive(CONF_MAX_PLAYLIST_LENGTH, queue_init(&playlist.queue,
DEFAULT_PLAYLIST_MAX_LENGTH); config_get_positive(CONF_MAX_PLAYLIST_LENGTH,
DEFAULT_PLAYLIST_MAX_LENGTH));
queue_init(&playlist.queue, playlist_max_length);
playlist.queued = -1; playlist.queued = -1;
playlist.current = -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); event_pipe_register(PIPE_EVENT_TAG, playlist_tag_event);
} }
......
...@@ -83,10 +83,6 @@ struct playlist { ...@@ -83,10 +83,6 @@ struct playlist {
int queued; int queued;
}; };
extern bool playlist_saveAbsolutePaths;
extern unsigned playlist_max_length;
void initPlaylist(void); void initPlaylist(void);
void finishPlaylist(void); void finishPlaylist(void);
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
*/ */
#include "playlist_save.h" #include "playlist_save.h"
#include "playlist.h" #include "stored_playlist.h"
#include "song.h" #include "song.h"
#include "mapper.h" #include "mapper.h"
#include "path.h" #include "path.h"
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "ls.h" #include "ls.h"
#include "database.h" #include "database.h"
#include "idle.h" #include "idle.h"
#include "conf.h"
#include <assert.h> #include <assert.h>
#include <sys/types.h> #include <sys/types.h>
...@@ -33,6 +34,20 @@ ...@@ -33,6 +34,20 @@
#include <string.h> #include <string.h>
#include <errno.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 * static struct stored_playlist_info *
load_playlist_info(const char *parent_path_fs, const char *name_fs) load_playlist_info(const char *parent_path_fs, const char *name_fs)
{ {
......
...@@ -32,6 +32,14 @@ struct stored_playlist_info { ...@@ -32,6 +32,14 @@ struct stored_playlist_info {
time_t mtime; 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 * Returns a list of stored_playlist_info struct pointers. Returns
* NULL if an error occured. * NULL if an error occured.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment