X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=local_photos_mirror_renderer.py;fp=local_photos_mirror_renderer.py;h=287bdd697ecdfad96c93e47aa12619463cee54f9;hb=73e4d75ceabe5546f3966cfdcd1f705c77be17f7;hp=b27a7918feba389de82897941806bda83ee6ac99;hpb=144f769da44d2a8411e320e2e66ad1dbc48ed091;p=kiosk.git diff --git a/local_photos_mirror_renderer.py b/local_photos_mirror_renderer.py index b27a791..287bdd6 100644 --- a/local_photos_mirror_renderer.py +++ b/local_photos_mirror_renderer.py @@ -5,7 +5,6 @@ import random import re from typing import Dict, Set -import constants import file_writer import renderer @@ -13,7 +12,7 @@ import renderer class local_photos_mirror_renderer(renderer.debuggable_abstaining_renderer): """A renderer that uses a local mirror of Google photos""" - ALBUM_ROOT_DIR = "/var/www/kiosk/pages/images/gphotos/albums" + album_root_directory = "/var/www/kiosk/pages/images/gphotos/albums" album_whitelist = frozenset( [ @@ -87,7 +86,7 @@ class local_photos_mirror_renderer(renderer.debuggable_abstaining_renderer): """Walk the filesystem looking for photos in whitelisted albums and keep their paths in memory. """ - for root, subdirs, files in os.walk(self.ALBUM_ROOT_DIR): + for root, subdirs, files in os.walk(self.album_root_directory): last_dir = root.rsplit("/", 1)[1] if self.album_is_in_whitelist(last_dir): for filename in files: @@ -95,7 +94,7 @@ class local_photos_mirror_renderer(renderer.debuggable_abstaining_renderer): if extension in self.extension_whitelist: photo_path = os.path.join(root, filename) photo_url = photo_path.replace( - "/var/www/", f"http://{constants.hostname}/", 1 + "/var/www/", "http://kiosk.house/", 1 ) self.candidate_photos.add(photo_url) return True