diff options
Diffstat (limited to 'lass/2configs/radio')
-rw-r--r-- | lass/2configs/radio/default.nix | 16 | ||||
-rw-r--r-- | lass/2configs/radio/news.nix | 16 |
2 files changed, 17 insertions, 15 deletions
diff --git a/lass/2configs/radio/default.nix b/lass/2configs/radio/default.nix index a1e220cdb..0611be7ce 100644 --- a/lass/2configs/radio/default.nix +++ b/lass/2configs/radio/default.nix @@ -372,15 +372,13 @@ in { locations."= /good".extraConfig = '' proxy_pass http://localhost:8001; ''; - locations."= /radio.sh".extraConfig = '' - alias ${pkgs.writeScript "radio.sh" '' - #!/bin/sh - while sleep 1; do - mpv \ - --cache-secs=0 --demuxer-readahead-secs=0 --untimed --cache-pause=no \ - 'http://lassul.us:8000/radio.opus' - done - ''}; + locations."= /radio.sh".alias = pkgs.writeScript "radio.sh" '' + #!/bin/sh + while sleep 1; do + mpv \ + --cache-secs=0 --demuxer-readahead-secs=0 --untimed --cache-pause=no \ + 'http://lassul.us:8000/radio.opus' + done ''; locations."= /controls".extraConfig = '' default_type "text/html"; diff --git a/lass/2configs/radio/news.nix b/lass/2configs/radio/news.nix index 6d73f4bb7..a3b39a9ea 100644 --- a/lass/2configs/radio/news.nix +++ b/lass/2configs/radio/news.nix @@ -7,18 +7,22 @@ let weather_report = pkgs.writers.writeDashBin "weather_report" '' set -efu export PATH="${lib.makeBinPath [ - pkgs.iproute2 pkgs.coreutils pkgs.curl - pkgs.gnugrep - pkgs.gnused + pkgs.iproute2 + pkgs.jc + pkgs.jq ]}" curl -z /tmp/GeoLite2-City.mmdb -o /tmp/GeoLite2-City.mmdb http://c.r/GeoLite2-City.mmdb MAXMIND_GEOIP_DB="/tmp/GeoLite2-City.mmdb"; export MAXMIND_GEOIP_DB OPENWEATHER_API_KEY=$(cat "$CREDENTIALS_DIRECTORY/openweather_api"); export OPENWEATHER_API_KEY - ss -Hno state established 'sport = :8000' | - grep '^tcp' | sed 's/.*\[.*\].*\[\(::ffff:\)\{0,1\}\(.*\)\].*/\2/' | - sed '/127.0.0.1/d;/::1/d' | + ss -no 'sport = :8000' | + jc --ss | jq -r '.[] | + select( + .local_address != "[::ffff:127.0.0.1]" + and .local_address != "[::1]" + ) | .peer_address | gsub("[\\[\\]]"; "") + ' | ${weather_for_ips}/bin/weather_for_ips ''; |