summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/index.php b/index.php
index c3caaca..c0bf12d 100644
--- a/index.php
+++ b/index.php
@@ -15,7 +15,13 @@ $timenow = time();
$json = file_get_contents("https://prodgojweatherstorage.blob.core.windows.net/data/jerseyForecast.json");
$arr_json = json_decode($json, true);
-$curtemp = $arr_json['currentTemprature'];
+// Try to OCR the current temperature from Jersey Met's usually-more-up-to-date image...
+if (!exec('tesseract "https://sojpublicdata.blob.core.windows.net/jerseymet/Town/internet.Temperature1.png" stdout | grep -Eo "[-0-9]+\.[0-9]+°C"', $ocroutput, $ocrretval)) {
+ $curtemp = $arr_json['currentTemprature'];
+} else {
+ // ...if not, use the JSON output
+ $curtemp = $ocroutput[0];
+}
// Today