---
issue: "MyTV program cache not updated during broadcast playback"
description: "Program list cache retains watched episodes until MyTV dialog is reopened, causing brief display of stale items."
area: "plugin.video.milionar — MyTV program management"
severity: "minor"
status: "open"
created: "2026-04-12"
updated: "2026-04-12"
resolved: null
files:
  - wcs/ai/DialogMyTV.py
  - wcs/playback/PlaylistCountdownMonitor.py
  - wcs/ai/ProgressManager.py
related_features:
  - "docs/features/plugin-video-milionar/004-mytv.md"
---

# MyTV program cache not updated during broadcast playback

## Context
MyTV in plugin.video.milionar allows users to watch channels via "Živé vysílání" (broadcast) button. The program list (queue of upcoming episodes) is stored in cache (`program_list_{channel_id}`) with 24h TTL.

## Problem description
When user watches episodes via broadcast playlist, `PlaylistCountdownMonitor._mark_episode_watched()` updates `ChannelHistory` progress but does NOT update the program list cache. The watched episodes remain in cache until the user reopens MyTV dialog, where `_update_program_queues()` removes them.

Result: When user reopens MyTV after watching 5 episodes, they briefly see all 5 still in the program list before `_update_program_queues()` + `_async_program_append()` clean up and refill the list. This causes a visual flash of stale data.

## Reproduction steps
1. Open MyTV, select a channel with program
2. Press "Živé vysílání" — plays broadcast playlist
3. Watch 2-3 episodes (PlaylistCountdownMonitor marks them watched)
4. Stop playback, reopen MyTV
5. Result: Program list briefly shows watched episodes before async cleanup removes them

Expected: Program list should already reflect the updated state immediately on open.

## Cause
`PlaylistCountdownMonitor._mark_episode_watched()` only calls `ChannelHistory.update_series_progress()` and `ChannelHistory.clear_resume_point()`. It does NOT modify the `program_list_{channel_id}` cache entry. The `_update_program_queues()` method in `DialogMyTV.onInit()` handles the cleanup, but only when the dialog opens.

## Solution
Not yet resolved.

Proposed approach: After `_mark_episode_watched()`, also remove the watched episode from `program_list_{channel_id}` cache and trigger `_async_program_append` to add a replacement at the end. This would keep the cache always current.

## Notes
- The fingerprint mechanism in `ProgressManager` detects stale caches on dialog open, but doesn't help during active playback.
- This is a cosmetic issue — the program list corrects itself within ~1 second of opening the dialog, but the brief flash of stale data is noticeable.
