summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMinijackson <minijackson@riseup.net>2022-06-19 23:25:38 +0200
committerMinijackson <minijackson@riseup.net>2022-06-19 23:25:38 +0200
commitb5d9017dbfff651c0da748ac80de36bf65e549e1 (patch)
tree4b6ec887c21d39b1959a58fa751fa9fe9b5acda6
parent7598c7fda86e2552755ae2926ccff19652ccde6d (diff)
downloadnixos-config-reborn-b5d9017dbfff651c0da748ac80de36bf65e549e1.tar.gz
nixos-config-reborn-b5d9017dbfff651c0da748ac80de36bf65e549e1.zip
usecases/music: add split-cue script, refmt
-rw-r--r--res/scripts/split-cue.sh21
-rw-r--r--usecases/desktop/music.nix252
2 files changed, 150 insertions, 123 deletions
diff --git a/res/scripts/split-cue.sh b/res/scripts/split-cue.sh
new file mode 100644
index 0000000..6be4a99
--- /dev/null
+++ b/res/scripts/split-cue.sh
@@ -0,0 +1,21 @@
1#!/usr/bin/env nix-shell
2#! nix-shell -i bash -p shntool cuetools flac
3# shellcheck shell=bash
4
5set -xeuo pipefail
6
7cuesheet="$1"
8
9audio="$2"
10format="${audio##*.}"
11albumdir=$(mktemp -d)
12
13shnsplit -f "$cuesheet" "$audio" -d "$albumdir" -o "$format"
14find "$albumdir" -type f -print0 | sort -zn | xargs -t0 cuetag.sh "$cuesheet"
15
16shopt -s nocaseglob
17for file in cover.*; do
18 cp "$file" "$albumdir"
19done
20
21echo "Split exported to: '${albumdir}'"
diff --git a/usecases/desktop/music.nix b/usecases/desktop/music.nix
index d6c3fde..c982795 100644
--- a/usecases/desktop/music.nix
+++ b/usecases/desktop/music.nix
@@ -1,14 +1,16 @@
1inputs: 1_inputs: {
2 2 config,
3{ config, lib, pkgs, ... }: 3 lib,
4 4 pkgs,
5{ 5 ...
6}: {
6 assertions = [ 7 assertions = [
7 { 8 {
8 assertion = 9 assertion =
9 config.home-manager.users.minijackson.programs.beets.settings ? acoustid && 10 config.home-manager.users.minijackson.programs.beets.settings
10 config.home-manager.users.minijackson.programs.beets.settings.acoustid ? apikey && 11 ? acoustid
11 config.home-manager.users.minijackson.programs.beets.settings.acoustid.apikey != null; 12 && config.home-manager.users.minijackson.programs.beets.settings.acoustid ? apikey
13 && config.home-manager.users.minijackson.programs.beets.settings.acoustid.apikey != null;
12 message = "Please provide the API key for the Acoustid database"; 14 message = "Please provide the API key for the Acoustid database";
13 } 15 }
14 ]; 16 ];
@@ -37,125 +39,129 @@ inputs:
37 #startWhenNeeded = true; 39 #startWhenNeeded = true;
38 }; 40 };
39 41
40 home-manager.users.minijackson = { config, ... }: 42 users.extraUsers.minijackson.packages = [
41 { 43 (pkgs.writeScriptBin
42 programs.beets = { 44 "split-cue"
43 enable = true; 45 (builtins.readFile ../../res/scripts/split-cue.sh))
44 46 ];
45 settings = {
46 plugins = [
47 "absubmit"
48 "acousticbrainz"
49 "badfiles"
50 "chroma"
51 "convert"
52 "edit"
53 "export"
54 "fetchart"
55 "fromfilename"
56 "lastgenre"
57 "mbsubmit"
58 "mbsync"
59 "missing"
60 "mpdupdate"
61 "parentwork"
62 "random"
63 "the"
64 "zero"
65 ];
66 lastgenre = {
67 canonical = true;
68 # High count due to canonicalization which removes fetched genres
69 count = 6;
70 };
71 paths = {
72 default = "%the{$albumartist}/%the{$album}%aunique{}/$track $title";
73 singleton = "Non-Album/%the{$artist}/%the{$title}";
74 comp = "Compilations/%the{$album}%aunique{}/$track $title";
75 };
76 zero.fields = "comments";
77 };
78 };
79 47
80 programs.ncmpcpp = { 48 home-manager.users.minijackson = {config, ...}: {
81 enable = true; 49 programs.beets = {
82 package = pkgs.ncmpcpp.override { 50 enable = true;
83 outputsSupport = true; 51
84 visualizerSupport = true; 52 settings = {
53 plugins = [
54 "absubmit"
55 "acousticbrainz"
56 "badfiles"
57 "chroma"
58 "convert"
59 "edit"
60 "export"
61 "fetchart"
62 "fromfilename"
63 "lastgenre"
64 "mbsubmit"
65 "mbsync"
66 "missing"
67 "mpdupdate"
68 "parentwork"
69 "random"
70 "the"
71 "zero"
72 ];
73 lastgenre = {
74 canonical = true;
75 # High count due to canonicalization which removes fetched genres
76 count = 6;
85 }; 77 };
86 mpdMusicDir = "/home/minijackson/Music"; 78 paths = {
87 settings = { 79 default = "%the{$albumartist}/%the{$album}%aunique{}/$track $title";
88 visualizer_data_source = "/tmp/mpd.fifo"; 80 singleton = "Non-Album/%the{$artist}/%the{$title}";
89 visualizer_output_name = "FIFO"; 81 comp = "Compilations/%the{$album}%aunique{}/$track $title";
90 visualizer_in_stereo = true;
91 visualizer_type = "ellipse";
92 visualizer_look = "▒▒";
93 visualizer_color = "cyan, blue, magenta, red, yellow, green";
94
95 user_interface = "alternative";
96
97 media_library_primary_tag = "album_artist";
98
99 display_bitrate = true;
100
101 #----------------------------------------------------
102 # file: ~/.ncmpcpp/config
103 # author: jason ryan - http://jasonwryan.com/
104 #----------------------------------------------------
105
106 mpd_connection_timeout = "5";
107 playlist_disable_highlight_delay = "3";
108 message_delay_time = "4";
109 header_visibility = true;
110 statusbar_visibility = true;
111 song_list_format = "{%a - }{%t}|{$5%f$9}$R{$7(%l)$9}";
112 song_status_format = "$2%a $1• $3%t $1• $4%b {(Disc %d) }$1• $5%y$1";
113 song_window_title_format = "Ncmpcpp: {%a - }{%t}|{%f}";
114 song_columns_list_format = "(7f)[white]{n} (33)[cyan]{t} (20)[green]{a} (20)[magenta]{b} (10)[magenta]{y} (7f)[white]{l}";
115 playlist_display_mode = "columns";
116 browser_display_mode = "columns";
117 titles_visibility = true;
118 progressbar_look = "─╼·";
119 # media_library_left_column = "a" (possible values: a,y,g,c,p, legend above)
120 header_text_scrolling = true;
121 # fancy_scrolling = true;
122 display_remaining_time = true;
123 ignore_leading_the = true;
124 empty_tag_marker = "";
125 enable_window_title = true;
126 colors_enabled = true;
127 header_window_color = "magenta";
128 volume_color = "green";
129 state_line_color = "yellow";
130 state_flags_color = "blue";
131 main_window_color = "cyan";
132 color1 = "cyan";
133 color2 = "blue";
134
135 current_item_prefix = "$(cyan)$r";
136 current_item_suffix = "$/r$(end)";
137
138 progressbar_color = "yellow";
139 statusbar_color = "cyan";
140
141 # active_column_color = "cyan";
142 }; 82 };
83 zero.fields = "comments";
143 }; 84 };
85 };
144 86
145 wayland.windowManager.sway.config.keybindings = 87 programs.ncmpcpp = {
146 let 88 enable = true;
147 modifier = config.wayland.windowManager.sway.config.modifier; 89 package = pkgs.ncmpcpp.override {
148 mpc = "${pkgs.mpc_cli}/bin/mpc"; 90 outputsSupport = true;
149 in 91 visualizerSupport = true;
150 lib.mkOptionDefault { 92 };
151 "XF86AudioPlay" = "exec ${mpc} toggle"; 93 mpdMusicDir = "/home/minijackson/Music";
152 "XF86AudioPrev" = "exec ${mpc} prev"; 94 settings = {
153 "XF86AudioNext" = "exec ${mpc} next"; 95 visualizer_data_source = "/tmp/mpd.fifo";
154 96 visualizer_output_name = "FIFO";
155 "${modifier}+KP_5" = "exec ${mpc} toggle"; 97 visualizer_in_stereo = true;
156 "${modifier}+KP_4" = "exec ${mpc} prev"; 98 visualizer_type = "ellipse";
157 "${modifier}+KP_6" = "exec ${mpc} next"; 99 visualizer_look = "▒▒";
158 "${modifier}+KP_8" = "exec ${mpc} stop"; 100 visualizer_color = "cyan, blue, magenta, red, yellow, green";
159 }; 101
102 user_interface = "alternative";
103
104 media_library_primary_tag = "album_artist";
105
106 display_bitrate = true;
107
108 #----------------------------------------------------
109 # file: ~/.ncmpcpp/config
110 # author: jason ryan - http://jasonwryan.com/
111 #----------------------------------------------------
112
113 mpd_connection_timeout = "5";
114 playlist_disable_highlight_delay = "3";
115 message_delay_time = "4";
116 header_visibility = true;
117 statusbar_visibility = true;
118 song_list_format = "{%a - }{%t}|{$5%f$9}$R{$7(%l)$9}";
119 song_status_format = "$2%a $1• $3%t $1• $4%b {(Disc %d) }$1• $5%y$1";
120 song_window_title_format = "Ncmpcpp: {%a - }{%t}|{%f}";
121 song_columns_list_format = "(7f)[white]{n} (33)[cyan]{t} (20)[green]{a} (20)[magenta]{b} (10)[magenta]{y} (7f)[white]{l}";
122 playlist_display_mode = "columns";
123 browser_display_mode = "columns";
124 titles_visibility = true;
125 progressbar_look = "─╼·";
126 # media_library_left_column = "a" (possible values: a,y,g,c,p, legend above)
127 header_text_scrolling = true;
128 # fancy_scrolling = true;
129 display_remaining_time = true;
130 ignore_leading_the = true;
131 empty_tag_marker = "";
132 enable_window_title = true;
133 colors_enabled = true;
134 header_window_color = "magenta";
135 volume_color = "green";
136 state_line_color = "yellow";
137 state_flags_color = "blue";
138 main_window_color = "cyan";
139 color1 = "cyan";
140 color2 = "blue";
141
142 current_item_prefix = "$(cyan)$r";
143 current_item_suffix = "$/r$(end)";
144
145 progressbar_color = "yellow";
146 statusbar_color = "cyan";
147
148 # active_column_color = "cyan";
149 };
160 }; 150 };
151
152 wayland.windowManager.sway.config.keybindings = let
153 inherit (config.wayland.windowManager.sway.config) modifier;
154 mpc = "${pkgs.mpc_cli}/bin/mpc";
155 in
156 lib.mkOptionDefault {
157 "XF86AudioPlay" = "exec ${mpc} toggle";
158 "XF86AudioPrev" = "exec ${mpc} prev";
159 "XF86AudioNext" = "exec ${mpc} next";
160
161 "${modifier}+KP_5" = "exec ${mpc} toggle";
162 "${modifier}+KP_4" = "exec ${mpc} prev";
163 "${modifier}+KP_6" = "exec ${mpc} next";
164 "${modifier}+KP_8" = "exec ${mpc} stop";
165 };
166 };
161} 167}