nix-da/home/terminal/beets.nix
2024-12-18 12:14:00 +01:00

77 lines
1.9 KiB
Nix

{ pkgs, lib, ... }:
let
inherit (lib) concatStringsSep attrNames;
plugins = {
convert.enable = true;
chroma.enable = true;
inline.enable = true;
fish.enable = true;
fetchart.enable = true;
lastgenre.enable = true;
scrub.enable = true;
duplicates.enable = true;
info.enable = true;
missing.enable = true;
unimported.enable = true;
};
in
{
config = {
programs.beets = {
package = pkgs.beets.override {
pluginOverrides = plugins;
};
settings = {
plugins = concatStringsSep " " (attrNames plugins);
per_disc_numbering = "yes";
asciify_paths = true;
convert = {
auto = "yes";
format = "flac";
never_convert_lossy_files = "yes";
};
fetchart = {
auto = true;
cover_format = "jpg";
maxwidth = 500;
minwidth = 500;
enforce_ratio = true;
};
duplicates = {
count = true;
};
lastgenre = {
auto = "yes";
count = 5;
separator = ";";
};
replace = {
"[\\\\/]" = "_";
"^\\." = "_";
"[\\x00-\\x1f]" = "_";
"\\.$" = "_";
"\\s+$" = "";
"^\\s+" = "";
"^-" = "_";
};
import = {
incremental = "yes";
bell = "yes";
languages = "en";
};
item_fields = {
disc_and_track = "u'%02i.%02i' % (disc, track) if disctotal > 1 else u'%02i' % (track)";
primary_albumartist = ''
if albumartist.lower().strip().startswith(albumartists[0].lower().strip()):
return albumartists[0]
else:
return None
'';
};
paths = {
default = "%ifdef{primary_albumartist, $primary_albumartist, $albumartist}/$album%aunique{}/$disc_and_track - $artist - $title";
};
};
};
};
}