diff options
Diffstat (limited to '')
| -rw-r--r-- | modules/home.legacy/conf/beets/default.nix | 44 | ||||
| -rw-r--r-- | modules/home.legacy/conf/beets/plugins.nix | 9 | ||||
| -rw-r--r-- | modules/home.legacy/conf/beets/plugins/default.nix | 2 | ||||
| -rw-r--r-- | modules/home.legacy/conf/beets/plugins/ihate/default.nix | 1 | ||||
| -rw-r--r-- | modules/home.legacy/conf/beets/plugins/inline/default.nix (renamed from modules/home.legacy/conf/iamb/default.nix) | 6 | ||||
| -rw-r--r-- | modules/home.legacy/conf/beets/plugins/mbsubmit/default.nix | 0 | ||||
| -rw-r--r-- | modules/home.legacy/conf/beets/plugins/smartplaylist/default.nix | 42 |
7 files changed, 39 insertions, 65 deletions
diff --git a/modules/home.legacy/conf/beets/default.nix b/modules/home.legacy/conf/beets/default.nix index 612a5f03..43d6bff9 100644 --- a/modules/home.legacy/conf/beets/default.nix +++ b/modules/home.legacy/conf/beets/default.nix @@ -14,7 +14,6 @@ ... }: let plugins = import ./plugins.nix {}; - # TODO: Enable xtractor again <2025-03-29> # package = pkgs.beets.override { # pluginOverrides = { @@ -23,7 +22,6 @@ # propagatedBuildInputs = [pkgs.beetsExtraPlugins.xtractor]; # }; # }; - package = pkgs.beets; in { imports = [ ./plugins @@ -31,7 +29,14 @@ in { programs.beets = { enable = true; - inherit package; + package = pkgs.python3.pkgs.toPythonApplication (pkgs.python3.pkgs.beets.override + { + ffmpeg = pkgs.ffmpeg-headless; + keyfinder-cli = pkgs.keyfinder-cli.override { + ffmpeg = + pkgs.ffmpeg-headless; + }; + }); settings = { library = "${config.xdg.dataHome}/beets/library.db"; @@ -42,7 +47,7 @@ in { }; replace = { - "[/]" = "\\"; + "[/]" = "\\\\"; "[\\x00-\\x1f]" = ""; "\\s+$" = ""; "^\\s+" = ""; @@ -67,9 +72,19 @@ in { paths = let join = lib.strings.concatStringsSep "/"; in { - "albumtype:live" = join ["[Live, please delete]" "$genre" "$first_artist" "$album ($albumtype)" "$track $title"]; + "albumtype:live" = join [ + "[Live, please delete]" + "$genre" + "$primary_artist" # (= $albumartists[0]). From inline plugin + "$album ($albumtype)" + "$track $title" + ]; - default = "$albumartist/$album%aunique{}/$track $title"; + default = join [ + "$primary_artist" # (= $albumartists[0]). From inline plugin + "$album%aunique{}" + "$track $title" + ]; }; inherit plugins; @@ -95,18 +110,17 @@ in { }; mpdIntegration = { - enableStats = true; enableUpdate = true; host = config.home.sessionVariables.MPD_HOST; }; }; - # Use the json formatter instead of the YAML one, as the YAML formatter mangles the - # longer python inline strings. - # YAML is a superset of JSON. - xdg.configFile."beets/config.yaml".source = - lib.mkForce - ((pkgs.formats.json {}).generate - "beets-config" - config.programs.beets.settings); + # # Use the json formatter instead of the YAML one, as the YAML formatter mangles the + # # longer python inline strings. + # # YAML is a superset of JSON. + # xdg.configFile."beets/config.yaml".source = + # lib.mkForce + # ((pkgs.formats.json {}).generate + # "beets-config" + # config.programs.beets.settings); } diff --git a/modules/home.legacy/conf/beets/plugins.nix b/modules/home.legacy/conf/beets/plugins.nix index a3abb580..aaeab843 100644 --- a/modules/home.legacy/conf/beets/plugins.nix +++ b/modules/home.legacy/conf/beets/plugins.nix @@ -20,6 +20,8 @@ # Extract things from the music file # "xtractor" + "musicbrainz" + # Calculate replay gain "replaygain" @@ -29,11 +31,7 @@ # Show tags on files/queries "info" - # Create playlist from `play_count`/`skip_count` (gathered by the `mpdstats` - # plugin) - # Note that this should come _before_ the `mpdupdate` plugin, to ensure that - # `mpdupgate` can propagate changed playlist to `mpd`. - "smartplaylist" + "inline" # Warn, when importing a matching item "ihate" @@ -56,6 +54,5 @@ # Allow beets to understand deezer id's # "deezer" - "mpdstats" # Transfer MPD stats to beets "mpdupdate" # Update MPD database on import ] diff --git a/modules/home.legacy/conf/beets/plugins/default.nix b/modules/home.legacy/conf/beets/plugins/default.nix index ddba95e0..2b2bd607 100644 --- a/modules/home.legacy/conf/beets/plugins/default.nix +++ b/modules/home.legacy/conf/beets/plugins/default.nix @@ -12,9 +12,9 @@ ./badfiles ./duplicates ./ihate + ./inline ./lyrics ./replaygain - ./smartplaylist # ./xtractor ]; } diff --git a/modules/home.legacy/conf/beets/plugins/ihate/default.nix b/modules/home.legacy/conf/beets/plugins/ihate/default.nix index 51cb6f11..2356ec3b 100644 --- a/modules/home.legacy/conf/beets/plugins/ihate/default.nix +++ b/modules/home.legacy/conf/beets/plugins/ihate/default.nix @@ -11,6 +11,7 @@ programs.beets.settings.ihate = { warn = [ "title:commentary" + "title:live" "albumtype:live" ]; }; diff --git a/modules/home.legacy/conf/iamb/default.nix b/modules/home.legacy/conf/beets/plugins/inline/default.nix index 764e2efc..8dccdc20 100644 --- a/modules/home.legacy/conf/iamb/default.nix +++ b/modules/home.legacy/conf/beets/plugins/inline/default.nix @@ -8,5 +8,9 @@ # You should have received a copy of the License along with this program. # If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { - xdg.configFile."iamb/config.json".source = ./config.json; + programs.beets.settings.item_fields = { + primary_artist = + # python + ''dict(enumerate(albumartists)).get(0, artist)''; + }; } diff --git a/modules/home.legacy/conf/beets/plugins/mbsubmit/default.nix b/modules/home.legacy/conf/beets/plugins/mbsubmit/default.nix deleted file mode 100644 index e69de29b..00000000 --- a/modules/home.legacy/conf/beets/plugins/mbsubmit/default.nix +++ /dev/null diff --git a/modules/home.legacy/conf/beets/plugins/smartplaylist/default.nix b/modules/home.legacy/conf/beets/plugins/smartplaylist/default.nix deleted file mode 100644 index 9b52c1ad..00000000 --- a/modules/home.legacy/conf/beets/plugins/smartplaylist/default.nix +++ /dev/null @@ -1,42 +0,0 @@ -# nixos-config - My current NixOS configuration -# -# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> -# SPDX-License-Identifier: GPL-3.0-or-later -# -# This file is part of my nixos-config. -# -# You should have received a copy of the License along with this program. -# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. -{config, ...}: { - programs.beets.settings.smartplaylist = { - relative_to = config.services.mpd.musicDirectory; - playlist_dir = config.services.mpd.playlistDirectory; - forward_slash = false; - - # Show the real m3u file paths, when running `--pretend` - pretend_paths = true; - - playlists = [ - { - name = "artists-$first_artist.m3u"; - query = ""; - } - { - name = "ratings-good.m3u"; - query = "rating:0.7..1.0"; - } - { - name = "ratings-mediocre.m3u"; - query = "rating:0.4..0.7"; - } - { - name = "ratings-bad.m3u"; - query = "rating:0.0..0.4"; - } - { - name = "not_played.m3u"; - query = "-play_count: artist:"; - } - ]; - }; -} |
