aboutsummaryrefslogtreecommitdiff
path: root/i3blocks/i3corona.sh
blob: 3d76b36a73ddde25dbc101642d52c4cc915f62a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh

# i3corona.sh
#
# Shows daily stats about coronavirus in Spain

#case $BLOCK_BUTTON in
#	1) # Left click
#	2) # Middle click
#	3) # Right click
#esac

tmpDir="/tmp/corona"
tmpFile="${tmpDir}/coronaData.txt"

[ -d "$tmpDir" ] || mkdir -p "$tmpDir"
[ -f "$tmpFile" ] ||
	curl https://corona-stats.online/spain > "$tmpFile" 2>/dev/null

grep 'Spain' "$tmpFile" | sed 's/\s*//g; s/\x1b\[[0-9;]*m//g; s/[,▲║]//g' |
	awk -F'│' '{print "😷 " $3 " (+" $4 ") 💪 " $7}'