diff options
| author | tslil <tslil@posteo.de> | 2026-07-20 16:01:25 +0100 |
|---|---|---|
| committer | tslil <tslil@posteo.de> | 2026-07-20 16:12:34 +0100 |
| commit | 0d0857c65296ecbe2b03993e939ef1f15ff8fd8b (patch) | |
| tree | 74396796ed3cf8a7736fc8cb2124712caaf41ef6 | |
| parent | 309770a3da98904454fa355d02060c23d95dd999 (diff) | |
wallpaper.py: incorporate the season
| -rwxr-xr-x | wallpaper.py | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/wallpaper.py b/wallpaper.py index b2048b2..a940710 100755 --- a/wallpaper.py +++ b/wallpaper.py @@ -74,7 +74,20 @@ def step_context( elevation: int = 0, ) -> str: - today = now.strftime("Current date and time: %A %B %d, %Y at %H:%M %Z") + Y = 2000 # dummy leap year to allow input X-02-29 (leap day) + seasons = [ + ("winter", (dt.date(Y, 1, 1), dt.date(Y, 3, 20))), + ("spring", (dt.date(Y, 3, 21), dt.date(Y, 6, 20))), + ("summer", (dt.date(Y, 6, 21), dt.date(Y, 9, 22))), + ("autumn", (dt.date(Y, 9, 23), dt.date(Y, 12, 20))), + ("winter", (dt.date(Y, 12, 21), dt.date(Y, 12, 31))), + ] + + date = now.date() + date = date.replace(year=Y) + season = next(season for season, (start, end) in seasons if start <= date <= end) + + today = now.strftime(f"Date and time: %A %B %d, %Y at %H:%M %Z. Season: {season}.") if latitude is None or longitude is None: return today @@ -125,7 +138,7 @@ def step_context( except Exception as exc: logger.warning("Weather fetch failed (%s), continuing anyway.", exc) - return f"{today}. Daylight: {sun_times}. Weather: {detail}" if detail else today + return f"{today} Daylight: {sun_times}. Weather: {detail}" if detail else today def step_llm( @@ -356,7 +369,7 @@ def parse_args() -> argparse.Namespace: "moss", "rocks", "abstract concrete sculptures", - "water channel", + "precise water channel", "distant futuristic megastructure", ], help="Taste keywords for the LLM art-director prompt.", @@ -397,13 +410,14 @@ def parse_args() -> argparse.Namespace: llm.add_argument( "--llm-system-prompt", default=( - "You are a wallpaper art director. Given the user's taste and today's context, " - "write one detailed text-to-image prompt for a diffusion model. Not all of the " - "user's taste should be present, it's a suggestion and you should choose only some " - "or expand on it as required. The time of day should feature in your output clearly. " + "You are a wallpaper art director. " + "Given the user's taste and the context, write one detailed text-to-image prompt for a diffusion model. " + "Not all of the user's taste should be present, it's a suggestion and you should choose only a subset and improvise on the themes. " "Times after sunset and before sunrise should generate dark images for night time. " "Times during the day should track the brightness of the hour. " "The weather should be reflected in your prompt. " + "The season should set the overall mood of the prompt. " + "Do not include the time, date, or location in your prompt. " "Output ONLY the image prompt — no explanation or preamble." ), help="System prompt for LLM.", |
