feat(trip-cluster): ingest — scopeable, incremental, processed read-back
This commit is contained in:
@@ -18,6 +18,19 @@ def _immich(deps, cfg):
|
||||
return ImmichClient(cfg.immich_url, cfg.immich_api_key)
|
||||
|
||||
|
||||
def cmd_ingest(deps, *, date_from, date_to, tag, subset, full) -> int:
|
||||
cfg = deps["config"]
|
||||
store = _store(cfg)
|
||||
client = _immich(deps, cfg)
|
||||
from app.ingest import run_ingest
|
||||
res = run_ingest(client, store, cfg.thumbs_dir, date_from=date_from,
|
||||
date_to=date_to, tag=tag, subset=subset, full=full)
|
||||
store.close()
|
||||
print(f"Ingested {res['fetched']} asset(s); "
|
||||
f"{res['processed_marked']} already-processed.")
|
||||
return 0
|
||||
|
||||
|
||||
def cmd_serve(deps) -> int:
|
||||
from app import create_app
|
||||
create_app(deps["config"]).run(host="0.0.0.0", port=8084)
|
||||
@@ -51,7 +64,10 @@ def main(argv=None) -> int:
|
||||
deps = {"config": load_config()}
|
||||
if args.command == "serve":
|
||||
return cmd_serve(deps)
|
||||
# ingest / cluster / apply are wired in later tasks.
|
||||
if args.command == "ingest":
|
||||
return cmd_ingest(deps, date_from=args.date_from, date_to=args.date_to,
|
||||
tag=args.tag, subset=args.subset, full=args.full)
|
||||
# cluster / apply are wired in later tasks.
|
||||
print(f"Command '{args.command}' is not implemented yet.")
|
||||
return 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user