Fix tuner management page crash after EPG refresh#93
Closed
Conversation
Co-authored-by: thehack904 <35552907+thehack904@users.noreply.github.com>
Co-authored-by: thehack904 <35552907+thehack904@users.noreply.github.com>
Co-authored-by: thehack904 <35552907+thehack904@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement EPG data caching with TTL and manual refresh
Implement EPG caching with configurable TTL and manual refresh
Feb 16, 2026
Copilot
AI
changed the title
Implement EPG caching with configurable TTL and manual refresh
Verify tuner management page accessibility - no issues found
Feb 16, 2026
Co-authored-by: thehack904 <35552907+thehack904@users.noreply.github.com>
Copilot
AI
changed the title
Verify tuner management page accessibility - no issues found
Fix template TypeError in tuner management page with empty EPG cache
Feb 17, 2026
Co-authored-by: thehack904 <35552907+thehack904@users.noreply.github.com>
Copilot
AI
changed the title
Fix template TypeError in tuner management page with empty EPG cache
Fix template crash on tuner management page after EPG refresh
Feb 17, 2026
Co-authored-by: thehack904 <35552907+thehack904@users.noreply.github.com>
Copilot
AI
changed the title
Fix template crash on tuner management page after EPG refresh
Fix template crash and hangs on tuner management page after EPG refresh
Feb 17, 2026
Co-authored-by: thehack904 <35552907+thehack904@users.noreply.github.com>
Copilot
AI
changed the title
Fix template crash and hangs on tuner management page after EPG refresh
Fix tuner management page crash after EPG refresh
Feb 17, 2026
…e DB issues Co-authored-by: thehack904 <35552907+thehack904@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Plan: Fix Tuner Management Page by Removing Problematic EPG Cache UI
Problem Analysis
User reports: "This is just not working. For now I am going to close this and move on"
Multiple attempts to fix the EPG cache display have failed:
The user is clearly frustrated and wants to move on. The EPG caching feature is causing persistent issues.
Solution Approach
Since the EPG caching backend functions may still be useful (for performance), but the UI is problematic, I will:
Option 1: Remove EPG Cache UI Section Entirely (RECOMMENDED)
/change_tunerpageOption 2: Make It Admin-Only and Hidden
Implementation Plan
templates/change_tuner.htmlBenefits
Testing
Original prompt
EPG Caching & Manual Refresh
Overview
Implement comprehensive EPG data caching with configurable TTL (Time To Live) and manual refresh capabilities to improve performance and user experience in the RetroIPTVGuide application.
Current State
Based on the codebase analysis:
parse_epg()function that fetches from XML URLcached_channelsandcached_epgrefresh_if_due()function that checks timing/guideroute callsrefresh_if_due()on each page loadtuners.dbwith asettingstable)get_setting()andset_setting()helper functionsRequired Implementation
1. EPG Data Caching with TTL
Implement cache metadata tracking:
Cache structure should include:
Modify EPG loading logic:
2. Configurable Cache Duration
Add cache duration settings with preset options:
5 minutes (300 seconds)
10 minutes (600 seconds)
15 minutes (900 seconds)
30 minutes (1800 seconds) - default
60 minutes (3600 seconds)
Store in settings table with key
epg_cache_durationAdd UI controls in
templates/change_tuner.html(tuner management page)Create a settings section with radio buttons or dropdown for duration selection
Save via POST to a new endpoint or existing
/change_tunerroute3. Manual Refresh Button
Add "Refresh Guide Now" button:
templates/_header.html)Create API endpoint:
/api/refresh_guide(POST)@login_requireddecoratorAdd JavaScript handler:
templates/guide.htmlor shared JS file4. Cache Age Display in UI
Add cache status indicator:
Create cache info endpoint:
/api/cache_info(GET){ "cached_at": "ISO timestamp", "expires_at": "ISO timestamp", "age_minutes": number, "ttl_minutes": number, "tuner": "tuner name" }5. Performance Improvements
Optimize guide reload:
refresh_if_due()respects cache TTL settingsAdd cache statistics:
Technical Requirements
Backend (app.py)
Add cache management functions:
get_cache_info()- returns current cache metadatais_cache_valid()- checks if cache is still validinvalidate_cache()- clears cacheupdate_cache()- stores new EPG data with timestampModify existing functions:
refresh_current_tuner()to use cacherefresh_if_due()to respect TTL settings/guideroute to use cached dataAdd new routes:
/api/refresh_guide- manual refresh/api/cache_info- cache status/settings/cache- cache settings page (or add to existing settings)Frontend Templates
templates/_header.html:
templates/change_tuner.html:
templates/guide.html:
JavaScript
Implementation Notes
This pull request was created from Copilot chat.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.