From c98ec4f83b6c8ec613d38b97a125850423b9cdd2 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 6 Jun 2022 16:04:37 +0200 Subject: l radio: parse priority, fix timezone --- lass/2configs/radio/news.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 */ '' -- cgit v1.2.3