mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-25 22:55:56 -05:00
Make DAAP cache use and location configurable
This commit is contained in:
parent
f3a19fce8e
commit
39b9c4fc33
@ -11,6 +11,8 @@ general {
|
|||||||
admin_password = "unused"
|
admin_password = "unused"
|
||||||
# Enable/disable IPv6
|
# Enable/disable IPv6
|
||||||
ipv6 = no
|
ipv6 = no
|
||||||
|
# Location of DAAP cache (comment the line to disable caching)
|
||||||
|
daapcache_path = "/var/cache/forked-daapd/daapcache.db"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Library configuration
|
# Library configuration
|
||||||
|
@ -53,6 +53,7 @@ static cfg_opt_t sec_general[] =
|
|||||||
CFG_INT("db_pragma_synchronous", -1, CFGF_NONE),
|
CFG_INT("db_pragma_synchronous", -1, CFGF_NONE),
|
||||||
CFG_INT_CB("loglevel", E_LOG, CFGF_NONE, &cb_loglevel),
|
CFG_INT_CB("loglevel", E_LOG, CFGF_NONE, &cb_loglevel),
|
||||||
CFG_BOOL("ipv6", cfg_false, CFGF_NONE),
|
CFG_BOOL("ipv6", cfg_false, CFGF_NONE),
|
||||||
|
CFG_STR("daapcache_path", NULL, CFGF_NONE),
|
||||||
CFG_END()
|
CFG_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
|
#include "conffile.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "httpd_daap.h"
|
#include "httpd_daap.h"
|
||||||
#include "db.h"
|
#include "db.h"
|
||||||
@ -74,7 +75,7 @@ static int g_initialized;
|
|||||||
|
|
||||||
// Global cache database handle
|
// Global cache database handle
|
||||||
static sqlite3 *g_db_hdl;
|
static sqlite3 *g_db_hdl;
|
||||||
static char *g_db_path = "/home/espen/daapcache.db";
|
static char *g_db_path;
|
||||||
|
|
||||||
// After being triggered wait 5 seconds before rebuilding daapcache
|
// After being triggered wait 5 seconds before rebuilding daapcache
|
||||||
static struct timeval g_wait = { 5, 0 };
|
static struct timeval g_wait = { 5, 0 };
|
||||||
@ -490,6 +491,9 @@ daapcache_trigger(void)
|
|||||||
{
|
{
|
||||||
struct daapcache_command *cmd;
|
struct daapcache_command *cmd;
|
||||||
|
|
||||||
|
if (!g_initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
cmd = (struct daapcache_command *)malloc(sizeof(struct daapcache_command));
|
cmd = (struct daapcache_command *)malloc(sizeof(struct daapcache_command));
|
||||||
if (!cmd)
|
if (!cmd)
|
||||||
{
|
{
|
||||||
@ -513,6 +517,9 @@ daapcache_get(const char *query)
|
|||||||
struct evbuffer *evbuf;
|
struct evbuffer *evbuf;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
if (!g_initialized)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
command_init(&cmd);
|
command_init(&cmd);
|
||||||
|
|
||||||
cmd.func = daapcache_query_get;
|
cmd.func = daapcache_query_get;
|
||||||
@ -532,6 +539,14 @@ daapcache_init(void)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
g_db_path = cfg_getstr(cfg_getsec(cfg, "general"), "daapcache_path");
|
||||||
|
if (!g_db_path)
|
||||||
|
{
|
||||||
|
DPRINTF(E_LOG, L_DCACHE, "Cache disabled\n");
|
||||||
|
g_initialized = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
# if defined(__linux__)
|
# if defined(__linux__)
|
||||||
ret = pipe2(g_exit_pipe, O_CLOEXEC);
|
ret = pipe2(g_exit_pipe, O_CLOEXEC);
|
||||||
# else
|
# else
|
||||||
|
Loading…
Reference in New Issue
Block a user