From 1075a955f1ed67987c8e78d9b92ce0cf0e1908fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Ha=C5=82adyn=20=28krzys=5Fh=29?= Date: Mon, 7 Oct 2024 17:16:57 +0200 Subject: [PATCH] notification-spacex: fix when there are no upcoming launches (#451) --- polybar-scripts/notification-spacex/notification-spacex.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/polybar-scripts/notification-spacex/notification-spacex.sh b/polybar-scripts/notification-spacex/notification-spacex.sh index 854c4cdd..0515d2a7 100644 --- a/polybar-scripts/notification-spacex/notification-spacex.sh +++ b/polybar-scripts/notification-spacex/notification-spacex.sh @@ -4,10 +4,10 @@ spacex_launch=$(curl -sf "https://ll.thespacedevs.com/2.2.0/launch/upcoming/?lsp if [ -n "$spacex_launch" ]; then spacex_precision=$(printf "%s" "$spacex_launch" | jq -r '.results[0].net_precision.abbrev' ) - spacex_timestamp=$(date +"%s" --date "$(printf "%s" "$spacex_launch" | jq -r '.results[0].net' )") - spacex_duration=$((spacex_timestamp - $(date +%s))) if [ "$spacex_precision" = "HR" ] || [ "$spacex_precision" = "MIN" ] || [ "$spacex_precision" = "SEC" ]; then + spacex_timestamp=$(date +"%s" --date "$(printf "%s" "$spacex_launch" | jq -r '.results[0].net' )") + spacex_duration=$((spacex_timestamp - $(date +%s))) if [ "$spacex_duration" -lt 43200 ] && [ "$spacex_duration" -gt 0 ]; then echo "# $(date +"%H:%M" -u --date @$spacex_duration)" else