Commit graph

873 commits

Author SHA1 Message Date
SergeantPanda
c03ddf60a0 Fixed verbiage for epg parsing status. 2025-12-07 21:28:04 -06:00
SergeantPanda
759569b871 Enhancement: Add a priority field to EPGSource and prefer higher-priority sources when matching channels. Also ignore EPG sources where is_active is false during matching, and update serializers/forms/frontend accordingly.(Closes #603, #672) 2025-12-05 09:54:11 -06:00
SergeantPanda
3b34fb11ef Fix: Fixes bug where Updated column wouldn't update in the EPG table without a webui refresh. 2025-12-04 15:43:33 -06:00
SergeantPanda
5693ee7f9e perf: optimize EPG program parsing and implement atomic database updates to reduce I/O overhead and prevent partial data visibility 2025-12-04 14:57:57 -06:00
SergeantPanda
256ac2f55a Enhancement: Clean up orphaned programs for unmapped EPG entries 2025-12-04 14:25:44 -06:00
SergeantPanda
2a8ba9125c perf: optimize EPG program parsing for multi-channel sources
Dramatically improve EPG refresh performance by parsing the XML file once
per source instead of once per channel. The new implementation:

- Pre-filters to only process EPG entries mapped to actual channels
- Parses the entire XML file in a single pass
- Uses O(1) set lookups to skip unmapped channel programmes
- Skips non-mapped channels entirely with minimal overhead

For EPG sources with many channels but few mapped (e.g., 10,000 channels
with 100 mapped to channels), this provides approximately:
- 99% reduction in file open operations
- 99% reduction in XML file scans
- Proportional reduction in CPU and I/O overhead

The parse_programs_for_tvg_id() function is retained for single-channel
use cases (e.g., when a new channel is mapped via signals).

Fixes inefficient repeated file parsing that was occurring with large
EPG sources.
2025-12-04 14:07:28 -06:00
SergeantPanda
042612c677 Merge branch 'dev' of https://github.com/Dispatcharr/Dispatcharr into pr/bobey6/707 2025-12-03 16:49:21 -06:00
GitHub Copilot
641dcfc21e Add sorting functionality to Group and M3U columns in Streams table
- Added m3u_account__name to backend ordering_fields in StreamViewSet
- Implemented field mapping in frontend to convert column IDs to backend field names
- Added sort buttons to both Group and M3U columns with proper icons
- Sort buttons show current sort state (ascending/descending/none)
- Maintains consistent UX with existing Name column sorting
2025-11-30 19:20:25 +00:00
SergeantPanda
2b58d7d46e Enhancement: Ensure "Uncategorized" categories and relations exist for VOD accounts. This improves content management for movies and series without assigned categories. Closes #627 2025-11-25 17:14:51 -06:00
SergeantPanda
13ad62d3e1 Bug Fix: Fix bug where previewing a stream would always select the default m3u profile regardless of utilization. 2025-11-25 13:07:49 -06:00
SergeantPanda
7673cd0793 fix: Convert float channel numbers to integers for XC client compatibility
XC (Xtream Codes) clients require integer channel numbers and fail to parse
float values (e.g., 100.5). This change implements collision-free mapping
that converts floats to integers while preserving existing integer channel
numbers where possible.

Changes:
- Implemented two-pass collision detection algorithm that assigns integers
  to float channel numbers by incrementing until an unused number is found
- Applied mapping to all XC client interfaces: live streams API, EPG API,
  and XMLTV endpoint
- Detection: XC clients identified by authenticated user (user is not None)
- Regular M3U/EPG clients (user is None) continue to receive float channel
  numbers without modification

Example: Channels 100, 100.5, 100.9, 101 become 100, 101, 102, 103 for XC
clients, ensuring no duplicate channel numbers and full compatibility.
2025-11-22 09:01:46 -06:00
SergeantPanda
aae7b1bc14 Enhancement: Refactor xc_player_api to streamline action handling and ensure consistent responses for unknown actions 2025-11-21 16:49:45 -06:00
SergeantPanda
aa9fa09822 Fix: Improve date parsing logic in generate_custom_dummy_programs to handle empty or invalid inputs 2025-11-21 14:19:35 -06:00
SergeantPanda
c5f6d8ccf3 Enhancement: Update xc_player_api to return server_info for unknown actions to align with provider behavior 2025-11-21 10:57:35 -06:00
SergeantPanda
cb1953baf2 Enhancement: Implement comprehensive logging for user authentication events and network access restrictions 2025-11-21 10:50:48 -06:00
SergeantPanda
d94d615d76 Fix: Handle missing channel profiles in m3u and EPG generation with appropriate error logging 2025-11-20 18:54:32 -06:00
SergeantPanda
89a23164ff Enhancement: Add system event logging and viewer with M3U/EPG endpoint caching
System Event Logging:
- Add SystemEvent model with 15 event types tracking channel operations, client connections, M3U/EPG activities, and buffering events
- Log detailed metrics for M3U/EPG refresh operations (streams/programs created/updated/deleted)
- Track M3U/EPG downloads with client information (IP address, user agent, profile, channel count)
- Record channel lifecycle events (start, stop, reconnect) with stream and client details
- Monitor client connections/disconnections and buffering events with stream metadata

Event Viewer UI:
- Add SystemEvents component with real-time updates via WebSocket
- Implement pagination, filtering by event type, and configurable auto-refresh
- Display events with color-coded badges and type-specific icons
- Integrate event viewer into Stats page with modal display
- Add event management settings (retention period, refresh rate)

M3U/EPG Endpoint Optimizations:
- Implement content caching with 5-minute TTL to reduce duplicate processing
- Add client-based event deduplication (2-second window) using IP and user agent hashing
- Support HEAD requests for efficient preflight checks
- Cache streamed EPG responses while maintaining streaming behavior for first request
2025-11-20 17:41:06 -06:00
SergeantPanda
204a5a0c76
Merge pull request #659 from FiveBoroughs/fix/channel-stream-order-serialization
Fix: Preserve stream order in ChannelSerializer PATCH/PUT responses
2025-11-19 15:59:38 -06:00
SergeantPanda
968a8f1cd0 Merge branch 'dev' of https://github.com/Dispatcharr/Dispatcharr into dev 2025-11-18 10:02:47 -06:00
SergeantPanda
b6c3234e96 Enhancement: Improve zombie channel handling in ProxyServer by checking client connections and cleaning up orphaned metadata, ensuring better resource management and stability. 2025-11-18 10:02:35 -06:00
SergeantPanda
afedce5cb2 Enhancement: Implement background profile refresh task with rate limiting to prevent provider bans during account profile updates. 2025-11-18 09:27:22 -06:00
SergeantPanda
1b16df4482 Enhancement: Improve batch EPG association in ChannelViewSet by adding validation for associations and implementing bulk updates, enhancing performance and error handling. 2025-11-17 17:41:52 -06:00
SergeantPanda
1560afab97 Enhancement: Optimize bulk channel editing in ChannelViewSet by validating updates first and applying them in a single transaction, improving performance by about 50% and error handling. 2025-11-17 17:33:10 -06:00
FiveBoroughs
bbe1f6364b Fix: Preserve stream order in ChannelSerializer PATCH/PUT responses
The ChannelSerializer.to_representation() method was not respecting the
ChannelStream.order field when serializing PATCH/PUT responses. This
caused streams to be returned in an arbitrary order rather than the
order specified in the request.

The update() method correctly saves the stream order to the database
using the ChannelStream.order field, and GET requests (with
include_streams=True) correctly return ordered streams via
get_streams(). However, standard PATCH/PUT responses were using
PrimaryKeyRelatedField which doesn't respect the ordering.

This fix ensures that all representations (GET, PATCH, PUT) return
streams ordered by the channelstream__order field.

Impact:
- PATCH/PUT responses now correctly reflect the stream order saved
- Clients can trust the response data without needing a follow-up GET
- No breaking changes - only fixes inconsistent behavior

Tested with:
- PATCH request with ordered stream IDs
- Verified response matches request order
- Verified GET request confirms order persisted to database
2025-11-16 23:29:17 +01:00
SergeantPanda
6bd5958c3c Enhancement: Improve channel shutdown logic in ProxyServer to handle connection timeouts and grace periods more effectively, ensuring proper channel management based on client connections. 2025-11-15 14:22:26 -06:00
SergeantPanda
2514528337 Enhancement: Update channel state handling in ProxyServer and views to include 'STOPPING' state, ensuring proper cleanup and preventing reinitialization during shutdown. 2025-11-14 19:57:59 -06:00
SergeantPanda
ed7e16483b Merge branch 'dev' of https://github.com/Dispatcharr/Dispatcharr into pr/maluueu/166 2025-11-14 17:11:00 -06:00
SergeantPanda
6e79b37a66 When stream_type is UDP do not add user_agent to FFmpeg command. 2025-11-13 14:04:46 -06:00
SergeantPanda
4720e045a3 Implement manual redirect for non-HTTP protocols (RTSP/RTP/UDP) in stream URL handling 2025-11-12 17:31:27 -06:00
SergeantPanda
a3c16d48ec Skip HTTP validation for non-HTTP protocols (UDP/RTP/RTSP) in stream URL validation 2025-11-12 16:17:06 -06:00
SergeantPanda
b9e819e343 Enhancement: Adds support for UDP streams. Closes #617 2025-11-11 18:30:59 -06:00
SergeantPanda
a7f449f746
Merge pull request #565 from ragchuck:enable-rtsp
feat: added support for rtsp
2025-11-11 17:29:03 -06:00
SergeantPanda
b608af1d51 Auto detect RTSP streams when proxy profile is selected and force FFmpeg. 2025-11-11 17:26:56 -06:00
SergeantPanda
dc22dff713 Bug Fix: Refactor parse_extinf_line to improve attribute extraction and display name handling. Fixes #637 2025-11-11 16:11:42 -06:00
SergeantPanda
da628705df Separate VOD and channel logos into distinct tables with dedicated management UI
- Created VODLogo model for movies/series, separate from Logo (channels only)
- Added database migration to create vodlogo table and migrate existing VOD logos
- Implemented VODLogoViewSet with pagination, filtering (used/unused/movies/series), and bulk operations
- Built VODLogosTable component with server-side pagination matching channel logos styling
- Added VOD logos tab with on-demand loading to Logos page
- Fixed orphaned VOD content cleanup to always remove unused entries
- Removed redundant channel_assignable filtering from channel logos
2025-11-07 13:19:18 -06:00
SergeantPanda
871f9f953e Another attempt for the get_host_and_port function to better handle port detection behind reverse proxies. 2025-11-05 16:23:13 -06:00
SergeantPanda
77e98508fb Enhancement: Refactor get_host_and_port for smarter port selection when using reverse proxies. Fixes #618 2025-11-04 19:08:31 -06:00
SergeantPanda
e6146e5243 Bug fix: Reduce websocket message size when processing epgs. Also remove unnecessary console logging during epg refresh. Fixes [Bug]: Page goes blank if sending too many requests / responses
Fixes #327
2025-11-04 18:23:45 -06:00
SergeantPanda
12aae44672 Enhancement: For custom dummy epg's, use correct date for placeholders if provided. 2025-11-01 13:39:55 -05:00
SergeantPanda
c7e955b4a8
Merge pull request #604 from Dispatcharr:proxy-client-ttl
Enhance client record TTL settings and periodic refresh during streaming
2025-10-31 13:00:07 -05:00
SergeantPanda
6715bc7c5c Enhancement: Update TTL settings for client records and implement periodic refresh during active streaming 2025-10-31 11:53:16 -05:00
SergeantPanda
1b282f1987
Merge pull request #594 from 0x53c65c0a8bd30fff/truncated-channel-titles-fix
Channel name truncation when containing apostrophes or special characters
2025-10-30 16:53:30 -05:00
lasharor
400c77f258
Update views.py
I moved on to LXC install on PVE. The x-tvg-url defaults back to 9191 port whilst in reality the port is defined as :80, therefore this obviously brakes this functionality. 

Check request.META.get("SERVER_PORT") before falling back to defaults. This should capture the actual server port from the request.
2025-10-30 22:25:13 +01:00
SergeantPanda
9d4fd63cde Enhancement: Add date placeholders for custom dummy EPG based on output and source timezones. Closes #597 2025-10-30 16:13:45 -05:00
SergeantPanda
0741e45ce6 Enhancement: Add custom fallback templates for dummy EPG generation to handle unmatched patterns 2025-10-30 14:57:32 -05:00
SergeantPanda
c9d7e66545 Enhancement: Add {starttime_long} and {endtime_long} to custom dummy EPG. 2025-10-29 17:21:37 -05:00
SergeantPanda
28c211cd56 Enhancement: Add {endtime} as an available output for custom dummy epg. Convert {time} to {starttime}
Closes #590
2025-10-29 17:10:35 -05:00
0x68732f6e69622fff
1fde8e4600 Fixes the issue where channel titles are truncated early after an apostrophe 2025-10-29 13:38:51 +00:00
SergeantPanda
5c27bd2c10 Enhancement: Increase maximum URL length for Stream model to 4096 characters (from 2000) and add validation for URL length in processing tasks.
Fixes #585
2025-10-28 15:02:36 -05:00
SergeantPanda
3e2e704765 Enhancement: Add 'Include New Tag' option to mark programs as new in custom dummy EPG output 2025-10-25 11:47:54 -05:00