Dispatcharr/apps/epg/tests
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
..
fixtures test(epg,frontend): add coverage for current-program lookup and preview behavior 2026-05-31 17:13:11 +02:00
__init__.py feat: add subtitle and season/episode to TV guide 2026-03-05 23:41:16 -06:00
test_current_programs_api.py test(epg,frontend): add coverage for current-program lookup and preview behavior 2026-05-31 17:13:11 +02:00
test_entity_resolution.py Enhancement: Update changelog to reflect changes in ChannelPagination, ensuring pagination works correctly with only page_size provided. Refactor tests to improve reliability and consistency, including adjustments to database connection management in various test cases. Modify EPG name normalization tests for accuracy and clarity, and enhance program data serializer tests to utilize precomputed season and episode values. 2026-07-07 18:30:06 +00:00
test_epg_import_api.py refactor(epg): separate programme index into dedicated table for optimized data handling 2026-06-23 15:10:27 -05:00
test_epg_search_api.py Enhancement: Update changelog to reflect changes in ChannelPagination, ensuring pagination works correctly with only page_size provided. Refactor tests to improve reliability and consistency, including adjustments to database connection management in various test cases. Modify EPG name normalization tests for accuracy and clarity, and enhance program data serializer tests to utilize precomputed season and episode values. 2026-07-07 18:30:06 +00:00
test_epg_source_file_lock.py fix(epg): Enhance EPG data refresh and parsing logic to prevent data loss and improve concurrency handling. Implement deferred processing for ongoing tasks, ensuring stability during refresh operations. Update changelog with significant fixes and improvements. 2026-07-02 13:34:53 -05:00
test_fetch_xmltv_xz.py feat(epg): add native xz decompression support for EPG sources 2026-07-07 19:48:44 -05:00
test_parse_programs_for_source.py fix(epg): Enhance EPG data refresh and parsing logic to prevent data loss and improve concurrency handling. Implement deferred processing for ongoing tasks, ensuring stability during refresh operations. Update changelog with significant fixes and improvements. 2026-07-02 13:34:53 -05:00
test_parse_programs_for_tvg_id.py Enhancement: Update changelog to reflect changes in ChannelPagination, ensuring pagination works correctly with only page_size provided. Refactor tests to improve reliability and consistency, including adjustments to database connection management in various test cases. Modify EPG name normalization tests for accuracy and clarity, and enhance program data serializer tests to utilize precomputed season and episode values. 2026-07-07 18:30:06 +00:00
test_parsing_channels_progress.py feat(epg): Implement channel parsing progress tracking and update progress reporting logic in parse_channels_only function 2026-07-01 17:07:47 -05:00
test_programme_index.py fix(epg): Enhance EPG data refresh and parsing logic to prevent data loss and improve concurrency handling. Implement deferred processing for ongoing tasks, ensuring stability during refresh operations. Update changelog with significant fixes and improvements. 2026-07-02 13:34:53 -05:00
test_refresh_db_recovery.py fix(epg): enhance DB connection management and error handling during EPG refreshes 2026-06-18 16:39:52 -05:00
test_schedules_direct.py Refactor Schedules Direct EPG handling and enhance guide fetch logic 2026-06-11 16:41:30 -05:00
test_serializers.py Enhancement: Update changelog to reflect changes in ChannelPagination, ensuring pagination works correctly with only page_size provided. Refactor tests to improve reliability and consistency, including adjustments to database connection management in various test cases. Modify EPG name normalization tests for accuracy and clarity, and enhance program data serializer tests to utilize precomputed season and episode values. 2026-07-07 18:30:06 +00:00
test_xz_support.py feat(epg): add native xz decompression support for EPG sources 2026-07-07 19:48:44 -05:00