Dispatcharr/core
Cédric Marcoux b6bbd39469 fix(timeshift): PATH-first catch-up + strict-UTC API surface with proxy-time provider timezone conversion
Two coupled fixes that make catch-up play the requested programme:

1. Try the PATH catch-up form (/timeshift/.../{start}/{id}.ts) BEFORE the
   timeshift.php query form. Empirical testing showed some XC providers
   return the LIVE stream on the query form (HTTP 200, silently ignoring
   `start`) — a valid MPEG-TS indistinguishable from a real archive, so the
   cascade accepted it and the user always got live content. The PATH form
   actually seeks. Candidate ordering now lives in
   build_timeshift_candidate_urls() with the full rationale.

2. Strict-UTC XC API surface + single proxy-time timezone conversion:
   - xc_get_epg start/end always UTC, server_info.timezone always "UTC",
     time_now UTC — the timezone triple is consistently UTC.
   - Removed the global default_timezone setting and the
     _convert_xmltv_to_local_timezone rewrite entirely.
   - The proxy converts the client's UTC timestamp to the SERVING provider's
     own zone (server_info.timezone captured on account refresh, read from
     the account's default profile) right before building the upstream URL —
     DST-correct via ZoneInfo, no-op for UTC/unknown zones. Verified against
     a real provider: it interprets the URL timestamp as its LOCAL wall
     clock, so pure UTC pass-through seeks 1-2h off.
   - EPG duration lookup keeps the ORIGINAL UTC timestamp (programmes are
     stored in UTC) — exactly one conversion in the whole chain.

Also per review feedback:
- Removed the debug_logging toggle — verbose timeshift logging now follows
  the standard logger DEBUG level (DISPATCHARR_LOG_LEVEL).
- Removed the dead default_language setting (never read anywhere; the EPG
  lang field is hardcoded). TIMESHIFT_DEFAULTS is down to
  xmltv_prev_days_override, and the Settings UI shows that single field
  with accurate help text.
- Validate the timestamp up front (400 on malformed input) instead of
  forwarding it verbatim into the upstream URL.
- Redact the upstream URL in the connection-error log (requests exceptions
  embed the full URL, which carries XC credentials).
- URL-encode XC credentials in both URL builders.
- Request identity encoding upstream (the TS-sync peek reads raw bytes).
- Poll the stop key on the 5-second heartbeat cadence instead of every 100
  chunks (~25 MB), so stream-limit terminations free the provider slot fast.
- New tests: proxy timestamp wiring (converted value reaches the URL
  builder, original UTC value reaches the duration lookup), _redact_url,
  decisive 3xx break (anti ban), invalid timestamp rejection; deflaked the
  format-cache promotion test (django cache persists across runs).
2026-06-10 22:04:44 +02:00
..
fixtures feat: add system notifications and update checks 2026-02-03 09:24:02 -06:00
management/commands Enhancement: Update psycopg2 to 3. 2026-05-28 19:27:52 -05:00
migrations fix: update default output profiles to include additional ffmpeg parameters for improved processing speed. 2026-05-17 12:33:37 -05:00
__init__.py Alpha v3 2025-02-21 15:31:59 -06:00
admin.py modified database fields for consistency, removed custom_url from streams (no longer needed) 2025-03-16 09:07:10 -04:00
api_urls.py Enhancement: Initial fmp4 support and major ts_proxy refactor 2026-05-08 17:46:47 -05:00
api_views.py fix(environment): harden IP lookup, add WebSocket push, improve sidebar UX 2026-05-31 17:56:52 -05:00
apps.py Bug Fix: EPG program times shifted by host offset when /etc/localtime is mounted. (Fixes #651) 2026-05-01 17:54:25 -05:00
command_utils.py Bypass redis for management commands. 2025-03-22 12:23:54 -05:00
developer_notifications.py Fix #954: Superuser detection; Feature #1004: User account disable/enable 2026-02-22 18:05:02 -06:00
models.py fix(timeshift): PATH-first catch-up + strict-UTC API surface with proxy-time provider timezone conversion 2026-06-10 22:04:44 +02:00
redis_pubsub.py initial run of a binary and encoded redis client - no more encoding / decoding data into redis, huge PITA (still some outstanding spots I need to patch) 2025-10-25 08:15:39 -04:00
scheduling.py feat(scheduling): add cron builder and refactor scheduling components (Closes #165) 2026-02-12 18:08:13 -06:00
serializers.py Enhancement: Initial fmp4 support and major ts_proxy refactor 2026-05-08 17:46:47 -05:00
signals.py feat: add system notifications and update checks 2026-02-03 09:24:02 -06:00
tasks.py fix(epg): handle attr-spacing and named entities in index lookup, unblock boot rebuild 2026-05-31 21:57:26 +02:00
tests.py fix(epg): handle attr-spacing and named entities in index lookup, unblock boot rebuild 2026-05-31 21:57:26 +02:00
urls.py Pre-Alpha v4 2025-02-24 15:04:03 -06:00
utils.py refactor(epg): replace synchronous WebSocket send function with unified send_epg_update 2026-06-05 10:42:39 -05:00
views.py fix: replace fork()-based subprocess with posix_spawn at all uWSGI spawn sites 2026-05-15 16:45:09 -05:00
xtream_codes.py fix: Preserve base path in URL normalization for XC server and transform credentials. (Fixes #1218) 2026-05-14 09:53:10 -05:00