From bb5dfcd19312932113b678d78d2d1d34c70db3c1 Mon Sep 17 00:00:00 2001
From: Mattias Andrée <maandree@operamail.com>
Date: Thu, 27 Mar 2014 23:26:06 +0100
Subject: doc + make it possible to select download command for weather
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Mattias Andrée <maandree@operamail.com>
---
 examples/comprehensive | 9 ++++++++-
 examples/weather       | 7 ++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

(limited to 'examples')

diff --git a/examples/comprehensive b/examples/comprehensive
index b164212..96e3d96 100644
--- a/examples/comprehensive
+++ b/examples/comprehensive
@@ -82,6 +82,13 @@ def by_time():
     return 1 # Error in `time_alpha` (probably)
 
 
+
+# Command used to download a file at an HTTP URL
+download_command = None
+# This is what if used if `None` is selected:
+# download_command = lambda url : ['wget', url, '-O', '-']
+
+
 # Method for applying colour curves.
 apply_curves = randr
 #apply_curves = vidmode
@@ -318,7 +325,7 @@ def periodically(year, month, day, hour, minute, second, weekday, fade):
         (metar, last_time) = (None, None) if last_metar is None else last_metar
         now_time = minute
         if (metar is None) or (now_time < last_time) or (last_time < now_time + 5):
-            metar = weather(airport)
+            metar = weather(airport, download_command)
             last_metar = (metar, now_time)
         
         # Account for weather.
diff --git a/examples/weather b/examples/weather
index 78b826e..3fac3e4 100644
--- a/examples/weather
+++ b/examples/weather
@@ -26,6 +26,11 @@ latitude, longitude = 59.3326, 18.0652
 # (Stockholm Bromma Airport in this example.)
 airport = 'ESSB'
 
+# Command used to download a file at an HTTP URL
+download_command = None
+# This is what if used if `None` is selected:
+# download_command = lambda url : ['wget', url, '-O', '-']
+
 # The colour temperature at day and at night.
 temperature_day, temperature_night = 6500, 3700
 
@@ -47,7 +52,7 @@ visibility_max = 4
 dayness = sun(latitude, longitude)
 
 # Get weather report.
-metar = weather(airport)
+metar = weather(airport, download_command)
 
 # Account for weather.
 if metar is not None:
-- 
cgit v1.2.3-70-g09d2