diff --git a/Dockers/self-hosted-iptv/README.md b/Dockers/self-hosted-iptv/README.md index 7c8d936..8332976 100644 --- a/Dockers/self-hosted-iptv/README.md +++ b/Dockers/self-hosted-iptv/README.md @@ -40,7 +40,11 @@ Series are matched by folder name (e.g. `series/W817` → search "W817"); episod - **Persistent cache:** Fetched metadata is stored under `/data/tmdb_cache/` (series search, series details, episode, episode credits). When generating the EPG, the app checks this cache first and only calls TMDB for missing entries. Mount `/data` read-write (omit `:ro`) so the cache can be written. - **Rate limit:** TMDB allows 40 requests per 10 seconds. The app enforces this limit when calling the API; if the cache is warm, few or no requests are made during EPG generation. -**Logging:** Set `LOG_LEVEL=DEBUG` (e.g. in your `docker run` with `-e LOG_LEVEL=DEBUG`) to see where time is spent: schedule building (including ffprobe per video), EPG per-channel programme count and duration, and TMDB cache hits (memory/disk) vs API requests and rate-limit waits. +**Logging:** Set `LOG_LEVEL=DEBUG` (e.g. in your `docker run` with `-e LOG_LEVEL=DEBUG`) to see where time is spent: schedule building (including ffprobe per video), EPG per-channel programme count and duration, TMDB cache hits (memory/disk) vs API requests and rate-limit waits, and EPG cache hit/miss reasons. + +**Cache locations** (under `/data`): +- EPG: `/data/cache/epg.xml` — XMLTV guide; valid only while `channels.json` is unchanged. +- Schedule: `/data/cache/schedule_.json` — per-channel video schedules. **Stream crashes when switching episodes?** If the live stream freezes or crashes when transitioning between videos (e.g. different episodes with different resolutions), enable normalization to re-encode everything to a uniform format: - `NORMALIZE_LIVE_STREAM=1` — enables re-encoding (uses more CPU, produces a stable continuous stream) diff --git a/Dockers/self-hosted-iptv/iptv/cache.py b/Dockers/self-hosted-iptv/iptv/cache.py index 481aa3b..ef8cffc 100644 --- a/Dockers/self-hosted-iptv/iptv/cache.py +++ b/Dockers/self-hosted-iptv/iptv/cache.py @@ -120,12 +120,18 @@ class CacheManager: self.invalidate_if_needed() current = get_channels_hash(self._channels_file) if current is None: + logger.debug("EPG cache miss: channels.json not found or unreadable") return None epg_path = self._epg_cache_file() if not epg_path.exists(): + logger.debug("EPG cache miss: %s does not exist", epg_path) return None stored = self._get_stored_hash() + if stored is None: + logger.debug("EPG cache miss: %s does not exist (hash required)", self._hash_file()) + return None if stored != current: + logger.debug("EPG cache miss: channels.json changed (hash %s -> %s)", stored[:16], current[:16]) return None try: return epg_path.read_text(encoding="utf-8")