summaryrefslogtreecommitdiffstats
path: root/lass/2configs
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2022-06-06 16:04:37 +0200
committerlassulus <lassulus@lassul.us>2022-06-06 16:04:37 +0200
commitc98ec4f83b6c8ec613d38b97a125850423b9cdd2 (patch)
tree0ed59bbe980633a00616bf098c2259ab172c4513 /lass/2configs
parente0aec32340de2b8b6bedc216ada77c01a980d2b5 (diff)
l radio: parse priority, fix timezone
Diffstat (limited to 'lass/2configs')
-rw-r--r--lass/2configs/radio/news.nix10
1 files changed, 9 insertions, 1 deletions
diff --git a/lass/2configs/radio/news.nix b/lass/2configs/radio/news.nix
index c03bd58c7..e5b5405ff 100644
--- a/lass/2configs/radio/news.nix
+++ b/lass/2configs/radio/news.nix
@@ -8,13 +8,21 @@ let
gc_news = pkgs.writers.writeDashBin "gc_news" ''
set -xefu
+ export TZ=UTC #workaround for jq parsing wrong timestamp
${pkgs.coreutils}/bin/cat $HOME/news | ${pkgs.jq}/bin/jq -cs 'map(select((.to|fromdateiso8601) > now)) | .[]' > $HOME/bla-news.tmp
${pkgs.coreutils}/bin/mv $HOME/bla-news.tmp $HOME/news
'';
get_current_news = pkgs.writers.writeDashBin "get_current_news" ''
set -xefu
- ${pkgs.coreutils}/bin/cat $HOME/news | ${pkgs.jq}/bin/jq -rs 'map(select(((.to | fromdateiso8601) > now) and (.from|fromdateiso8601) < now) | .text) | .[]'
+ export TZ=UTC #workaround for jq parsing wrong timestamp
+ ${pkgs.coreutils}/bin/cat $HOME/news | ${pkgs.jq}/bin/jq -rs '
+ sort_by(.priority) |
+ map(select(
+ ((.to | fromdateiso8601) > now) and
+ (.from|fromdateiso8601) < now) |
+ .text
+ ) | .[]'
'';
newsshow = pkgs.writers.writeDashBin "newsshow" /* sh */ ''