summaryrefslogtreecommitdiff
path: root/contrib/webgps.py
diff options
context:
space:
mode:
authorBeat Bolli <bbolli@ewanet.ch>2013-10-21 20:34:58 +0200
committerEric S. Raymond <esr@thyrsus.com>2013-10-22 13:37:28 -0400
commitdf3c5a442c13591fdf557bb2df3df9f6d243d99a (patch)
tree5c14e63d9f825a5938e980a40f7d5d844bad57eb /contrib/webgps.py
parent72deaf74569dece8f15af9075f12ea5b86d6ecd3 (diff)
downloadgpsd-df3c5a442c13591fdf557bb2df3df9f6d243d99a.tar.gz
webgps.py: fix errors when period is None
Diffstat (limited to 'contrib/webgps.py')
-rwxr-xr-xcontrib/webgps.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/contrib/webgps.py b/contrib/webgps.py
index 6907ebc6..91fc668d 100755
--- a/contrib/webgps.py
+++ b/contrib/webgps.py
@@ -277,7 +277,8 @@ function draw_satview() {
def run(self, suffix, period):
jsfile = 'gpsd' + suffix + '.js'
htmlfile = 'gpsd' + suffix + '.html'
- end = time.time() + period
+ if period is not None:
+ end = time.time() + period
self.needsupdate = 1
self.stream(WATCH_ENABLE | WATCH_NEWSTYLE)
for report in self:
@@ -288,8 +289,10 @@ function draw_satview() {
self.generate_js(jsfile)
self.needsupdate = 0
self.generate_html(htmlfile, jsfile)
- if period <= 0 and self.fix.mode >= MODE_2D \
- or period > 0 and time.time() > end:
+ if period is not None and (
+ period <= 0 and self.fix.mode >= MODE_2D or
+ period > 0 and time.time() > end
+ ):
break
def main():
@@ -302,13 +305,13 @@ def main():
if arg[-1:] in factors.keys():
period = int(arg[:-1]) * factors[arg[-1]]
elif arg == 'c':
- period = None
+ period = None
elif arg:
period = int(arg)
else:
period = 0
if arg:
- arg = '-' + arg
+ arg = '-' + arg
sat = SatTracks()