Add optional photo providers, layout studio and scoped integrations

This commit is contained in:
Pigway
2026-10-08 23:18:11 +08:00
parent 3643fae86a
commit 69a0841868
38 changed files with 2843 additions and 41 deletions
+15 -7
View File
@@ -83,6 +83,9 @@ class SynologyPhotos:
("SYNO.API.Auth", "login"),
("SYNO.API.Auth", "logout"),
("SYNO.FotoTeam.Browse.Person", "list"),
("SYNO.Foto.Browse.Person", "list"),
("SYNO.Foto.Browse.Item", "list"),
("SYNO.Foto.Browse.Folder", "get"),
("SYNO.FotoTeam.Browse.Item", "list"),
("SYNO.FotoTeam.Browse.Folder", "get"),
}:
@@ -193,9 +196,10 @@ class SynologyPhotos:
return rows
raise FlowError(E.CONFLICT, "Photos catalog exceeds query limit", 409)
def people(self):
def people(self, space="shared"):
prefix = "SYNO.FotoTeam" if space == "shared" else "SYNO.Foto"
with self.lock:
rows = self.pages("SYNO.FotoTeam.Browse.Person", 3)
rows = self.pages(prefix + ".Browse.Person", 3)
return [
{
"id": r["id"],
@@ -206,13 +210,17 @@ class SynologyPhotos:
for r in rows
]
def paths(self, person_ids, mode, refresh=False):
key = (tuple(sorted(person_ids)), mode)
def paths(self, person_ids, mode, refresh=False, *, space="shared"):
prefix = "SYNO.FotoTeam" if space == "shared" else "SYNO.Foto"
key = (tuple(sorted(person_ids)), mode, space)
with self.lock:
cached = self.cache.get(key)
if cached and not refresh and time.monotonic() - cached[0] < 900:
return cached[1]
known = {p["id"] for p in self.people()}
known = {
p["id"]
for p in (self.people() if space == "shared" else self.people(space))
}
ids = person_ids or sorted(known)
if not set(ids) <= known:
raise FlowError(E.INVALID_REQUEST, "Selected person no longer exists")
@@ -221,7 +229,7 @@ class SynologyPhotos:
for person in ids:
paths = set()
for row in self.pages(
"SYNO.FotoTeam.Browse.Item",
prefix + ".Browse.Item",
7,
person_id=person,
additional=json.dumps(["folder"]),
@@ -241,7 +249,7 @@ class SynologyPhotos:
)
if folder_id not in folders:
folders[folder_id] = self.request(
"SYNO.FotoTeam.Browse.Folder",
prefix + ".Browse.Folder",
"get",
2,
id=folder_id,