diff options
author | tv <tv@krebsco.de> | 2016-06-30 16:31:05 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2016-06-30 16:31:05 +0200 |
commit | d81b068113325fb7604089c3647c365a41804978 (patch) | |
tree | 4c43ad2142825ac7c0a7045e5c48a039b25f6786 /lass/2configs/radio.nix | |
parent | 1542f9bbee823025f703e6abf3836905cee416fd (diff) | |
parent | f12578c66f8b7b829c0dec5255f358778c0d3366 (diff) |
Merge remote-tracking branch 'prism/master'
Diffstat (limited to 'lass/2configs/radio.nix')
-rw-r--r-- | lass/2configs/radio.nix | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/lass/2configs/radio.nix b/lass/2configs/radio.nix index 17be327b9..59678dbff 100644 --- a/lass/2configs/radio.nix +++ b/lass/2configs/radio.nix @@ -11,7 +11,7 @@ let source-password = import <secrets/icecast-source-pw>; add_random = pkgs.writeDashBin "add_random" '' - mpc add "$(mpc ls | shuf -n1)" + ${pkgs.mpc_cli}/bin/mpc add "$(${pkgs.mpc_cli}/bin/mpc ls | shuf -n1)" ''; skip_track = pkgs.writeDashBin "skip_track" '' @@ -52,13 +52,8 @@ in { print_current ncmpcpp mpc_cli - tmux ]; - security.sudo.extraConfig = '' - ${mainUser.name} ALL=(${name}) NOPASSWD: ALL - ''; - services.mpd = { enable = true; group = "radio"; @@ -67,7 +62,7 @@ in { audio_output { type "shout" encoding "ogg" - name "my cool stream" + name "the_playlist" host "localhost" port "8000" mount "/radio.ogg" @@ -84,7 +79,7 @@ in { # Optional Parameters user "source" # description "here is my long description" - # genre "jazz" + genre "good music" } # end of audio_output ''; @@ -114,7 +109,7 @@ in { wantedBy = [ "timers.target" ]; timerConfig = { - OnCalendar = "*:*"; + OnCalendar = "*:0/1"; }; }; @@ -123,8 +118,8 @@ in { LIMIT=$1 #in secconds timeLeft () { - playlistDuration=$(mpc --format '%time%' playlist | awk -F ':' 'BEGIN{t=0} {t+=$1*60+$2} END{print t}') - currentTime=$(mpc status | awk '/^\[playing\]/ { sub(/\/.+/,"",$3); split($3,a,/:/); print a[1]*60+a[2] }') + playlistDuration=$(${pkgs.mpc_cli}/bin/mpc --format '%time%' playlist | ${pkgs.gawk}/bin/awk -F ':' 'BEGIN{t=0} {t+=$1*60+$2} END{print t}') + currentTime=$(${pkgs.mpc_cli}/bin/mpc status | ${pkgs.gawk}/bin/awk '/^\[playing\]/ { sub(/\/.+/,"",$3); split($3,a,/:/); print a[1]*60+a[2] }') expr ''${playlistDuration:-0} - ''${currentTime:-0} } @@ -136,16 +131,10 @@ in { description = "radio playlist autoadder"; after = [ "network.target" ]; - path = with pkgs; [ - gawk - mpc_cli - ]; - restartIfChanged = true; serviceConfig = { - Restart = "always"; - ExecStart = "${autoAdd} 100"; + ExecStart = "${autoAdd} 150"; }; }; |