Commit graph

1376 commits

Author SHA1 Message Date
SergeantPanda
37cc72a040 Merge branch 'dev' of https://github.com/Dispatcharr/Dispatcharr into pr/sethwv/1336 2026-06-11 12:31:39 -05:00
SergeantPanda
205deb150b Implement schedule MD5 delta detection and backfill logic for improved cache management
- Added functions to compute schedule changes based on MD5 hashes and backfill missing dates for mapped stations.
- Enhanced handling of orphaned ProgramData records for unmapped EPG entries during schedule fetch.
- Introduced unit tests to validate MD5 comparison, backfill logic, and metadata fetching requirements.
2026-06-11 12:31:30 -05:00
SergeantPanda
843940f552 refactor(http headers): centralize User-Agent construction and streamline API requests
- Introduced `dispatcharr_user_agent`, `dispatcharr_dvr_user_agent`, and `dispatcharr_http_headers` functions in `core.utils` to standardize User-Agent strings and HTTP headers for outbound requests.
- Updated various components, including `LogoViewSet`, `EPGSourceViewSet`, and VOD proxy views, to utilize the new header functions, ensuring consistent User-Agent usage across the application.
- Enhanced the handling of Schedules Direct API requests by including proper User-Agent headers, addressing previous API compliance issues.
2026-06-11 09:45:35 -05:00
SergeantPanda
ed364a26c9 refactor(EPGSourceViewSet, frontend): streamline SD countries fetching and remove proxy endpoint
- Introduced a new method `_fetch_sd_countries` in `EPGSourceViewSet` to fetch SD countries directly from the backend, eliminating the need for a separate proxy endpoint.
- Updated the `sd_lineups` action to include the fetched countries in the response.
- Removed the `getSDCountries` method from the API and adjusted the frontend to fetch countries alongside lineups, improving efficiency
- Updated related components to handle the new data structure for countries.
2026-06-11 09:00:35 -05:00
Seth Van Niekerk
bfa7019324
force-fetch SD schedules for newly mapped stations with no existing ProgramData 2026-06-10 10:53:09 -04:00
Seth Van Niekerk
887a177581
proxy SD country list fetch through backend to fix CORS failure 2026-06-10 08:46:02 -04:00
SergeantPanda
95975d5756 refactor(connection_pool): streamline credential slot management
- Removed redundant logic for releasing server group slots in `move_credential_slot_on_profile_switch` and `release_profile_slot`.
- Simplified the `_release_server_group_slot_for_profile` function by eliminating it, as its functionality was integrated into other methods.
2026-06-09 18:38:52 -05:00
SergeantPanda
4fc12bca4a refactor(m3u, channels, proxy): enhance stream assignment logic and error handling
- Improved logging in the Stream model for better debugging of profile evaluations.
- Introduced a new method `_stream_assignment_is_reusable` in the Channel model to determine if existing stream assignments can be reused, enhancing efficiency.
- Updated the release logic in `release_profile_slot` to utilize stored credential keys, reducing unnecessary database lookups.
- Simplified error handling in the `get_stream_info_for_switch` function to ensure proper stream release on exceptions.
- Enhanced tests for connection pool management and error handling in the ServerGroupsTable component to improve reliability and user feedback.
2026-06-09 17:59:12 -05:00
SergeantPanda
705041ea81 refactor(channel_status, vod_proxy): remove stream URL credential extraction
- Eliminated redundant extraction of provider usernames from stream URLs in both ChannelStatus and VOD stats data functions, simplifying the codebase.
- Updated frontend components to reflect the removal of provider username display, streamlining the UI.
- Enhanced overall readability and maintainability of the code by reducing complexity in handling stream URLs.
2026-06-09 14:46:26 -05:00
SergeantPanda
bc046b3c92 refactor(m3u, channels): streamline stream assignment and server group management
- Renamed `_clear_stream_assignment_keys` to `_release_stale_stream_assignment` for clarity and updated its logic to release pool counters.
- Introduced new functions for managing credential slots during profile switches, enhancing the handling of shared connection limits across server groups.
- Removed the `max_streams` field from the `ServerGroup` model and updated related components to reflect this change, simplifying the server group management.
- Updated frontend components to integrate server group management, allowing for dynamic creation and editing of server groups.
- Enhanced error handling in stream URL generation to provide more informative feedback on connection issues.
- Added tests for stale assignment release and credential management during profile switches.
2026-06-09 13:40:16 -05:00
SergeantPanda
0f0e855507 Merge branch 'dev' of https://github.com/Dispatcharr/Dispatcharr into pr/Goldenfreddy0703/1254 2026-06-09 11:16:39 -05:00
SergeantPanda
7086f41d64 feat(epg): overhaul EPG auto-matching logic and improve performance
- Moved matching logic to a dedicated module for better organization and testability.
- Made single-channel auto-matching asynchronous, allowing for larger EPG libraries without hitting HTTP timeouts.
- Enhanced memory management and throughput during EPG matching, including optimizations for fuzzy matching and bulk processing.
- Fixed various reliability issues in the auto-matching process, ensuring accurate channel assignments and improved UI feedback.
- Updated API views and frontend components to reflect changes in the matching process and provide real-time notifications.
- Added tests for EPG matching functionality and name normalization.
- Single-channel and selected-channel auto-match always run, even when the channel already has EPG assigned; match-all (no channel IDs) still only processes channels without EPG.
2026-06-08 18:12:29 -05:00
SergeantPanda
f0c69fd286 refactor(epg): optimize logo URL generation for EPG channels
- Precompute base URL and logo path components once per request to reduce redundant calls to `build_absolute_uri_with_port()`, enhancing performance.
- Update logo URL construction for both cached and direct logos to utilize the precomputed values, ensuring consistency and efficiency in URL handling.
2026-06-07 14:45:59 -05:00
SergeantPanda
86f39cb7f1 refactor(m3u): optimize URL generation for M3U streams and logos
- Precompute base URLs for M3U stream and logo paths to reduce redundant calls to `build_absolute_uri_with_port()`, improving performance.
- Update the generation of EPG and stream URLs to utilize the precomputed base URL, ensuring consistency and efficiency in URL handling.
- Enhance the handling of logo URLs by consolidating logic for cached and direct logo retrieval, streamlining the process and reducing overhead.
2026-06-07 14:38:44 -05:00
SergeantPanda
a8a3c70e55 fix(api): update HDHR URLs to use port-aware URI builder
- Refactored HDHR API views to utilize `build_absolute_uri_with_port()` for generating URLs, ensuring correct handling of non-standard ports in lineup and discovery responses.
2026-06-07 14:27:57 -05:00
SergeantPanda
b928de7d50 fix(epg): resolve EPG channel list refresh issue after parsing completion
- Addressed a bug where the EPG channel list did not refresh after a source finished parsing channels due to the `epg_refresh` WebSocket handler using a stale snapshot. The handler now correctly reads the current store state and ensures `fetchEPGData()` is called upon completion of channel parsing.
- Updated tests to verify that the frontend receives the correct parsing completion signals.
2026-06-07 09:56:25 -05:00
SergeantPanda
270d0479b4
Merge pull request #1323 from CodeBormen/fix/compact-numbering-idempotency
fix(channels): make compact numbering repack idempotent
2026-06-06 17:49:42 -05:00
SergeantPanda
3d8fe8f1e9
Merge pull request #1317 from sv-dispatcharr/feat/new-plugins-url
migrate official plugin repo URL to GitHub Pages
2026-06-06 17:26:44 -05:00
SergeantPanda
7d6bef5507 Enhancement: Enhance DVR recording reliability and error tolerance
- Improve DVR recording stability by ensuring FFmpeg restarts on mid-stream outages, maintaining segment continuity and proper numbering.
- Update HLS→MKV concatenation to handle timestamp splices and corrupt segments, utilizing error-tolerant FFmpeg flags.
- Introduce helper functions for managing HLS segment counts and retry logic, ensuring robust handling of recording interruptions.
- Update tests to validate new retry logic and error handling in recording processes. (Closes #1170)
2026-06-05 16:14:23 -05:00
SergeantPanda
70d900f346 feat(epg): implement auto-apply functionality for EPG logos
Add support for automatically applying channel logos from EPG data during refresh. Introduce a new toggle in the UI for enabling/disabling this feature, and update the backend to handle both channel IDs and EPG source IDs for logo application. Enhance the logo application task to process large libraries efficiently in chunks, improving performance and memory usage. Update changelog to reflect these changes.
2026-06-05 12:49:05 -05:00
SergeantPanda
e25d470565 feat(epg): add force option back to parse_programs_for_tvg_id function 2026-06-05 10:48:40 -05:00
SergeantPanda
87b8035e06 refactor(epg): replace synchronous WebSocket send function with unified send_epg_update
Remove the _sd_send_ws_sync function and replace its usage with send_epg_update in the fetch_schedules_direct function. This change simplifies the code by ensuring all WebSocket updates are sent through a single function, improving maintainability and consistency in handling EPG updates.
2026-06-05 10:42:39 -05:00
SergeantPanda
7e906ad78e feat(epg): enhance poster style selection and fetching logic
Introduce a new poster style selection feature in the EPG settings, allowing users to choose their preferred artwork style. Update the logic for fetching and displaying program artwork from Schedules Direct, ensuring that the selected style is honored with appropriate fallbacks. Set default poster art to 'primary'. Add comprehensive tests to validate the poster selection functionality across various scenarios.
2026-06-05 10:14:07 -05:00
SergeantPanda
ff081d7dc8 feat(epg): implement poster artwork fetching and logo auto-apply functionality
Add a new task to fetch program artwork from Schedules Direct and auto-apply logos to channels based on EPG data. Enhance the existing logic to handle poster backfill and update program records with fetched artwork. Readd the WebSocket handler to manage IP lookup events and adjust the EPGsTable component to display relevant credentials based on the source type.
2026-06-05 09:28:55 -05:00
SergeantPanda
4eab95793e refactor: rename useSDLogos to autoApplySDLogos for clarity
Update the variable name in the EPG settings to better reflect its purpose. Adjust related logic in the UI to ensure consistent handling of the auto-apply feature for SD logos.
2026-06-05 09:08:26 -05:00
None
cae040d45d fix(channels): make compact numbering repack idempotent
The compact repack read its channels with no ORDER BY, so the pack followed PostgreSQL's physical row order. That order drifts after the
UPDATEs each repack issues, so successive syncs
packed the same channels into different numbers within the configured range. Auto-synced channel numbers reshuffled on every sync even when the provider had not changed.

- Add .order_by("id") to the _repack_inner channel query so the pack is deterministic. id order is creation order, which tracks the provider stream order used by the default "provider" sort.
- Add c.id as a secondary key to the name / tvg_id / updated_at sorts so equal values (e.g. blank tvg_id) break ties deterministically instead of churning.
- Add a deterministic regression test that forces a physical heap reorder (CLUSTER) and asserts two consecutive repacks produce identical channel numbers.
2026-06-05 00:01:22 -05:00
SergeantPanda
c4d73eae39 fix(epg): repair SD poster display and backfill missing artwork
Build absolute poster proxy URLs via build_absolute_uri_with_port so
program detail images resolve correctly in dev and behind reverse
proxies. Backfill sd_icon for programs when poster fetch is enabled
but a delta refresh skips program metadata. Add a dev-mode frontend
fallback for relative image paths and correct the poster caching
description in the SD settings UI.
2026-06-04 22:00:15 -05:00
SergeantPanda
3835954024 fix: enhance API request headers and improve cast handling in schedule fetching
Add User-Agent header to API requests in ProgramViewSet for better tracking. Update cast processing logic in fetch_schedules_direct to align with XMLTV standards, ensuring proper categorization of main cast and guest stars.
2026-06-04 21:30:05 -05:00
Shokkstokk
aa9e78f858 fix: allow unauthenticated access to SD poster proxy endpoint
ProgramViewSet.get_permissions() was falling through to Authenticated()
for the poster action since it wasn't in permission_classes_by_action.
Add explicit AllowAny check for the poster action.
2026-06-05 00:12:17 +00:00
Goldenfreddy0703
abdf2d7864 Fix credential release on deleted profile and round 3 review items.
Store credential Redis keys at reserve so release works when the profile row is deleted. Return reserve failure reasons to avoid fingerprint DB queries on logging paths. Document unlimited profile bypass in pool logic and Server Group UI.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-04 19:51:20 -04:00
Shokkstokk
7c91508f3c fix: add missing updateSDSettings API method and EPG refresh handlers
Add updateSDSettings method to API client for SD logo style and settings
management. Add fetchEPGData and requeryChannels calls after EPG match
completion to ensure UI refreshes immediately. Add SD logo style picker
and cache-busting for channel logos.
2026-06-04 23:46:40 +00:00
mwhit
661d1690d2 feat: expose SD enrichment fields in serializer and frontend
Add content_advisory, content_ratings, event_details, runtime to
ProgramDetailSerializer. Display content advisory, sports venue/teams,
and first-aired date in ProgramDetailModal.
2026-06-04 22:28:18 +00:00
SergeantPanda
ac3a83a1aa fix: Fix removed code from bad merge. 2026-06-04 15:37:27 -05:00
SergeantPanda
30843c0c4c fix: Fix migrations 2026-06-04 15:20:14 -05:00
SergeantPanda
8f060e8b3a feat: Output SD program poster images during xml output and enhance caching logic 2026-06-04 15:17:58 -05:00
mwhit
763d1430fd fix: add channel_group_id to M3U stream bulk_update fields
Streams matched by hash during refresh were not updating channel_group_id,
causing cleanup to delete all streams when group IDs change (e.g., after
migration reset). Adds channel_group_id to comparison, assignment, only()
fetch, and bulk_update in both standard and XC processing paths.
2026-06-04 04:14:23 +00:00
mwhit
b6afcafc98 feat: SD data enrichment, artwork improvement, and bug fixes
- Fix channel_group_id not updating on M3U stream refresh
- Fix SD content rating region selection (country-aware filtering)
- Fix SD season/episode metadata iteration
- Add SD data enrichment: entityType, showType, contentAdvisory, originalAirDate, country, runtime, star ratings, event details, character names
- Cap cast to top-billed, remove role noise
- Switch artwork preference to Banner-L1 (branded key art)
- Add content advisory, sports details, runtime to program detail modal
- Logo cache-busting for browser cache invalidation
- SD API compliance: rolling 24h lineup reset, tokenExpires caching, error caching
2026-06-04 03:40:22 +00:00
Shokkstokk
4eec542ef8
Merge branch 'dev' into feature/schedules-direct-epg 2026-06-03 23:38:54 -04:00
Seth Van Niekerk
37e11c8fc4
migrate official plugin repo URL to GitHub Pages 2026-06-03 12:36:07 -04:00
SergeantPanda
60a9f6843b refactor: simplify initialization wait logic by removing keepalive packet handling (Fixes #1280) 2026-06-02 20:54:59 -05:00
SergeantPanda
2dc07bbe84
Merge pull request #1315 from R3XCHRIS:fix/vod-streamid-fallback-on-dead-uuid
fix(vod_proxy): fall back to stream_id when content UUID is dead (#961)
2026-06-02 20:32:11 -05:00
R3XCHRIS
ff60bbec1a fix(vod_proxy): fall back to stream_id when content UUID is dead
Issue: When `process_movie_batch` / `process_series_batch`
(apps/vod/tasks.py) creates duplicate vod_movie / vod_episode records
during a refresh, existing M3U*Relation rows get repointed to the new
records. The old UUIDs that external players (Emby / Jellyfin /
ChannelsDVR) cached in `.strm` URLs are left orphaned, and the proxy
404s on every subsequent request — even though the same request
already carries a stable `stream_id` that uniquely identifies a live
relation.

This patch makes `_get_content_and_relation` use a soft UUID lookup
and, if it misses, fall back to resolving content via
`M3UMovieRelation.stream_id` / `M3UEpisodeRelation.stream_id`. The
fallback respects the strictest match first: when
`preferred_m3u_account_id` is also present, that account is queried
first; otherwise the highest-priority active relation matching the
stream_id wins (same ordering the existing relation-selection logic
uses).

This is read-side graceful degradation, complementary to the
write-side root fix proposed in closed #973 (re-use the relation's
existing movie/series during refresh rather than rematching by TMDB
ID). The two PRs together would fully resolve #961: #973 prevents new
orphaning, this PR makes any URL that ships a stream_id survive past
orphaning. URLs without a stream_id (e.g. XC-compat
`/movie/<user>/<pass>/<id>.mkv`) are NOT covered by this patch — they
need the root fix.

Series-UUID lookups (`/proxy/vod/series/<UUID>`) are left UUID-only by
design — players cache episode and movie URLs, not series URLs. Same
pattern can be added as a follow-up if needed.

Tests: 7 new mock-based regression tests covering both branches,
verified against `:dev`. UUID-first happy path is unchanged
(M3U*Relation table never queried when the UUID resolves).

Related: #961 (open), closed #973 (root fix abandoned for inactivity).
2026-06-02 19:29:58 +01:00
None
2a5889f5b2 fix(channels): Channel Group Override interactions
- Compact numbering: resolve the source relation when an override stores channels under the target group, so hiding releases the slot, unhiding assigns one, and repack sees the channels (no more spurious RANGE_EXHAUSTED). Type-safe override match; the bulk path stays single-query on the common path.
- Channel form: keep the clear-override control available when an override's value equals the provider value (isFormFieldOverridden is now existence-aware).
- Tests: compact override hide/unhide/repack, no-override fast-path guard, repack query-scaling guard, and existence-aware override detection.
2026-06-02 00:04:44 -05:00
SergeantPanda
8e03427844 Merge branch 'dev' of https://github.com/Dispatcharr/Dispatcharr into pr/FiveBoroughs/938 2026-06-01 18:58:14 -05:00
SergeantPanda
ec06a52fd4 refactor(epg): change logger level from info to debug for building byte-offset index 2026-06-01 18:58:00 -05:00
SergeantPanda
ddd1105d5b security: Remove post body from response. 2026-05-31 16:20:55 -05:00
Five Boroughs
374c05952b
test(epg): cover real EPG source formats and index lookup edge cases 2026-05-31 22:26:39 +02:00
Five Boroughs
f8919b0d98
fix(epg): handle attr-spacing and named entities in index lookup, unblock boot rebuild 2026-05-31 21:57:26 +02:00
SergeantPanda
712fb08563 fix(epg): prune expired SDScheduleMD5 and ProgramData records to optimize storage. Add program_id field to programdata table for tracking. 2026-05-31 12:02:58 -05:00
SergeantPanda
5d2bc2606c fix(epg): add force refresh option for EPG data import and update related API methods 2026-05-31 11:22:04 -05:00