Keep manual redisplays separate from random task cloud heads

This commit is contained in:
Pigway
2026-10-06 09:34:05 +08:00
parent 180b6ae100
commit 60f42fb58c
2 changed files with 40 additions and 2 deletions
+16 -2
View File
@@ -12,14 +12,28 @@ class CloudLibrary:
self.checked = 0.0
def register(self, device_id, image_id, asset_id, operation_id):
meta = self.service.assets.info(asset_id)
operation = self.db.one(
"SELECT payload FROM operations WHERE id=?", (operation_id,)
)
payload = json.loads(operation["payload"])
content = payload.get("content", {})
job = self.db.one(
"SELECT job_id FROM job_runs WHERE operation_id=?", (operation_id,)
)
job_id = (
job["job_id"]
if job
and content.get("type") == "photo_source"
and content.get("item_id") is None
else None
)
self.db.execute(
"INSERT INTO managed_cloud_uploads VALUES(?,?,?,?,?,?,NULL,NULL)",
(
device_id,
image_id,
asset_id,
meta.get("job_id"),
job_id,
operation_id,
datetime.now(UTC).isoformat(),
),