diff options
author | lassulus <lassulus@lassul.us> | 2022-06-06 16:04:37 +0200 |
---|---|---|
committer | lassulus <lassulus@lassul.us> | 2022-06-06 16:04:37 +0200 |
commit | c98ec4f83b6c8ec613d38b97a125850423b9cdd2 (patch) | |
tree | 0ed59bbe980633a00616bf098c2259ab172c4513 /lass/2configs/radio/news.nix | |
parent | e0aec32340de2b8b6bedc216ada77c01a980d2b5 (diff) |
l radio: parse priority, fix timezone
Diffstat (limited to 'lass/2configs/radio/news.nix')
-rw-r--r-- | lass/2configs/radio/news.nix | 10 |
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 */ '' |