mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-29 00:23:23 -05:00
[db] Rename 'ADMIN_*' defines to 'DB_ADMIN_*'
This commit is contained in:
parent
96bcaa9102
commit
4800f9943b
12
src/db.c
12
src/db.c
@ -4042,10 +4042,10 @@ queue_inc_version_and_notify()
|
|||||||
|
|
||||||
db_transaction_begin();
|
db_transaction_begin();
|
||||||
|
|
||||||
queue_version = db_admin_getint(ADMIN_QUEUE_VERSION);
|
queue_version = db_admin_getint(DB_ADMIN_QUEUE_VERSION);
|
||||||
queue_version++;
|
queue_version++;
|
||||||
|
|
||||||
ret = db_admin_setint(ADMIN_QUEUE_VERSION, queue_version);
|
ret = db_admin_setint(DB_ADMIN_QUEUE_VERSION, queue_version);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
DPRINTF(E_LOG, L_DB, "Error incrementing queue version. Could not update version in admin table: %d\n", queue_version);
|
DPRINTF(E_LOG, L_DB, "Error incrementing queue version. Could not update version in admin table: %d\n", queue_version);
|
||||||
@ -6190,14 +6190,14 @@ db_check_version(void)
|
|||||||
|
|
||||||
vacuum = cfg_getbool(cfg_getsec(cfg, "sqlite"), "vacuum");
|
vacuum = cfg_getbool(cfg_getsec(cfg, "sqlite"), "vacuum");
|
||||||
|
|
||||||
db_ver_major = db_admin_getint(ADMIN_SCHEMA_VERSION_MAJOR);
|
db_ver_major = db_admin_getint(DB_ADMIN_SCHEMA_VERSION_MAJOR);
|
||||||
if (!db_ver_major)
|
if (!db_ver_major)
|
||||||
db_ver_major = db_admin_getint(ADMIN_SCHEMA_VERSION); // Pre schema v15.1
|
db_ver_major = db_admin_getint(DB_ADMIN_SCHEMA_VERSION); // Pre schema v15.1
|
||||||
|
|
||||||
if (!db_ver_major)
|
if (!db_ver_major)
|
||||||
return 1; // Will create new database
|
return 1; // Will create new database
|
||||||
|
|
||||||
db_ver_minor = db_admin_getint(ADMIN_SCHEMA_VERSION_MINOR);
|
db_ver_minor = db_admin_getint(DB_ADMIN_SCHEMA_VERSION_MINOR);
|
||||||
|
|
||||||
db_ver = db_ver_major * 100 + db_ver_minor;
|
db_ver = db_ver_major * 100 + db_ver_minor;
|
||||||
|
|
||||||
@ -6352,7 +6352,7 @@ db_init(void)
|
|||||||
|
|
||||||
files = db_files_get_count();
|
files = db_files_get_count();
|
||||||
pls = db_pl_get_count();
|
pls = db_pl_get_count();
|
||||||
db_admin_setint64(ADMIN_START_TIME, (int64_t) time(NULL));
|
db_admin_setint64(DB_ADMIN_START_TIME, (int64_t) time(NULL));
|
||||||
|
|
||||||
db_perthread_deinit();
|
db_perthread_deinit();
|
||||||
|
|
||||||
|
16
src/db.h
16
src/db.h
@ -63,14 +63,14 @@ enum query_type {
|
|||||||
#define ARTWORK_SPOTIFY 6
|
#define ARTWORK_SPOTIFY 6
|
||||||
#define ARTWORK_HTTP 7
|
#define ARTWORK_HTTP 7
|
||||||
|
|
||||||
#define ADMIN_SCHEMA_VERSION_MAJOR "schema_version_major"
|
#define DB_ADMIN_SCHEMA_VERSION_MAJOR "schema_version_major"
|
||||||
#define ADMIN_SCHEMA_VERSION_MINOR "schema_version_minor"
|
#define DB_ADMIN_SCHEMA_VERSION_MINOR "schema_version_minor"
|
||||||
#define ADMIN_SCHEMA_VERSION "schema_version"
|
#define DB_ADMIN_SCHEMA_VERSION "schema_version"
|
||||||
#define ADMIN_QUEUE_VERSION "queue_version"
|
#define DB_ADMIN_QUEUE_VERSION "queue_version"
|
||||||
#define ADMIN_DB_UPDATE "db_update"
|
#define DB_ADMIN_DB_UPDATE "db_update"
|
||||||
#define ADMIN_START_TIME "start_time"
|
#define DB_ADMIN_START_TIME "start_time"
|
||||||
#define ADMIN_LASTFM_SESSION_KEY "lastfm_sk"
|
#define DB_ADMIN_LASTFM_SESSION_KEY "lastfm_sk"
|
||||||
#define ADMIN_SPOTIFY_REFRESH_TOKEN "spotify_refresh_token"
|
#define DB_ADMIN_SPOTIFY_REFRESH_TOKEN "spotify_refresh_token"
|
||||||
|
|
||||||
struct query_params {
|
struct query_params {
|
||||||
/* Query parameters, filled in by caller */
|
/* Query parameters, filled in by caller */
|
||||||
|
@ -184,7 +184,7 @@ response_process(struct http_client_ctx *ctx, char **errmsg)
|
|||||||
if (sk)
|
if (sk)
|
||||||
{
|
{
|
||||||
DPRINTF(E_LOG, L_LASTFM, "Got session key from LastFM: %s\n", sk);
|
DPRINTF(E_LOG, L_LASTFM, "Got session key from LastFM: %s\n", sk);
|
||||||
db_admin_set(ADMIN_LASTFM_SESSION_KEY, sk);
|
db_admin_set(DB_ADMIN_LASTFM_SESSION_KEY, sk);
|
||||||
|
|
||||||
if (lastfm_session_key)
|
if (lastfm_session_key)
|
||||||
free(lastfm_session_key);
|
free(lastfm_session_key);
|
||||||
@ -341,7 +341,7 @@ stop_scrobbling()
|
|||||||
// Disable LastFM, will be enabled after successful login request
|
// Disable LastFM, will be enabled after successful login request
|
||||||
lastfm_disabled = true;
|
lastfm_disabled = true;
|
||||||
|
|
||||||
db_admin_delete(ADMIN_LASTFM_SESSION_KEY);
|
db_admin_delete(DB_ADMIN_LASTFM_SESSION_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Thread: filescanner, httpd */
|
/* Thread: filescanner, httpd */
|
||||||
@ -422,7 +422,7 @@ lastfm_is_enabled(void)
|
|||||||
int
|
int
|
||||||
lastfm_init(void)
|
lastfm_init(void)
|
||||||
{
|
{
|
||||||
lastfm_session_key = db_admin_get(ADMIN_LASTFM_SESSION_KEY);
|
lastfm_session_key = db_admin_get(DB_ADMIN_LASTFM_SESSION_KEY);
|
||||||
if (!lastfm_session_key)
|
if (!lastfm_session_key)
|
||||||
{
|
{
|
||||||
DPRINTF(E_DBG, L_LASTFM, "No valid LastFM session key\n");
|
DPRINTF(E_DBG, L_LASTFM, "No valid LastFM session key\n");
|
||||||
|
@ -104,7 +104,7 @@ handle_deferred_update_notifications(void)
|
|||||||
DPRINTF(E_DBG, L_LIB, "Database changed (%d changes)\n", deferred_update_notifications);
|
DPRINTF(E_DBG, L_LIB, "Database changed (%d changes)\n", deferred_update_notifications);
|
||||||
|
|
||||||
deferred_update_notifications = 0;
|
deferred_update_notifications = 0;
|
||||||
db_admin_setint64(ADMIN_DB_UPDATE, (int64_t) time(NULL));
|
db_admin_setint64(DB_ADMIN_DB_UPDATE, (int64_t) time(NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -742,7 +742,7 @@ mpd_command_status(struct evbuffer *evbuf, int argc, char **argv, char **errmsg,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
queue_version = db_admin_getint(ADMIN_QUEUE_VERSION);
|
queue_version = db_admin_getint(DB_ADMIN_QUEUE_VERSION);
|
||||||
queue_length = db_queue_get_count();
|
queue_length = db_queue_get_count();
|
||||||
|
|
||||||
evbuffer_add_printf(evbuf,
|
evbuffer_add_printf(evbuf,
|
||||||
@ -832,9 +832,9 @@ mpd_command_stats(struct evbuffer *evbuf, int argc, char **argv, char **errmsg,
|
|||||||
artists = db_files_get_artist_count();
|
artists = db_files_get_artist_count();
|
||||||
albums = db_files_get_album_count();
|
albums = db_files_get_album_count();
|
||||||
|
|
||||||
start_time = (time_t) db_admin_getint64(ADMIN_START_TIME);
|
start_time = (time_t) db_admin_getint64(DB_ADMIN_START_TIME);
|
||||||
uptime = difftime(time(NULL), start_time);
|
uptime = difftime(time(NULL), start_time);
|
||||||
db_update = db_admin_getint64(ADMIN_DB_UPDATE);
|
db_update = db_admin_getint64(DB_ADMIN_DB_UPDATE);
|
||||||
|
|
||||||
//TODO [mpd] Implement missing stats attributes (playtime)
|
//TODO [mpd] Implement missing stats attributes (playtime)
|
||||||
evbuffer_add_printf(evbuf,
|
evbuffer_add_printf(evbuf,
|
||||||
|
@ -642,7 +642,7 @@ tokens_get(struct keyval *kv, const char **err)
|
|||||||
token_requested = time(NULL);
|
token_requested = time(NULL);
|
||||||
|
|
||||||
if (spotify_refresh_token)
|
if (spotify_refresh_token)
|
||||||
db_admin_set(ADMIN_SPOTIFY_REFRESH_TOKEN, spotify_refresh_token);
|
db_admin_set(DB_ADMIN_SPOTIFY_REFRESH_TOKEN, spotify_refresh_token);
|
||||||
|
|
||||||
request_user_info();
|
request_user_info();
|
||||||
|
|
||||||
@ -701,7 +701,7 @@ spotifywebapi_token_refresh(char **user)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh_token = db_admin_get(ADMIN_SPOTIFY_REFRESH_TOKEN);
|
refresh_token = db_admin_get(DB_ADMIN_SPOTIFY_REFRESH_TOKEN);
|
||||||
if (!refresh_token)
|
if (!refresh_token)
|
||||||
{
|
{
|
||||||
DPRINTF(E_LOG, L_SPOTIFY, "No spotify refresh token found\n");
|
DPRINTF(E_LOG, L_SPOTIFY, "No spotify refresh token found\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user