Skip to content

v1.3.1: XMLTV catch-up icons restored

Latest

Choose a tag to compare

@cedric-marcoux cedric-marcoux released this 04 May 19:38

Hotfix — XMLTV catch-up icons missing after EPG cache clear

After upgrading to v1.3.0 (or any earlier version), TiviMate / IPTVnator clients lost catch-up icons in the EPG grid as soon as their local EPG cache was cleared. Xtream API endpoints and /timeshift/.../...ts proxy were all working — but the XMLTV stream served at /xmltv.php contained zero past programmes, and that grid is what catch-up clients use to render the rewind icon.

Root cause

Dispatcharr core generate_epg honors a prev_days parameter (URL ?prev_days= or user.custom_properties.epg_prev_days) which controls how many days of past EPG to include. Default is 0. The plugin's _patch_generate_epg only converted UTC timestamps to local timezone in the response — it never injected prev_days. Every XMLTV download served only future programmes, leaving clients nothing to attach has_archive icons to once their cache was wiped.

The bug was latent since the plugin was created, masked for years by the persistent EPG cache that catch-up clients keep locally.

Fix

_patch_generate_epg now mutates request.GET to inject prev_days before delegating to Dispatcharr core. The injected value is, in priority order:

  1. URL ?prev_days= (always wins, untouched)
  2. user.custom_properties.epg_prev_days (always wins, untouched)
  3. Plugin setting xmltv_prev_days_override if > 0
  4. Auto-detected = max tv_archive_duration across XC streams with tv_archive=1, capped at 30, cached 5 minutes per process

The auto path means each deployment automatically gets the right lookback for its provider — no manual configuration needed. The DB scan is small (filter on m3u_account.account_type='XC') and cached, so xmltv.php downloads stay fast even on schedules.

A new plugin setting xmltv_prev_days_override (default 0 = auto) lets admins force a fixed lookback (1-30 days) when needed.

Verification on a live deployment (Dispatcharr v0.24, 1238 XC streams)

Probe Before After
xmltv.php programmes 456 7293
xmltv.php earliest today 10:00 3 days ago
Auto-detected prev_days n/a 14 (provider max)
get_live_streams tv_archive=1 92/93 92/93 (unchanged)
get_simple_data_table has_archive OK OK (unchanged)
/timeshift/.../...ts HTTP 200 HTTP 200 (unchanged)

Issue #14 (RecursionError) and Issue #8 (fallback chain) regression tests still pass.

Files changed

  • hooks.py: new _compute_provider_archive_days() helper, _get_plugin_config adds xmltv_prev_days_override default, _patch_generate_epg injects prev_days with try/finally restore of request.GET
  • plugin.py: new settings field xmltv_prev_days_override (string, default "0")
  • plugin.json: 1.3.0 → 1.3.1
  • README.md: v1.3.1 changelog entry

Upgrade

Plugin remains 100% independent — no Dispatcharr core modifications required.

cd /path/to/dispatcharr/data/plugins/dispatcharr_timeshift
git pull
docker restart dispatcharr

Or download the ZIP attached and import via Settings → Plugins → Import.