From: Andre Noll Date: Sat, 21 Oct 2023 16:56:48 +0000 (+0200) Subject: Merge topic branch t/afs-select into master X-Git-Tag: v0.7.3~11 X-Git-Url: http://git.tuebingen.mpg.de/?a=commitdiff_plain;h=101dcb49997b393280c10ba5a1cfc11e8fe0a091;hp=4345aa176aecdbd9a876e7efdcc034acd29616a7;p=paraslash.git Merge topic branch t/afs-select into master A single patch which silences the select command. The merge conflicted in afs.c, but that was trivial to resolve. * refs/heads/t/afs-select: server: Implement select -verbose. --- diff --git a/NEWS.md b/NEWS.md index 22816b19..aa515e5a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -15,6 +15,9 @@ NEWS - The --admissible option of the ls command now takes an optional argument. When invoked like --admissible=m/foo, only files which are admissible with respect to mood foo are listed. +- The select server command is now quiet by default, The new --verbose + option can be used to show information about the newly loaded mood + or playlist. Downloads: [tarball](./releases/paraslash-git.tar.xz) diff --git a/afs.c b/afs.c index 3083084c..445d5871 100644 --- a/afs.c +++ b/afs.c @@ -970,29 +970,32 @@ static int com_select_callback(struct afs_callback_arg *aca) const struct lls_command *cmd = SERVER_CMD_CMD_PTR(SELECT); const char *arg; int ret; + struct para_buffer *pbout; ret = lls_deserialize_parse_result(aca->query.data, cmd, &aca->lpr); assert(ret >= 0); arg = lls_input(0, aca->lpr); + pbout = SERVER_CMD_OPT_GIVEN(SELECT, VERBOSE, aca->lpr)? + &aca->pbout : NULL; score_clear(); if (current_play_mode == PLAY_MODE_MOOD) mood_unload(NULL); else playlist_unload(NULL); - ret = activate_mood_or_playlist(arg, &aca->pbout); + ret = activate_mood_or_playlist(arg, pbout); if (ret >= 0) goto free_lpr; /* ignore subsequent errors (but log them) */ if (current_mop && strcmp(current_mop, arg) != 0) { int ret2; afs_error(aca, "switching back to %s\n", current_mop); - ret2 = activate_mood_or_playlist(current_mop, &aca->pbout); + ret2 = activate_mood_or_playlist(current_mop, pbout); if (ret2 >= 0) goto free_lpr; afs_error(aca, "could not reactivate %s: %s\n", current_mop, para_strerror(-ret2)); } - activate_mood_or_playlist(NULL, &aca->pbout); + activate_mood_or_playlist(NULL, pbout); free_lpr: lls_free_parse_result(aca->lpr, cmd); return ret; diff --git a/m4/lls/server_cmd.suite.m4 b/m4/lls/server_cmd.suite.m4 index 1cec6816..5b5c59ad 100644 --- a/m4/lls/server_cmd.suite.m4 +++ b/m4/lls/server_cmd.suite.m4 @@ -417,6 +417,9 @@ m4_include(`com_ll.m4') activates the mood named 'foo'. [/description] + [option verbose] + short_opt = v + summary = print information about the loaded mood or playlist [subcommand sender] purpose = control paraslash senders diff --git a/mood.c b/mood.c index b4d50c88..1e15ef0e 100644 --- a/mood.c +++ b/mood.c @@ -541,12 +541,15 @@ static char *get_statistics(struct mood_instance *m, int64_t sse) "loaded mood %s (%u files)\n" "last_played mean/sigma: %d/%d days\n" "num_played mean/sigma: %" PRId64 "/%" PRIu64 "\n" + "correction factor ratio: %.2lf\n" , m->name? m->name : "(dummy)", n, mean_days, sigma_days, m->stats.num_played_sum / n, - int_sqrt(m->stats.num_played_qd / n) + int_sqrt(m->stats.num_played_qd / n), + 86400.0 * m->stats.last_played_correction / + m->stats.num_played_correction ); }