summaryrefslogtreecommitdiffstats
path: root/lass/2configs/services/radio
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2023-06-03 15:50:01 +0200
committermakefu <github@syntax-fehler.de>2023-06-03 15:50:01 +0200
commit15f4d5f29d3a4b662376f362d21e5b163bd7c5e1 (patch)
tree77b0239c8899207b76fdef85090db7aa2b6e3eea /lass/2configs/services/radio
parent563b55fa133a38aacff93747773f026b0681eece (diff)
parent7c3b3400b71678617ac042b522c26e747b8312c2 (diff)
Merge remote-tracking branch 'lassul.us/master'
Diffstat (limited to 'lass/2configs/services/radio')
-rw-r--r--lass/2configs/services/radio/default.nix2
-rw-r--r--lass/2configs/services/radio/news.nix29
2 files changed, 28 insertions, 3 deletions
diff --git a/lass/2configs/services/radio/default.nix b/lass/2configs/services/radio/default.nix
index a511196fd..16ef31b6f 100644
--- a/lass/2configs/services/radio/default.nix
+++ b/lass/2configs/services/radio/default.nix
@@ -82,7 +82,7 @@ in {
users.users = {
"${name}" = rec {
inherit name;
- createHome = lib.mkForce false;
+ createHome = true;
group = name;
uid = pkgs.stockholm.lib.genid_uint31 name;
description = "radio manager";
diff --git a/lass/2configs/services/radio/news.nix b/lass/2configs/services/radio/news.nix
index 0dc711e6c..62f7f548c 100644
--- a/lass/2configs/services/radio/news.nix
+++ b/lass/2configs/services/radio/news.nix
@@ -1,6 +1,31 @@
{ config, lib, pkgs, ... }:
let
+ tts = pkgs.writers.writeBashBin "tts" ''
+ set -efu
+
+ offset=0
+ OUTPUT=$(mktemp -d)
+ trap 'rm -rf "$OUTPUT"' EXIT
+ SPEAKER=$[ $RANDOM % 900 ]
+ while read line; do
+ echo "$line" |
+ ${pkgs.larynx}/bin/larynx \
+ --model ${pkgs.fetchzip {
+ url = "https://github.com/rhasspy/piper/releases/download/v0.0.2/voice-en-us-libritts-high.tar.gz";
+ hash = "sha256-jCoK4p0O7BuF0nr6Sfj40tpivCvU5M3GHKQRg1tfIO8=";
+ stripRoot = false;
+ }}/en-us-libritts-high.onnx \
+ -s "$SPEAKER" \
+ -f "$OUTPUT"/"$offset".wav
+
+ ((offset+=1))
+ done
+
+ ${pkgs.sox}/bin/sox "$OUTPUT"/*.wav "$OUTPUT"/all.wav
+ cat "$OUTPUT"/all.wav
+ '';
+
send_to_radio = pkgs.writers.writeDashBin "send_to_radio" ''
${pkgs.vorbis-tools}/bin/oggenc - |
${pkgs.cyberlocker-tools}/bin/cput news.ogg
@@ -41,16 +66,16 @@ in
systemd.services.newsshow = {
path = [
newsshow
+ tts
send_to_radio
gc_news
get_current_news
- pkgs.curl
pkgs.retry
];
script = ''
set -efu
retry -t 5 -d 10 -- newsshow |
- retry -t 5 -d 10 -- curl -fSsG http://tts.r/api/tts --data-urlencode 'text@-' |
+ retry -t 5 -d 10 -- tts |
retry -t 5 -d 10 -- send_to_radio
'';
startAt = "*:00:00";