From 57c514820775fec026455e59d4d272811469a66e Mon Sep 17 00:00:00 2001 From: BoulderBadgeDad Date: Mon, 15 Jun 2026 19:32:57 -0700 Subject: [PATCH] Video Calendar: week navigation + owned/missing filter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Finish the TV calendar as a planning tool. - Week nav: ‹ prev / Today / next › steps the 7-day window (endpoint takes ?start=; each window starts on today's weekday so "current day first" holds). Title reflects it (This Week / Next Week / In N weeks); Today highlight only shows when the real today is in view. - Filter: All / In library / Missing, applied client-side (no refetch) — the hero + grid + count all respect it. - Hero eyebrow is context-aware (NEXT UP this week, FEATURED on other weeks). --- api/video/calendar.py | 20 +++++++--- webui/index.html | 20 +++++++++- webui/static/video/video-calendar.js | 59 +++++++++++++++++++++++----- webui/static/video/video-side.css | 20 ++++++++++ 4 files changed, 103 insertions(+), 16 deletions(-) diff --git a/api/video/calendar.py b/api/video/calendar.py index 7ca59b53..cef8829a 100644 --- a/api/video/calendar.py +++ b/api/video/calendar.py @@ -7,7 +7,7 @@ via VideoDatabase, writes nothing, never touches the music side. from __future__ import annotations -from datetime import date, timedelta +from datetime import date, datetime, timedelta from flask import jsonify, request @@ -22,8 +22,18 @@ def register_routes(bp): from . import get_video_db try: days = request.args.get("days", default=7, type=int) or 7 - days = max(1, min(days, 90)) # clamp: today .. +90d - start = date.today() + days = max(1, min(days, 31)) # one week (or a few) per view + today = date.today() + # Optional ?start=YYYY-MM-DD for week navigation; default = today. + start = today + start_s = request.args.get("start") + if start_s: + try: + start = datetime.strptime(start_s, "%Y-%m-%d").date() + except ValueError: + start = today + if abs((start - today).days) > 400: # sane bound around today + start = today end = start + timedelta(days=days - 1) db = get_video_db() @@ -50,8 +60,8 @@ def register_routes(bp): if e.get("has_file"): owned += 1 return jsonify({ - "today": start.isoformat(), - "start": start.isoformat(), + "today": today.isoformat(), # real today (for the highlight) + "start": start.isoformat(), # window start (may be a future week) "end": end.isoformat(), "days": days, "counts_by_date": counts, diff --git a/webui/index.html b/webui/index.html index 2d2688b4..1a6b17bf 100644 --- a/webui/index.html +++ b/webui/index.html @@ -869,8 +869,24 @@
-

This Week

-

Upcoming episodes from your shows

+
+
+

This Week

+

Upcoming episodes from your shows

+
+
+
+ + + +
+
+ + + +
+
+