diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-07-21 15:56:34 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2023-07-21 15:56:34 +0200 |
| commit | d1558cf352f24c311b8505661143973d11d9edba (patch) | |
| tree | ea5d01b8644f51603ef04e7e6187baca908cb7ad /wrms.go | |
| parent | 9cb08df11d7446357c5d480d08d256b906d4988e (diff) | |
| download | WRMS-d1558cf352f24c311b8505661143973d11d9edba.tar.gz WRMS-d1558cf352f24c311b8505661143973d11d9edba.zip | |
backend: support an incremental time bonus
Diffstat (limited to 'wrms.go')
| -rw-r--r-- | wrms.go | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -18,7 +18,7 @@ type Song struct { Artist string `json:"artist"` Source string `json:"source"` Uri string `json:"uri"` - Weight int `json:"weight"` + Weight float64 `json:"weight"` Album string `json:"album"` Year int `json:"year"` index int `json:"-"` // used by heap.Interface @@ -296,6 +296,11 @@ func (wrms *Wrms) AddSong(song Song) { s := &wrms.Songs[len(wrms.Songs)-1] wrms.queue.Add(s) + if wrms.Config.timeBonus != 0 { + llog.Info("Apply time bonus %v", wrms.Config.timeBonus) + wrms.queue.applyTimeBonus(wrms.Config.timeBonus) + } + wrms.rwlock.Unlock() llog.Info("Added song %s (ptr=%p) to Songs", s.Uri, s) |
