diff options
Diffstat (limited to '')
| -rw-r--r-- | pkgs/by-name/mp/mpdpopm/.envrc | 7 | ||||
| -rw-r--r-- | pkgs/by-name/mp/mpdpopm/flake.nix | 56 | ||||
| -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 |
4 files changed, 12 insertions, 66 deletions
diff --git a/pkgs/by-name/mp/mpdpopm/.envrc b/pkgs/by-name/mp/mpdpopm/.envrc index 9f477e71..40e13e1c 100644 --- a/pkgs/by-name/mp/mpdpopm/.envrc +++ b/pkgs/by-name/mp/mpdpopm/.envrc @@ -10,13 +10,8 @@ # You should have received a copy of the License along with this program. # If not, see <https://www.gnu.org/licenses/agpl.txt>. -use flake || use nix -watch_file flake.nix +pre_cache_load rust PATH_add ./scripts PATH_add ./target/debug/ PATH_add ./target/release/ - -if on_git_branch; then - echo && git status --short --branch -fi diff --git a/pkgs/by-name/mp/mpdpopm/flake.nix b/pkgs/by-name/mp/mpdpopm/flake.nix deleted file mode 100644 index d2e37260..00000000 --- a/pkgs/by-name/mp/mpdpopm/flake.nix +++ /dev/null @@ -1,56 +0,0 @@ -# Mpdpopm - A mpd rating tracker -# -# Copyright (C) 2026 Benedikt Peetz, Michael Herstine <sp1ff@pobox.com> <benedikt.peetz@b-peetz.de, sp1ff@pobox.com> -# SPDX-License-Identifier: AGPL-3.0-or-later -# -# This file is part of Mpdpopm. -# -# You should have received a copy of the License along with this program. -# If not, see <https://www.gnu.org/licenses/agpl.txt>. -{ - description = "A mpd rating tracker"; - - inputs = { - }; - - outputs = {self, ...}: let - system = "x86_64-linux"; - sources = import ../../../../unflake.nix; - - pkgs = sources.nixpkgs.legacyPackages."${system}"; - inherit (sources) treefmt-nix; - - treefmtEval = import ./treefmt.nix {inherit treefmt-nix pkgs;}; - in { - checks."${system}" = { - formatting = treefmtEval.config.build.check self; - }; - - formatter."${system}" = treefmtEval.config.build.wrapper; - - devShells."${system}".default = pkgs.mkShell { - packages = [ - # rust stuff - pkgs.cargo - pkgs.clippy - pkgs.rustc - pkgs.rustfmt - pkgs.mold - - pkgs.cargo-edit - pkgs.cargo-expand - pkgs.cargo-flamegraph - - # Releng - pkgs.git-bug - pkgs.reuse - pkgs.cocogitto - - # Perf - pkgs.hyperfine - ]; - }; - }; -} -# vim: ts=2 - 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 |
