summaryrefslogtreecommitdiff
path: root/settings.py
diff options
context:
space:
mode:
authorTim Keller <tjk@tjkeller.xyz>2025-06-16 21:50:38 -0500
committerTim Keller <tjk@tjkeller.xyz>2025-06-16 21:50:38 -0500
commitb8df4605b42d9a61bb4ae4731efabbdc38166063 (patch)
treed0044ca3c47c00442d15a99da6e309c08601b99e /settings.py
parentcd1657ece1fa199964abd6544b81b394ab9369aa (diff)
downloadimmich-frame-b8df4605b42d9a61bb4ae4731efabbdc38166063.tar.xz
immich-frame-b8df4605b42d9a61bb4ae4731efabbdc38166063.zip
add config and add application thread manager
Diffstat (limited to 'settings.py')
-rw-r--r--settings.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/settings.py b/settings.py
new file mode 100644
index 0000000..43cb024
--- /dev/null
+++ b/settings.py
@@ -0,0 +1,39 @@
+from dataclasses import dataclass, asdict, field
+import json
+
+
+@dataclass
+class AlbumList:
+ name: str
+ album_keys: list[str]
+
+
+@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_lists: list[AlbumList] = field(default_factory=list)
+ album_list_selected: int = None
+
+ def __post_init__(self):
+ self.album_lists = [ AlbumList(*a) for a in self.album_lists ]
+
+ @classmethod
+ def load(cls, filepath):
+ with open(filepath, "r") as fp:
+ return cls(**json.load(fp))
+
+ def save(self, filepath):
+ data = asdict(self)
+ with open(filepath, "w") as fp:
+ json.dump(data, fp, indent=2)