Switch to less complicated track randomizer

This commit is contained in:
Annika Backstrom 2019-12-17 13:38:55 -05:00
parent 087a06a20c
commit 14d915fb7c
1 changed files with 1 additions and 1 deletions

View File

@ -10,7 +10,7 @@ class SqliteBackend {
find(tag, callback) {
this.db.run("INSERT INTO tags (tag) VALUES (?)", tag);
this.db.get("SELECT uuid, tag, label FROM library WHERE tag = ? AND _ROWID_ >= (abs(random()) % (SELECT max(_ROWID_) FROM tags)) LIMIT 1", tag, (err, row) => {
this.db.get("SELECT uuid, tag, label FROM library WHERE tag = ? ORDER BY RANDOM() LIMIT 1", tag, (err, row) => {
if (typeof row === 'undefined') {
return callback();
}