location fallback (#263)
see https://github.com/karlicoss/HPI/issues/262 * move home to fallback/via_home.py * move via_ip to fallback * add fallback model * add stub via_ip file * add fallback_locations for via_ip * use protocol for locations * estimate_from helper, via_home estimator, all.py * via_home: add accuracy, cache history * add datasources to gpslogger/google_takeout * tz/via_location.py: update import to fallback * denylist docs/installation instructions * tz.via_location: let user customize cachew refresh time * add via_ip.estimate_location using binary search * use estimate_location in via_home.get_location * tests: add gpslogger to location config stub * tests: install tz related libs in test env * tz: add regression test for broken windows dates * vendorize bisect_left from python src doesnt have a 'key' parameter till python3.10
This commit is contained in:
parent
6dc5e7575f
commit
98b086f746
25 changed files with 1166 additions and 190 deletions
|
@ -32,9 +32,16 @@ from .common import Location
|
|||
|
||||
logger = LazyLogger(__name__, level="warning")
|
||||
|
||||
def _input_sort_key(path: Path) -> str:
|
||||
if "_" in path.name:
|
||||
return path.name.split("_", maxsplit=1)[1]
|
||||
return path.name
|
||||
|
||||
|
||||
def inputs() -> Sequence[Path]:
|
||||
return get_files(config.export_path, glob="*.gpx")
|
||||
# gpslogger files can optionally be prefixed by a device id,
|
||||
# like b5760c66102a5269_20211214142156.gpx
|
||||
return sorted(get_files(config.export_path, glob="*.gpx", sort=False), key=_input_sort_key)
|
||||
|
||||
|
||||
def _cachew_depends_on() -> List[float]:
|
||||
|
@ -65,6 +72,7 @@ def _extract_locations(path: Path) -> Iterator[Location]:
|
|||
accuracy=config.accuracy,
|
||||
elevation=point.elevation,
|
||||
dt=datetime.replace(point.time, tzinfo=timezone.utc),
|
||||
datasource="gpslogger",
|
||||
)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue