disorder_config(5) for details. Fixes defect #11.
- there is a new configuration item replay_min defining the minimum
time before a played track can be picked at random. The default is
8 hours (which matches the earlier behaviour).
+ - recently added tracks are biased up; see new_bias and new_bias_age
+ in disorder_config(5).
*** Web Interface
#2 Search results should link to directories
#10 Non-uniform track selection
+#11 Bias random selection to newly added tracks
#16 Cookie expiry causes user to be silently logged out and not
subsequently redirected to login page
#20 Broken aliasing rules
namepart ext "(\\.[a-zA-Z0-9]+)$" $1 *
.fi
.TP
+.B new_bias \fIWEIGHT\fR
+The weight for new tracks.
+The default is 900000, i.e. recently added tracks are a hundred times as likely
+to be picked as normal.
+.TP
+.B new_bias_age \fISECONDS\fR
+The maximum age of tracks that \fBnew_bias\fR applies to, in seconds.
+The default is one week.
+.TP
.B new_max \fIMAX\fR
The maximum number of tracks to list when reporting newly noticed tracks.
The default is 100.
{ C(multicast_loop), &type_boolean, validate_any },
{ C(multicast_ttl), &type_integer, validate_non_negative },
{ C(namepart), &type_namepart, validate_any },
+ { C(new_bias), &type_integer, validate_positive },
+ { C(new_bias_age), &type_integer, validate_positive },
{ C(new_max), &type_integer, validate_positive },
{ C2(nice, nice_rescan), &type_integer, validate_non_negative },
{ C(nice_rescan), &type_integer, validate_non_negative },
c->smtp_server = xstrdup("127.0.0.1");
c->new_max = 100;
c->reminder_interval = 600; /* 10m */
+ c->new_bias_age = 7 * 86400; /* 1 week */
+ c->new_bias = 9000000; /* 100 times the base weight */
/* Default stopwords */
if(config_set(&cs, (int)NDEFAULT_STOPWORDS, (char **)default_stopwords))
exit(1);
+
/*
* This file is part of DisOrder.
* Copyright (C) 2004-2008 Richard Kettlewell
/** @brief Whether to allow user management over TCP */
int remote_userman;
+
+ /** @brief Maximum age of biased-up tracks */
+ long new_bias_age;
+
+ /** @brief Maximum bias */
+ long new_bias;
/* derived values: */
int nparts; /* number of distinct name parts */
#include "queue.h"
#include "server-queue.h"
+#define BASE_WEIGHT 90000
+
static DB_TXN *global_tid;
static const struct option options[] = {
struct kvp *prefs) {
const char *s;
char **track_tags;
- time_t last, now;
+ time_t last, now = time(0);
/* Reject tracks not in any collection (race between edit config and
* rescan) */
/* Reject tracks played within the last 8 hours */
if((s = kvp_get(prefs, "played_time"))) {
last = atoll(s);
- now = time(0);
if(now < last + config->replay_min)
return 0;
}
if((errno == 0 || errno == ERANGE) && n >= 0)
return n;
}
+
+ /* Bias up tracks that were recently added */
+ if((s = kvp_get(data, "_noticed"))) {
+ const time_t noticed = atoll(s);
+
+ if(noticed + config->new_bias_age < now)
+ /* Currently we just step up the weight of tracks that are in range. A
+ * more sophisticated approach would be to linearly decay from new_bias
+ * down to BASE_WEIGHT over the course of the new_bias_age interval
+ * starting when the track is added. */
+ return config->new_bias;
+ }
- return 90000;
+ return BASE_WEIGHT;
}
static unsigned char random_buffer[4096];