From e05196ff8384ddabc7ce450cc99bcf02d9648d87 Mon Sep 17 00:00:00 2001 From: Remy Moll Date: Sun, 3 Mar 2024 13:15:50 +0100 Subject: [PATCH] update to reflect immich api changes --- deploy/deploy.playbook.yml | 2 +- deploy/setup.playbook.yml | 5 ----- deploy/templates/eink-show.service.j2 | 1 + src/get/immich.py | 2 +- src/main.py | 8 ++++++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/deploy/deploy.playbook.yml b/deploy/deploy.playbook.yml index 4120c4f..182d894 100644 --- a/deploy/deploy.playbook.yml +++ b/deploy/deploy.playbook.yml @@ -12,7 +12,7 @@ tasks: - name: Load program variables ansible.builtin.include_vars: - file: ../program_variables.yml + file: ./program_variables.yml name: program_variables - name: Pull the latest version of the code diff --git a/deploy/setup.playbook.yml b/deploy/setup.playbook.yml index 2811ff9..ac5bf9b 100644 --- a/deploy/setup.playbook.yml +++ b/deploy/setup.playbook.yml @@ -53,8 +53,3 @@ reboot: connect_timeout: 20 reboot_timeout: 300 - - - name: Wait for the Raspberry Pi to reboot - wait_for_connection: - delay: 5 - timeout: 300 diff --git a/deploy/templates/eink-show.service.j2 b/deploy/templates/eink-show.service.j2 index 23e173c..303ca6e 100644 --- a/deploy/templates/eink-show.service.j2 +++ b/deploy/templates/eink-show.service.j2 @@ -5,6 +5,7 @@ Description=Show new photo onto the eink display Type=oneshot User={{ ansible_user }} WorkingDirectory={{ code_dest }} +ExecStartPre=/bin/sleep 30 ExecStart=python main.py Environment="OWN_IMAGE_PERCENT={{ program_variables.OWN_IMAGE_PERCENT }}" Environment="RECIPIENT={{ program_variables.RECIPIENT }}" diff --git a/src/get/immich.py b/src/get/immich.py index dc3d70c..a4211ff 100644 --- a/src/get/immich.py +++ b/src/get/immich.py @@ -46,7 +46,7 @@ class ImageGetImmich(ImageGet): def get_image_file(self, image_id: str) -> bytearray: - url = self.base_url + "asset/download/" + image_id + url = self.base_url + "download/asset/" + image_id headers = self.headers | {"Accept": "application/octet-stream"} response = h.request("POST", url, headers=headers, data={}) diff --git a/src/main.py b/src/main.py index 14d2fbb..3bdc0a0 100644 --- a/src/main.py +++ b/src/main.py @@ -1,15 +1,19 @@ import sys +from pathlib import Path +import os + from image_convert import ImageShrink from get.combined import ImageGetCombined from get.template import ImageGetException from image_show import ImageShow import notify -import os + +VARS = Path("../deploy/program_variables.yml") if os.getenv("IMMICH_API_URL") is None: # values are not set, import them from local yaml file import yaml - with open("../deploy/program_variables.yml", "r") as f: + with open(VARS, "r") as f: config = yaml.safe_load(f) for key, value in config.items(): os.environ[key] = value