diff --git a/scripts/lib/wallpaper.py b/scripts/lib/wallpaper.py index 4d633ba..d321537 100644 --- a/scripts/lib/wallpaper.py +++ b/scripts/lib/wallpaper.py @@ -1,5 +1,6 @@ """Script to update the wallpaper""" from abc import ABC, abstractmethod +from collections.abc import Iterator from json import dumps, loads from math import ceil, floor, isnan, nan from os import environ @@ -70,11 +71,18 @@ class Wallpaper(Background): if len(stringified) != cls._cache.write_text(stringified): raise Exception("Did not fully write blue light cache to file") + @classmethod + def _files(cls) -> Iterator[Path]: + for (root, _, files) in cls._wallpapers.walk(): + if root.name != "ignore": + for file in files: + yield root / file + @classmethod def available(cls) -> "OrderedSet[Background]": cache = cls._read_cache() modified = False - wallpapers = {str(path): Wallpaper(path) for path in cls._wallpapers.iterdir()} + wallpapers = {str(path): Wallpaper(path) for path in cls._files()} for wallpaper in wallpapers.values(): cached = cache.get(str(wallpaper._path)) if cached is None or isnan(cached):