diff options
author | Beat Bolli <bbolli@ewanet.ch> | 2013-10-21 20:35:00 +0200 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2013-10-22 13:37:57 -0400 |
commit | 04b5721b011e2a351fd6204be99d5cddacdef4bc (patch) | |
tree | 5119fe2a3a04e2e3eb2d5a3ed08c1e7d46418bcc /contrib/webgps.py | |
parent | be17a5d3f2770e17f182bbf4233f6da78bd50eae (diff) | |
download | gpsd-04b5721b011e2a351fd6204be99d5cddacdef4bc.tar.gz |
webgps.py: simplify command line handling
Diffstat (limited to 'contrib/webgps.py')
-rwxr-xr-x | contrib/webgps.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/contrib/webgps.py b/contrib/webgps.py index 5e437c57..76e3553f 100755 --- a/contrib/webgps.py +++ b/contrib/webgps.py @@ -299,17 +299,14 @@ def main(): factors = { 's': 1, 'm': 60, 'h': 60 * 60, 'd': 24 * 60 * 60 } - arg = argv and argv[0] or '' + arg = argv and argv[0] or '0' if arg[-1:] in factors.keys(): period = int(arg[:-1]) * factors[arg[-1]] elif arg == 'c': period = None - elif arg: - period = int(arg) else: - period = 0 - if arg: - arg = '-' + arg + period = int(arg) + prefix = '-' + arg sat = SatTracks() @@ -321,7 +318,7 @@ def main(): p.close() try: - sat.run(arg, period) + sat.run(prefix, period) except KeyboardInterrupt: # save the tracks p = open(pfile, 'w') |