Various changes including adding new stevens renderer.
[kiosk.git] / local_photos_mirror_renderer.py
index b27a7918feba389de82897941806bda83ee6ac99..b6499a17bd39a13ad0e011db94cb963bfb6269d9 100644 (file)
@@ -5,15 +5,14 @@ import random
 import re
 from typing import Dict, Set
 
 import re
 from typing import Dict, Set
 
-import constants
 import file_writer
 import renderer
 
 
 import file_writer
 import renderer
 
 
-class local_photos_mirror_renderer(renderer.debuggable_abstaining_renderer):
+class local_photos_mirror_renderer(renderer.abstaining_renderer):
     """A renderer that uses a local mirror of Google photos"""
 
     """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/html/kiosk/images/gphotos/albums"
 
     album_whitelist = frozenset(
         [
 
     album_whitelist = frozenset(
         [
@@ -37,9 +36,11 @@ class local_photos_mirror_renderer(renderer.debuggable_abstaining_renderer):
             "Newer Alex Photos",
             "Ohme Gardens",
             "Olympic Sculpture Park",
             "Newer Alex Photos",
             "Ohme Gardens",
             "Olympic Sculpture Park",
+            "Portland, ME 2021",
             "Prague and Munich 2019",
             "Random",
             "Scott and Lynn",
             "Prague and Munich 2019",
             "Random",
             "Scott and Lynn",
+            "Sculpture Place",
             "SFO 2014",
             "Skiing with Alex",
             "Sonoma",
             "SFO 2014",
             "Skiing with Alex",
             "Sonoma",
@@ -48,6 +49,7 @@ class local_photos_mirror_renderer(renderer.debuggable_abstaining_renderer):
             "Trip to East Coast '16",
             "Tuscany 2008",
             "Yosemite 2010",
             "Trip to East Coast '16",
             "Tuscany 2008",
             "Yosemite 2010",
+            "WA Roadtrip, 2021",
             "Zoo",
         ]
     )
             "Zoo",
         ]
     )
@@ -63,7 +65,7 @@ class local_photos_mirror_renderer(renderer.debuggable_abstaining_renderer):
     )
 
     def __init__(self, name_to_timeout_dict: Dict[str, int]) -> None:
     )
 
     def __init__(self, name_to_timeout_dict: Dict[str, int]) -> None:
-        super(local_photos_mirror_renderer, self).__init__(name_to_timeout_dict, False)
+        super().__init__(name_to_timeout_dict)
         self.candidate_photos: Set[str] = set()
 
     def debug_prefix(self) -> str:
         self.candidate_photos: Set[str] = set()
 
     def debug_prefix(self) -> str:
@@ -87,7 +89,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.
         """
         """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:
             last_dir = root.rsplit("/", 1)[1]
             if self.album_is_in_whitelist(last_dir):
                 for filename in files:
@@ -95,7 +97,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(
                     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/html", "http://kiosk.house/", 1
                         )
                         self.candidate_photos.add(photo_url)
         return True
                         )
                         self.candidate_photos.add(photo_url)
         return True