Commit ab73a87a authored by James Westman's avatar James Westman

Add --loop option

parent eb2f4a2a
......@@ -25,6 +25,12 @@ To install, simply clone this repository with git. Then run the program with
`sudo ./`.
## Usage
### General Options
- `-q`, `--quiet`: Do not output coordinates as they are replayed
- `-l`, `--loop`: Go back to the beginning instead of stopping at the end of
the track
### Data Sources
You can manually input coordinates, source them from a CSV file, or replay a
GPX track file.
......@@ -80,6 +80,10 @@ class DBusManager:
location = next(self.provider)
GLib.timeout_add(int(location.delay * 1000), on_timeout)
except StopIteration:
if get_args().loop:
self.provider = iter(providers.get_provider())
location = next(self.provider)
if location is not None:
GLib.timeout_add(int(location.delay * 1000), on_timeout)
......@@ -26,6 +26,7 @@ def collect_args():
subparsers = parser.add_subparsers(help="data sources", required=True, metavar="{coords|csv|gpx}", dest="datasource")
parser.add_argument("-q", "--quiet", action="store_true", help="Do not output coordinates as they are replayed")
parser.add_argument("-l", "--loop", action="store_true", help="Go back to the beginning instead of stopping at the end of the track")
coords = subparsers.add_parser("coords", description="Set location to a specific point")
coords.add_argument("latitude", type=float)
import csv, datetime
import csv, datetime, io
from geoclueless import untangle
from geoclueless.location import Location
......@@ -9,9 +9,11 @@ def get_provider():
if args.datasource == "coords":
return StaticProvider(Location.from_args(args))
elif args.datasource == "csv":
return CsvProvider(args.file)
elif args.datasource == "gpx":
return GpxProvider(args.file)
return GpxProvider(io.StringIO(
def _strptime(string):
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment