diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0a44f2a53b1829be0d5a52af8f5dc1d521996e7d..efc30f62f9b064c61efff391b26234b1cc324586 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -157,7 +157,7 @@ For the compatibility column, the possible values are the following: | `currentsong` | `currentsong` | ~ | use the lektord tags, not MPD once | | `idle [subsistem]` | `idle [subsistem]` | + | | | `status` | `status` | ~ | slight differencies in the duration and time, not working with mpc | -| `stats` | `stats` | ~ | don't send all the stats, only `db_update` | +| `stats` | `stats` | ~ | db\_playtime and playtime files are missing | | `consume {state}` | `consume {state}` | + | | | `random {state}` | `random {state}` | + | | | `repeat {state}` | `repeat {state}` | + | | diff --git a/inc/lektor/net.h b/inc/lektor/net.h index 3fc0eda1ac3bdc85172632e1690547d070cd9bde..f7607f955385e7ed9ff67f417065a2c1daa5c4da 100644 --- a/inc/lektor/net.h +++ b/inc/lektor/net.h @@ -54,6 +54,7 @@ struct lkt_state { /* The database */ volatile sqlite3 *db; const char *kara_prefix; + volatile uint8_t is_updating; /* Internal event flags */ mpd_idle_flag mpd_idle_events; diff --git a/src/base/commands.c b/src/base/commands.c index 2f2c18ddec44bbbb7be0ddcae1092a71521a9626..fea011fc41beba86e544ccf7be2d531a7aad54f5 100644 --- a/src/base/commands.c +++ b/src/base/commands.c @@ -142,10 +142,9 @@ bool command_stats(struct lkt_state *srv, size_t c, char UNUSED *args[LKT_MESSAGE_ARGS_MAX]) { struct lkt_message *out = lkt_message_new(); - int is_updating = 0, artists = 0, albums = 0, songs = 0; + int artists = 0, albums = 0, songs = 0; long ts_update = 0; - MOD_CALL(srv->repo_mod, "is_updating", &is_updating); database_get_update(srv->db, &ts_update, NULL, NULL); database_stats(srv->db, &artists, &albums, &songs); @@ -161,7 +160,7 @@ command_stats(struct lkt_state *srv, size_t c, char UNUSED *args[LKT_MESSAGE_ARG "artists: %d\n" /* Number of authors */ "albums: %d\n" /* Number of source names */ "songs: %d\n", /* Number of songs */ - is_updating, (uint64_t) ts_update, + srv->is_updating, (uint64_t) ts_update, (uint64_t) (time(NULL) - srv->start_date), artists, albums, songs); lkt_state_send(srv, c, out); diff --git a/src/module/module_repo.c b/src/module/module_repo.c index ec8b8107bfa073c6c411859a90f499025d53d023..054bbb19ddf35ea6d903cef082a3a91e40d7ee6a 100644 --- a/src/module/module_repo.c +++ b/src/module/module_repo.c @@ -848,23 +848,6 @@ end_no_lock: return ret; } -static int -mod_is_updating(va_list *va) -{ - va_list copy; - struct module_repo_internal **repo; - int *ret; - va_copy(copy, *va); - repo = (struct module_repo_internal **) va_arg(copy, void **); - ret = va_arg(copy, int *); - if (ret == NULL) - return 1; - /* Don't differentiate kinds of downloads here */ - *ret = (*repo)->updating; - va_end(copy); - return 0; -} - static int mod_import(va_list *va) { @@ -895,15 +878,12 @@ end_no_lock: } REG_BEGIN(repo_reg) -REG_ADD_NAMED("new", mod_new) /* Create the module */ -REG_ADD_NAMED("free", mod_free) /* Close and free ressources */ -REG_ADD_NAMED("close", mod_close) /* Stop the module */ -REG_ADD_NAMED("update", mod_update) /* Update from kurisu */ -REG_ADD_NAMED("rescan", mod_rescan) /* Rescan from hard drive */ -REG_ADD_NAMED("import", mod_import) /* Import favorites from kurisu */ -REG_ADD_NAMED("is_updating", mod_is_updating) /* Is the module updating the - * base, either the favorites - * or the bakabase */ +REG_ADD_NAMED("new", mod_new) /* Create the module */ +REG_ADD_NAMED("free", mod_free) /* Close and free ressources */ +REG_ADD_NAMED("close", mod_close) /* Stop the module */ +REG_ADD_NAMED("update", mod_update) /* Update from kurisu */ +REG_ADD_NAMED("rescan", mod_rescan) /* Rescan from hard drive */ +REG_ADD_NAMED("import", mod_import) /* Import favorites from kurisu */ REG_END() #if ! defined (LKT_STATIC_MODULE) REG_EXPORT(repo_reg) diff --git a/src/net/listen.c b/src/net/listen.c index f24293579b41224a8a3938e8e745b339940762ce..f8d2b94ff320ed2dc97c47666640e53976df3d83 100644 --- a/src/net/listen.c +++ b/src/net/listen.c @@ -867,7 +867,7 @@ redo: }) __CASE(play_file, {}) - __CASE(db_updating, {}) + __CASE(db_updating, { srv->is_updating = (uint8_t) (size_t) evt.attr; }) /* The null event, just return */ case lkt_event_null: