diff options
Diffstat (limited to '')
| -rw-r--r-- | pkgs/by-name/mp/mpdpopm/src/dj/algorithms.rs | 12 | ||||
| -rw-r--r-- | pkgs/by-name/mp/mpdpopm/src/playcounts.rs | 3 |
2 files changed, 11 insertions, 4 deletions
diff --git a/pkgs/by-name/mp/mpdpopm/src/dj/algorithms.rs b/pkgs/by-name/mp/mpdpopm/src/dj/algorithms.rs index 3587df93..0004fd17 100644 --- a/pkgs/by-name/mp/mpdpopm/src/dj/algorithms.rs +++ b/pkgs/by-name/mp/mpdpopm/src/dj/algorithms.rs @@ -4,7 +4,7 @@ use std::{ }; use anyhow::{Context, Result}; -use rand::{RngExt, distr}; +use rand::{RngExt, distr, seq::SliceRandom}; use tracing::info; use crate::{clients::Client, storage}; @@ -115,9 +115,13 @@ impl Algorithm for Discovery { // We split the tracks into three thirds, so that we can also force a pick from e.g. // the lower third (the negative ones). - let negative = sorted_tracks.drain(..len).collect::<Vec<_>>(); - let neutral = sorted_tracks.drain(..len).collect::<Vec<_>>(); - let positive = sorted_tracks; + let mut negative = sorted_tracks.drain(..len).collect::<Vec<_>>(); + let mut neutral = sorted_tracks.drain(..len).collect::<Vec<_>>(); + let mut positive = sorted_tracks; + + negative.shuffle(&mut rng); + neutral.shuffle(&mut rng); + positive.shuffle(&mut rng); assert_eq!(negative.len(), neutral.len()); diff --git a/pkgs/by-name/mp/mpdpopm/src/playcounts.rs b/pkgs/by-name/mp/mpdpopm/src/playcounts.rs index 8fbee133..eac71948 100644 --- a/pkgs/by-name/mp/mpdpopm/src/playcounts.rs +++ b/pkgs/by-name/mp/mpdpopm/src/playcounts.rs @@ -172,6 +172,9 @@ impl PlayState { play_count::set(client, file, curr_pc + 1).await?; } else if self.last_song_was_skipped { + // TODO(@bpeetz): This should also record _when_ the skip was (e.g. a + // skip at 80% is not as important as one at 2%) <2026-09-05> + self.last_song_was_skipped = false; let last = self .last_server_stat |
