mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-27 23:55:57 -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();
|
||||
|
||||
queue_version = db_admin_getint(ADMIN_QUEUE_VERSION);
|
||||
queue_version = db_admin_getint(DB_ADMIN_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)
|
||||
{
|
||||
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");
|
||||
|
||||
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)
|
||||
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)
|
||||
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;
|
||||
|
||||
@ -6352,7 +6352,7 @@ db_init(void)
|
||||
|
||||
files = db_files_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();
|
||||
|
||||
|
16
src/db.h
16
src/db.h
@ -63,14 +63,14 @@ enum query_type {
|
||||
#define ARTWORK_SPOTIFY 6
|
||||
#define ARTWORK_HTTP 7
|
||||
|
||||
#define ADMIN_SCHEMA_VERSION_MAJOR "schema_version_major"
|
||||
#define ADMIN_SCHEMA_VERSION_MINOR "schema_version_minor"
|
||||
#define ADMIN_SCHEMA_VERSION "schema_version"
|
||||
#define ADMIN_QUEUE_VERSION "queue_version"
|
||||
#define ADMIN_DB_UPDATE "db_update"
|
||||
#define ADMIN_START_TIME "start_time"
|
||||
#define ADMIN_LASTFM_SESSION_KEY "lastfm_sk"
|
||||
#define ADMIN_SPOTIFY_REFRESH_TOKEN "spotify_refresh_token"
|
||||
#define DB_ADMIN_SCHEMA_VERSION_MAJOR "schema_version_major"
|
||||
#define DB_ADMIN_SCHEMA_VERSION_MINOR "schema_version_minor"
|
||||
#define DB_ADMIN_SCHEMA_VERSION "schema_version"
|
||||
#define DB_ADMIN_QUEUE_VERSION "queue_version"
|
||||
#define DB_ADMIN_DB_UPDATE "db_update"
|
||||
#define DB_ADMIN_START_TIME "start_time"
|
||||
#define DB_ADMIN_LASTFM_SESSION_KEY "lastfm_sk"
|
||||
#define DB_ADMIN_SPOTIFY_REFRESH_TOKEN "spotify_refresh_token"
|
||||
|
||||
struct query_params {
|
||||
/* Query parameters, filled in by caller */
|
||||
|
@ -184,7 +184,7 @@ response_process(struct http_client_ctx *ctx, char **errmsg)
|
||||
if (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)
|
||||
free(lastfm_session_key);
|
||||
@ -341,7 +341,7 @@ stop_scrobbling()
|
||||
// Disable LastFM, will be enabled after successful login request
|
||||
lastfm_disabled = true;
|
||||
|
||||
db_admin_delete(ADMIN_LASTFM_SESSION_KEY);
|
||||
db_admin_delete(DB_ADMIN_LASTFM_SESSION_KEY);
|
||||
}
|
||||
|
||||
/* Thread: filescanner, httpd */
|
||||
@ -422,7 +422,7 @@ lastfm_is_enabled(void)
|
||||
int
|
||||
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)
|
||||
{
|
||||
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);
|
||||
|
||||
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;
|
||||
|
@ -742,7 +742,7 @@ mpd_command_status(struct evbuffer *evbuf, int argc, char **argv, char **errmsg,
|
||||
break;
|
||||
}
|
||||
|
||||
queue_version = db_admin_getint(ADMIN_QUEUE_VERSION);
|
||||
queue_version = db_admin_getint(DB_ADMIN_QUEUE_VERSION);
|
||||
queue_length = db_queue_get_count();
|
||||
|
||||
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();
|
||||
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);
|
||||
db_update = db_admin_getint64(ADMIN_DB_UPDATE);
|
||||
db_update = db_admin_getint64(DB_ADMIN_DB_UPDATE);
|
||||
|
||||
//TODO [mpd] Implement missing stats attributes (playtime)
|
||||
evbuffer_add_printf(evbuf,
|
||||
|
@ -642,7 +642,7 @@ tokens_get(struct keyval *kv, const char **err)
|
||||
token_requested = time(NULL);
|
||||
|
||||
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();
|
||||
|
||||
@ -701,7 +701,7 @@ spotifywebapi_token_refresh(char **user)
|
||||
return 0;
|
||||
}
|
||||
|
||||
refresh_token = db_admin_get(ADMIN_SPOTIFY_REFRESH_TOKEN);
|
||||
refresh_token = db_admin_get(DB_ADMIN_SPOTIFY_REFRESH_TOKEN);
|
||||
if (!refresh_token)
|
||||
{
|
||||
DPRINTF(E_LOG, L_SPOTIFY, "No spotify refresh token found\n");
|
||||
|
Loading…
Reference in New Issue
Block a user