Skip to content

Commit 1075a95

Browse files
authored
notification-spacex: fix when there are no upcoming launches (#451)
1 parent 40fc3ab commit 1075a95

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

polybar-scripts/notification-spacex/notification-spacex.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ spacex_launch=$(curl -sf "https://ll.thespacedevs.com/2.2.0/launch/upcoming/?lsp
44

55
if [ -n "$spacex_launch" ]; then
66
spacex_precision=$(printf "%s" "$spacex_launch" | jq -r '.results[0].net_precision.abbrev' )
7-
spacex_timestamp=$(date +"%s" --date "$(printf "%s" "$spacex_launch" | jq -r '.results[0].net' )")
8-
spacex_duration=$((spacex_timestamp - $(date +%s)))
97

108
if [ "$spacex_precision" = "HR" ] || [ "$spacex_precision" = "MIN" ] || [ "$spacex_precision" = "SEC" ]; then
9+
spacex_timestamp=$(date +"%s" --date "$(printf "%s" "$spacex_launch" | jq -r '.results[0].net' )")
10+
spacex_duration=$((spacex_timestamp - $(date +%s)))
1111
if [ "$spacex_duration" -lt 43200 ] && [ "$spacex_duration" -gt 0 ]; then
1212
echo "# $(date +"%H:%M" -u --date @$spacex_duration)"
1313
else

0 commit comments

Comments
 (0)