]> git.itanic.dy.fi Git - rrdd/commitdiff
itanic: Add parse_power.sh
authorTimo Kokkonen <kaapeli@itanic.dy.fi>
Sun, 13 Mar 2011 09:34:33 +0000 (11:34 +0200)
committerTimo Kokkonen <kaapeli@itanic.dy.fi>
Sun, 13 Mar 2011 09:34:35 +0000 (11:34 +0200)
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
parse_power.sh [new file with mode: 0755]

diff --git a/parse_power.sh b/parse_power.sh
new file mode 100755 (executable)
index 0000000..94eab31
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+mkdir -p /tmp/power  &> /dev/null
+cd /tmp/power  &> /dev/null
+
+wget http://www.fingrid.fi/ap-pics/powersystemstate-fi.png &> /dev/null
+
+convert powersystemstate-fi.png -crop 55x370+520+0 out.png &> /dev/null
+
+OCR=`gocr -C "0123456789.-" -i out.png | grep -v ^$ | sed -e s._.-. -e "s. ..g"`
+
+OUT=`for i in $OCR ; do printf "%s:" $i ; done`
+
+echo -n $OUT | sed -e s.:$..
+
+rm powersystemstate-fi.png out.png