Dispatcharr/apps/epg
Curt LeCaptain 408c3c6bea feat(epg): add native xz decompression support for EPG sources
Adds .xz to the set of compressed formats detect_file_format(),
extract_compressed_file(), fetch_xmltv(), and EPGSource.get_cache_file()
recognize, mirroring the existing gzip handling. Uses stdlib lzma, no new
dependency. Detection works via LZMA magic bytes (fd 37 7a 58 5a 00),
the .xz extension (including compound extensions like .xml.xz), and the
application/x-xz mimetype fallback.

Widened the magic-byte read in get_cache_file() from 4 to 6 bytes since
the xz signature is 6 bytes (the previous 4-byte read was sufficient
only for the 2-byte gzip/zip signatures it originally supported). That
widening silently broke the bare-<tv> raw-XML detection: the
fixed-length slice comparison header[:5] == b'<tv>' can never match a
5-byte slice of a 6-byte header against a 4-byte literal. Replaced the
fixed-length slice comparisons with header.startswith(...), which is
correct regardless of how many bytes are read - this also fixes the
adjacent <?xml declaration check, which was silently dead before this
change (a 4-byte read could never equal the 5-byte b'<?xml' literal
either).

Fixes Dispatcharr/Dispatcharr#1414

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 19:48:44 -05:00
..
migrations refactor(epg): separate programme index into dedicated table for optimized data handling 2026-06-23 15:10:27 -05:00
tests feat(epg): add native xz decompression support for EPG sources 2026-07-07 19:48:44 -05:00
__init__.py Initial commit 2025-02-18 11:14:09 -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 fix(epg): fix and clean up EPG program search API and tests 2026-04-24 14:37:12 -05:00
api_views.py enhancement(epg): add export lookback and cutoff parameters to EPG generation 2026-06-23 15:27:15 -05:00
apps.py Revert unintended whitespace changes in apps.py and Channel.jsx 2026-05-31 17:13:11 +02:00
models.py feat(epg): add native xz decompression support for EPG sources 2026-07-07 19:48:44 -05:00
query_utils.py feat: Enhance series rule evaluation and management 2026-05-04 20:45:40 -05:00
serializers.py fix(epg): repair SD poster display and backfill missing artwork 2026-06-04 22:00:15 -05:00
signals.py feat(epg): add Schedules Direct API integration 2026-05-17 04:52:07 +00:00
tasks.py feat(epg): add native xz decompression support for EPG sources 2026-07-07 19:48:44 -05:00
urls.py Pre-Alpha v4 2025-02-24 15:04:03 -06:00
utils.py feat(guide): redesign guide with detail modal, progress bars, and season/episode display 2026-03-10 10:53:19 -05:00
views.py Pre-Alpha v4 2025-02-24 15:04:03 -06:00