diff options
| author | Tim Keller <tjk@tjkeller.xyz> | 2025-06-20 22:32:28 -0500 |
|---|---|---|
| committer | Tim Keller <tjk@tjkeller.xyz> | 2025-06-20 22:32:28 -0500 |
| commit | ce64f1a42c9570efa75cc2f568e59d683f499bdd (patch) | |
| tree | 03563a0ce3ce666f465989044120797e5170ff6f /flaskapi.py | |
| parent | c9e7eb40fc5f408cc4177763fd4e82a3632388a1 (diff) | |
| download | immich-frame-ce64f1a42c9570efa75cc2f568e59d683f499bdd.tar.xz immich-frame-ce64f1a42c9570efa75cc2f568e59d683f499bdd.zip | |
config update and more endpoints for api fromtend
Diffstat (limited to 'flaskapi.py')
| -rw-r--r-- | flaskapi.py | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/flaskapi.py b/flaskapi.py index beabea0..a539dc5 100644 --- a/flaskapi.py +++ b/flaskapi.py @@ -30,16 +30,33 @@ def seek(increment): return { "imageIndex": display.current_texture_index } +@api.route("/albums/update", methods=["POST"]) +def albums_update(): + return { "success": PixMan().update_config(album_list=request.json) } + @api.route("/albums") -def get_albums(): +def albums_get(): if not (ic := PixMan().immich_connector): return {} keys = [ "albumName", "albumThumbnailAssetId", "id", "startDate", "endDate", "assetCount", "shared", ] + selected_albums = PixMan().config.album_list return [{ - key: album[key] for key in keys - } for album in ic.load_all_albums() ] + key: album.get(key, None) for key in keys + } | { "selected": album in selected_albums } for album in ic.load_all_albums() if album["assetCount"] ] + + +@api.route("/asset/<key>/filename") +def get_asset_name(key): + if not (ic := PixMan().immich_connector): + return {} + # TODO ensure getting actual album thumb + name = ic.load_image_filename(key) + if name is None: + abort(400) + return { "filename": name } +@api.route("/asset/<key>/fullsize", defaults={ "size": "fullsize" }) @api.route("/asset/<key>/thumbnail", defaults={ "size": "thumbnail" }) @api.route("/asset/<key>", defaults={ "size": "preview" }) def get_asset(key, size): @@ -61,10 +78,10 @@ def immich_redirect(path): @api.route("/config/update", methods=["POST"]) def config_update(): - return { "success": PixMan().update_config(Config(**request.json)) } + return { "success": PixMan().update_config(**request.json) } @api.route("/config") -def config(): +def config_get(): return jsonify(PixMan().config) |
