move photos provider inside
This commit is contained in:
parent
a576230e30
commit
e23276266b
5 changed files with 5 additions and 15 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
|
||||||
|
# pip install geopy magic
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import itertools
|
import itertools
|
||||||
import os
|
import os
|
||||||
|
@ -270,6 +273,7 @@ def iter_photos() -> Iterator[Photo]:
|
||||||
geos.pop()
|
geos.pop()
|
||||||
|
|
||||||
def get_photos(cached: bool=False) -> List[Photo]:
|
def get_photos(cached: bool=False) -> List[Photo]:
|
||||||
|
# TODO get rid of it, use cachew..
|
||||||
import dill # type: ignore
|
import dill # type: ignore
|
||||||
if cached:
|
if cached:
|
||||||
with open(CACHE_PATH, 'rb') as fo:
|
with open(CACHE_PATH, 'rb') as fo:
|
||||||
|
@ -278,6 +282,7 @@ def get_photos(cached: bool=False) -> List[Photo]:
|
||||||
else:
|
else:
|
||||||
return list(iter_photos())
|
return list(iter_photos())
|
||||||
|
|
||||||
|
# TODO python3 -m photos update_cache
|
||||||
def update_cache():
|
def update_cache():
|
||||||
import dill # type: ignore
|
import dill # type: ignore
|
||||||
photos = get_photos(cached=False)
|
photos = get_photos(cached=False)
|
|
@ -1,5 +0,0 @@
|
||||||
geopy
|
|
||||||
magic
|
|
||||||
|
|
||||||
# optional if you want caching
|
|
||||||
dill
|
|
3
run
3
run
|
@ -1,3 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
set -eu
|
|
||||||
python3 -m photos
|
|
|
@ -1,7 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
cd "$(dirname "$0")"
|
|
||||||
|
|
||||||
python3 -m photos update_cache
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue