summaryrefslogtreecommitdiff
path: root/settings.py
diff options
context:
space:
mode:
authorTim Keller <tjk@tjkeller.xyz>2025-06-24 19:26:15 -0500
committerTim Keller <tjk@tjkeller.xyz>2025-06-24 19:26:15 -0500
commit4be4fd53b3f71d1da55fc7f4c31640bf6f1c4992 (patch)
tree2a930728b4d5d81820211bd7790d9684f0a9f252 /settings.py
parentffa5ff333eabffe07394fb21bc413d7d238ee651 (diff)
parent4c3d572eb850c32a45ec9cbaf82688d45c1eebf4 (diff)
downloadimmich-frame-4be4fd53b3f71d1da55fc7f4c31640bf6f1c4992.tar.xz
immich-frame-4be4fd53b3f71d1da55fc7f4c31640bf6f1c4992.zip
merge pixpy repo into this repo
Diffstat (limited to 'settings.py')
-rw-r--r--settings.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/settings.py b/settings.py
new file mode 100644
index 0000000..69e40ca
--- /dev/null
+++ b/settings.py
@@ -0,0 +1,35 @@
+from dataclasses import dataclass, asdict, field
+import json
+
+
+@dataclass
+class Config:
+ # Immich server
+ immich_url: str = ""
+ immich_api_key: str = ""
+ # Display
+ image_duration: float = 10.0
+ transition_duration: float = 0.5
+ max_framerate: float = 30.0
+ auto_transition: bool = True
+ display_size: str = "preview" # 'fullsize', 'preview', 'thumbnail'
+ # Cache
+ max_cache_assets: int = 100
+ # Albums data
+ album_list: list[str] = field(default_factory=list)
+
+ #def __dict__(self):
+ # return asdict(self)
+
+ @classmethod
+ def load(cls, filepath):
+ with open(filepath, "r") as fp:
+ return cls(**json.load(fp))
+
+ def save(self, filepath):
+ with open(filepath, "w") as fp:
+ json.dump(asdict(self), fp, indent=2)
+
+ def update(self, **config):
+ for key, value in config.items():
+ setattr(self, key, value)