about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--modules/home/conf/beets/default.nix50
-rw-r--r--modules/home/conf/mpd/default.nix8
2 files changed, 53 insertions, 5 deletions
diff --git a/modules/home/conf/beets/default.nix b/modules/home/conf/beets/default.nix
index 08b0b34e..ef969dc0 100644
--- a/modules/home/conf/beets/default.nix
+++ b/modules/home/conf/beets/default.nix
@@ -58,10 +58,38 @@
         auto = true;
         backend = "ffmpeg";
 
+        r128_targetlevel = 89;
+
         # Re-calculate the replay gain value even for files, that already have one set.
         overwrite = true;
       };
-      duplicates = {};
+      duplicates = {
+        keys = ["acoustid_fingerprint"];
+      };
+      fuzzy = {
+        # The prefix denoting that a search should be run in fuzzy mode
+        prefix = ".";
+      };
+      ihate = {
+        warn = [
+          "title:commentary"
+        ];
+      };
+      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/$albumartist.m3u";
+            query = "";
+          }
+        ];
+      };
       # scrub = {
       #   auto = true;
       # };
@@ -69,13 +97,31 @@
       plugins = [
         # Remove all previous tags before import (this is useful to ensure, that
         # the metadata in the libary.db is synced with the tags on disk)
-        # # FIXME: I think, that this also removes the baked-in images, which is not ideal
+        # # FIXME: I think, that this also removes the deezer id, which is not ideal
         # <2024-08-07>
         # "scrub"
 
         # Calculate replay gain
         "replaygain"
 
+        # 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"
+
+        # Warn, when importing a matching item
+        "ihate"
+
+        # Allow fuzzy searching
+        "fuzzy"
+
+        # Put featured artist in the title (this helps with grouping by artist)
+        "ftintitle"
+
         # Filter out duplicates
         "duplicates"
 
diff --git a/modules/home/conf/mpd/default.nix b/modules/home/conf/mpd/default.nix
index 3b8d2052..b30f6995 100644
--- a/modules/home/conf/mpd/default.nix
+++ b/modules/home/conf/mpd/default.nix
@@ -14,19 +14,21 @@ in {
   };
 
   systemd.user.services.mpd.Service.ExecStartPre = lib.mkForce ''
-    ${pkgs.coreutils}/bin/mkdir -p "${dataDir}" "${playlistDirectory}" "${runtimeDir}"
+    ${pkgs.coreutils}/bin/mkdir --parents "${dataDir}" "${playlistDirectory}" "${runtimeDir}"
   '';
 
   services.mpd = {
     enable = true;
-    inherit dataDir;
+    inherit dataDir playlistDirectory;
     musicDirectory = config.programs.beets.settings.directory;
     network = {
       listenAddress = "${runtimeDir}/socket";
     };
+
     extraConfig = ''
       metadata_to_use "artist,album,title,track,name,genre,date,composer,performer,disc,comment"
-      auto_update "yes"
+      # Updated by the beets `mpdupdate` plugin
+      auto_update "no"
 
       audio_output {
         type "pipewire"