move takeout location from private package

This commit is contained in:
Dima Gerasimov 2019-12-22 16:06:48 +00:00
parent 1271fe5054
commit 89efa11a28
6 changed files with 2 additions and 3 deletions

29
my/location/__main__.py Normal file
View file

@ -0,0 +1,29 @@
import sys
import logging
from location import get_logger, get_locations, iter_locations, get_groups
from kython.klogging import setup_logzero
def main():
logger = get_logger()
setup_logzero(logger, level=logging.DEBUG)
if len(sys.argv) > 1:
cmd = sys.argv[1]
# TODO ok, update cache makes sense just to refresh in case of code changes...
if cmd == "update_cache":
from location import update_cache, get_locations
update_cache()
else:
raise RuntimeError(f"Unknown command {cmd}")
else:
for p in get_groups():
print(p)
# shit. ok, 4 gigs of ram is def too much for glumov...
# TODO need datetime!
if __name__ == '__main__':
main()