move photos provider inside

This commit is contained in:
Dima Gerasimov 2020-03-12 21:24:39 +00:00
parent a576230e30
commit e23276266b
5 changed files with 5 additions and 15 deletions

View file

@ -1,3 +1,6 @@
# pip install geopy magic
from datetime import datetime
import itertools
import os
@ -270,6 +273,7 @@ def iter_photos() -> Iterator[Photo]:
geos.pop()
def get_photos(cached: bool=False) -> List[Photo]:
# TODO get rid of it, use cachew..
import dill # type: ignore
if cached:
with open(CACHE_PATH, 'rb') as fo:
@ -278,6 +282,7 @@ def get_photos(cached: bool=False) -> List[Photo]:
else:
return list(iter_photos())
# TODO python3 -m photos update_cache
def update_cache():
import dill # type: ignore
photos = get_photos(cached=False)

View file

@ -1,5 +0,0 @@
geopy
magic
# optional if you want caching
dill

3
run
View file

@ -1,3 +0,0 @@
#!/bin/bash
set -eu
python3 -m photos

View file

@ -1,7 +0,0 @@
#!/bin/bash
set -eu
cd "$(dirname "$0")"
python3 -m photos update_cache