Add optional AI generation, MQTT, OAuth refresh and calendar recurrence

This commit is contained in:
Pigway
2026-10-08 23:44:07 +08:00
parent 69a0841868
commit 8209aadbb8
24 changed files with 1113 additions and 37 deletions
+9 -7
View File
@@ -104,9 +104,9 @@ class DisplayService:
)
return existing["operation_id"]
if (
action not in ("render", "local-upload")
action not in ("render", "render-ai", "local-upload")
and tx.execute(
"SELECT id FROM operations WHERE device_id=? AND status='UNKNOWN' AND write_started=1 LIMIT 1",
"SELECT id FROM operations WHERE device_id=? AND status='UNKNOWN' AND write_started=1 AND action!='render-ai' LIMIT 1",
(device_id,),
).fetchone()
):
@@ -178,7 +178,7 @@ class DisplayService:
def blocked(self, device_id):
return (
self.db.one(
"SELECT id FROM operations WHERE device_id=? AND status='UNKNOWN' AND write_started=1 LIMIT 1",
"SELECT id FROM operations WHERE device_id=? AND status='UNKNOWN' AND write_started=1 AND action!='render-ai' LIMIT 1",
(device_id,),
)
is not None
@@ -406,9 +406,11 @@ class DisplayService:
def process_one(self):
with self.lock:
for op in self.queued_operations():
if op["action"] not in ("render", "local-upload") and self.blocked(
op["device_id"]
):
if op["action"] not in (
"render",
"render-ai",
"local-upload",
) and self.blocked(op["device_id"]):
continue
payload = json.loads(op["payload"])
if op["action"] == "display":
@@ -460,7 +462,7 @@ class DisplayService:
driver = self.registry.get(device_id)
if action in self.operation_handlers:
return self.operation_handlers[action](op, payload)
if action in ("render", "local-upload"):
if action in ("render", "render-ai", "local-upload"):
self.update(id, "RENDERING")
from pydantic import TypeAdapter