From e7d6fbb9fc153f9b58071ddfa540971d4fd1173b Mon Sep 17 00:00:00 2001 From: chme Date: Fri, 15 Dec 2017 17:03:16 +0100 Subject: [PATCH] [listener/etc.] Rename LISTENER_STICKER to LISTENER_RATING Unit there is a real sticker implementation, make it clear, that the event is only triggered for rating changes. --- src/cache.c | 2 +- src/db.c | 4 ++-- src/listener.h | 4 ++-- src/mpd.c | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/cache.c b/src/cache.c index 3039e3d1..c51d2034 100644 --- a/src/cache.c +++ b/src/cache.c @@ -1596,7 +1596,7 @@ cache_init(void) cmdbase = commands_base_new(evbase_cache, NULL); - ret = listener_add(cache_daap_listener_cb, LISTENER_DATABASE | LISTENER_STICKER); + ret = listener_add(cache_daap_listener_cb, LISTENER_DATABASE | LISTENER_RATING); if (ret < 0) { DPRINTF(E_LOG, L_CACHE, "Could not create listener event\n"); diff --git a/src/db.c b/src/db.c index f0ca3e40..94b2991f 100644 --- a/src/db.c +++ b/src/db.c @@ -2508,7 +2508,7 @@ db_file_rating_update_byid(uint32_t id, uint32_t rating) query = sqlite3_mprintf(Q_TMPL, rating, id); - ret = db_query_run(query, 1, LISTENER_STICKER); + ret = db_query_run(query, 1, LISTENER_RATING); return ((ret < 0) ? -1 : sqlite3_changes(hdl)); #undef Q_TMPL @@ -2523,7 +2523,7 @@ db_file_rating_update_byvirtualpath(const char *virtual_path, uint32_t rating) query = sqlite3_mprintf(Q_TMPL, rating, virtual_path); - ret = db_query_run(query, 1, LISTENER_STICKER); + ret = db_query_run(query, 1, LISTENER_RATING); return ((ret < 0) ? -1 : sqlite3_changes(hdl)); #undef Q_TMPL diff --git a/src/listener.h b/src/listener.h index 26d40777..13988835 100644 --- a/src/listener.h +++ b/src/listener.h @@ -26,8 +26,8 @@ enum listener_event_type LISTENER_SPOTIFY = (1 << 9), /* Last.fm status changes (enable/disable scrobbling) */ LISTENER_LASTFM = (1 << 10), - /* The sticker database has been modified (MPD) */ - LISTENER_STICKER = (1 << 11), + /* Song rating changes */ + LISTENER_RATING = (1 << 11), }; typedef void (*notify)(short event_mask); diff --git a/src/mpd.c b/src/mpd.c index 7b702cd4..8783bc83 100644 --- a/src/mpd.c +++ b/src/mpd.c @@ -59,7 +59,7 @@ #include "remote_pairing.h" -#define MPD_ALL_IDLE_LISTENER_EVENTS (LISTENER_PLAYER | LISTENER_QUEUE | LISTENER_VOLUME | LISTENER_SPEAKER | LISTENER_OPTIONS | LISTENER_DATABASE | LISTENER_UPDATE | LISTENER_STORED_PLAYLIST | LISTENER_STICKER) +#define MPD_ALL_IDLE_LISTENER_EVENTS (LISTENER_PLAYER | LISTENER_QUEUE | LISTENER_VOLUME | LISTENER_SPEAKER | LISTENER_OPTIONS | LISTENER_DATABASE | LISTENER_UPDATE | LISTENER_STORED_PLAYLIST | LISTENER_RATING) #define MPD_RATING_FACTOR 10.0 static pthread_t tid_mpd; @@ -669,7 +669,7 @@ mpd_command_idle(struct evbuffer *evbuf, int argc, char **argv, char **errmsg, s else if (0 == strcmp(argv[i], "stored_playlist")) ctx->idle_events |= LISTENER_STORED_PLAYLIST; else if (0 == strcmp(argv[i], "sticker")) - ctx->idle_events |= LISTENER_STICKER; + ctx->idle_events |= LISTENER_RATING; else DPRINTF(E_DBG, L_MPD, "Idle command for '%s' not supported\n", argv[i]); } @@ -5096,7 +5096,7 @@ mpd_notify_idle_client(struct mpd_client_ctx *client_ctx, short events) evbuffer_add(client_ctx->evbuffer, "changed: options\n", 17); if (events & LISTENER_STORED_PLAYLIST) evbuffer_add(client_ctx->evbuffer, "changed: stored_playlist\n", 25); - if (events & LISTENER_STICKER) + if (events & LISTENER_RATING) evbuffer_add(client_ctx->evbuffer, "changed: sticker\n", 17); evbuffer_add(client_ctx->evbuffer, "OK\n", 3);