add main
This commit is contained in:
parent
e8b18b6a74
commit
29e70967f9
1 changed files with 22 additions and 15 deletions
|
@ -1,25 +1,32 @@
|
|||
import logging
|
||||
# TODO eh?
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
from kython.klogging import setup_logzero
|
||||
|
||||
from photos import get_photos, iter_photos, get_logger
|
||||
|
||||
setup_logzero(get_logger(), level=logging.DEBUG)
|
||||
|
||||
import sys
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
cmd = sys.argv[1]
|
||||
if cmd == "update_cache":
|
||||
from photos import update_cache, get_photos
|
||||
update_cache()
|
||||
get_photos(cached=True)
|
||||
|
||||
def main():
|
||||
setup_logzero(get_logger(), level=logging.DEBUG)
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
cmd = sys.argv[1]
|
||||
if cmd == "update_cache":
|
||||
from photos import update_cache, get_photos
|
||||
update_cache()
|
||||
get_photos(cached=True)
|
||||
else:
|
||||
raise RuntimeError(f"Unknown command {cmd}")
|
||||
else:
|
||||
raise RuntimeError(f"Unknown command {cmd}")
|
||||
else:
|
||||
for p in iter_photos():
|
||||
print(f"{p.dt} {p.path} {p.tags}")
|
||||
pass
|
||||
# TODO need datetime!
|
||||
# print(p)
|
||||
for p in iter_photos():
|
||||
print(f"{p.dt} {p.path} {p.tags}")
|
||||
pass
|
||||
# TODO need datetime!
|
||||
# print(p)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Loading…
Add table
Reference in a new issue