From 4800f9943baaaa3537c1be496e943f2c6abf4fd6 Mon Sep 17 00:00:00 2001 From: chme Date: Sun, 19 Nov 2017 21:14:41 +0100 Subject: [PATCH] [db] Rename 'ADMIN_*' defines to 'DB_ADMIN_*' --- src/db.c | 12 ++++++------ src/db.h | 16 ++++++++-------- src/lastfm.c | 6 +++--- src/library.c | 2 +- src/mpd.c | 6 +++--- src/spotify_webapi.c | 4 ++-- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/db.c b/src/db.c index bc74b551..35007e17 100644 --- a/src/db.c +++ b/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(); diff --git a/src/db.h b/src/db.h index 0f4a0ad5..020a33d3 100644 --- a/src/db.h +++ b/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 */ diff --git a/src/lastfm.c b/src/lastfm.c index 30efe59a..d72538c3 100644 --- a/src/lastfm.c +++ b/src/lastfm.c @@ -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"); diff --git a/src/library.c b/src/library.c index f43bc16d..b5e357f0 100644 --- a/src/library.c +++ b/src/library.c @@ -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; diff --git a/src/mpd.c b/src/mpd.c index 97109fa9..0cf8752e 100644 --- a/src/mpd.c +++ b/src/mpd.c @@ -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, diff --git a/src/spotify_webapi.c b/src/spotify_webapi.c index cf5ae2f0..3452d3bf 100644 --- a/src/spotify_webapi.c +++ b/src/spotify_webapi.c @@ -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");