From 9d5bedb40485c55eb125c29cd609d725aee2c40c Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 7 Jun 2021 08:45:35 +0200 Subject: l radio: fix starting with 21.05 --- lass/2configs/radio.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lass/2configs/radio.nix') diff --git a/lass/2configs/radio.nix b/lass/2configs/radio.nix index cfc280e50..528d12069 100644 --- a/lass/2configs/radio.nix +++ b/lass/2configs/radio.nix @@ -4,7 +4,6 @@ with import ; let name = "radio"; - mainUser = config.users.extraUsers.mainUser; music_dir = "/home/radio/music"; @@ -128,8 +127,9 @@ in { services.mpd = { enable = true; - group = "radio"; + user = "radio"; musicDirectory = "${music_dir}"; + dataDir = "/home/radio/state"; # TODO create this somwhere extraConfig = '' log_level "default" auto_update "yes" -- cgit v1.2.3 From bb79bf0ae8aeb47c6f6c74bf205ca43c74d42213 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 7 Jun 2021 08:46:01 +0200 Subject: l radio: set irc topic --- lass/2configs/radio.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lass/2configs/radio.nix') diff --git a/lass/2configs/radio.nix b/lass/2configs/radio.nix index 528d12069..040f5b943 100644 --- a/lass/2configs/radio.nix +++ b/lass/2configs/radio.nix @@ -83,6 +83,17 @@ let }' ''; + set_irc_topic = pkgs.writeDash "set_irc_topic" '' + ${pkgs.curl}/bin/curl -fsSv --unix-socket /home/radio/reaktor.sock http://z/ \ + -H content-type:application/json \ + -d "$(${pkgs.jq}/bin/jq -n \ + --arg text "$1" '{ + command:"TOPIC", + params:["#the_playlist",$text] + }' + )" + ''; + write_to_irc = pkgs.writeDash "write_to_irc" '' ${pkgs.curl}/bin/curl -fsSv --unix-socket /home/radio/reaktor.sock http://z/ \ -H content-type:application/json \ @@ -203,7 +214,7 @@ in { listeners=$(${pkgs.iproute}/bin/ss -Hno state established 'sport = :8000' | wc -l) echo "$(date -Is)" "$track" | tee -a "$HISTORY_FILE" echo "$(tail -$LIMIT "$HISTORY_FILE")" > "$HISTORY_FILE" - ${write_to_irc} "playing: $track listeners: $listeners" + ${set_irc_topic} "playing: $track listeners: $listeners" done ''; in { -- cgit v1.2.3 From 87c02755d0572fd21f31bc35ca5bcf967ea58b29 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 7 Jun 2021 08:46:17 +0200 Subject: l radio: add mp3 output --- lass/2configs/radio.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lass/2configs/radio.nix') diff --git a/lass/2configs/radio.nix b/lass/2configs/radio.nix index 040f5b943..05412caf2 100644 --- a/lass/2configs/radio.nix +++ b/lass/2configs/radio.nix @@ -144,6 +144,19 @@ in { extraConfig = '' log_level "default" auto_update "yes" + volume_normalization "yes" + + audio_output { + type "httpd" + name "lassulus radio mp3" + encoder "lame" # optional + port "8002" + quality "5.0" # do not define if bitrate is defined + # bitrate "128" # do not define if quality is defined + format "44100:16:2" + always_on "yes" # prevent MPD from disconnecting all listeners when playback is stopped. + tags "yes" # httpd supports sending tags to listening streams. + } audio_output { type "httpd" @@ -163,6 +176,7 @@ in { tables = { filter.INPUT.rules = [ { predicate = "-p tcp --dport 8000"; target = "ACCEPT"; } + { predicate = "-p tcp --dport 8002"; target = "ACCEPT"; } { predicate = "-i retiolum -p tcp --dport 8001"; target = "ACCEPT"; } ]; }; -- cgit v1.2.3 From 2bd87750465c09ef975ac278c80040222c46ee98 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 7 Jun 2021 08:46:27 +0200 Subject: l radio: stop sharing with xerxes --- lass/2configs/radio.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lass/2configs/radio.nix') diff --git a/lass/2configs/radio.nix b/lass/2configs/radio.nix index 05412caf2..5affdb8cd 100644 --- a/lass/2configs/radio.nix +++ b/lass/2configs/radio.nix @@ -374,7 +374,7 @@ in { }; services.syncthing.declarative.folders."the_playlist" = { path = "/home/radio/music/the_playlist"; - devices = [ "mors" "phone" "prism" "xerxes" ]; + devices = [ "mors" "phone" "prism" ]; }; krebs.permown."/home/radio/music/the_playlist" = { owner = "radio"; -- cgit v1.2.3 From 4a3fef3881b26daa77a7c36bbfafc7fadf5a2f21 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 7 Jun 2021 09:06:56 +0200 Subject: l radio: fix counting of listeners --- lass/2configs/radio.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lass/2configs/radio.nix') diff --git a/lass/2configs/radio.nix b/lass/2configs/radio.nix index 5affdb8cd..a474b0ebc 100644 --- a/lass/2configs/radio.nix +++ b/lass/2configs/radio.nix @@ -225,7 +225,7 @@ in { ${pkgs.mpc_cli}/bin/mpc idle player > /dev/null ${pkgs.mpc_cli}/bin/mpc current -f %file% done | while read track; do - listeners=$(${pkgs.iproute}/bin/ss -Hno state established 'sport = :8000' | wc -l) + listeners=$(${pkgs.iproute}/bin/ss -Hno state established 'sport = :8000' | grep '^mptcp' | wc -l) echo "$(date -Is)" "$track" | tee -a "$HISTORY_FILE" echo "$(tail -$LIMIT "$HISTORY_FILE")" > "$HISTORY_FILE" ${set_irc_topic} "playing: $track listeners: $listeners" -- cgit v1.2.3