From 4c3d572eb850c32a45ec9cbaf82688d45c1eebf4 Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Tue, 24 Jun 2025 19:16:36 -0500 Subject: add ability to change out albums list during runtime --- manager.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'manager.py') diff --git a/manager.py b/manager.py index 918a0c4..af1e4a7 100644 --- a/manager.py +++ b/manager.py @@ -67,9 +67,7 @@ class PixMan: return # Initialize texture list - change_callback = lambda d: self.socketio.emit("seek", d) - album_keys = [ ] - self.texture_list = LazyCachingTextureList(album_keys, max_cache_items=self.config.max_cache_assets, change_callback=change_callback) + self.update_textures() # Begin downloading images self.t_idle_download = Thread(target=self.immich_connector.idle, daemon=True) @@ -79,6 +77,14 @@ class PixMan: self.display = PixDisplay(self.texture_list) self.display.main({}) # TODO glut args + def update_textures(self): + if self.texture_list: + self.texture_list.free() + change_callback = lambda d: self.socketio.emit("seek", d) + self.texture_list = LazyCachingTextureList(self.config.album_list, max_cache_items=self.config.max_cache_assets, change_callback=change_callback) + if self.display: + self.display.update_textures(self.texture_list) + def update_config(self, config, replace=False): oldconfig = copy.deepcopy(self.config) if replace: @@ -93,8 +99,9 @@ class PixMan: self.display.update_config() if oldconfig.album_list != self.config.album_list: - self.texture_list = LazyCachingTextureList(album_keys) - self.display.update_textures() + self.update_textures() + else: + self.texture_list.max_cache_items = self.config.max_cache_assets # If all goes well self.config.save(self.configfile) -- cgit v1.2.3