Commit graph

203 commits

Author SHA1 Message Date
SergeantPanda
0815b3df14 tests: Add backend test for expiration feature. 2026-03-15 16:42:11 -05:00
SergeantPanda
bd11b0e832 Change notification for account expiry to admin only. 2026-03-15 16:03:41 -05:00
SergeantPanda
09d5f6bb9f Update expiration date handling in M3U components to ensure UTC format 2026-03-15 16:00:23 -05:00
SergeantPanda
1d4603dadd Enhancement: Optimize profile expiration handling and update task naming for clarity 2026-03-15 12:42:34 -05:00
SergeantPanda
b22f9e8e07 Enhancement: Account expiration tracking and notifications for M3U profiles 2026-03-14 18:38:59 -05:00
SergeantPanda
ea9f4f4bbd Merge branch 'dev' of https://github.com/Dispatcharr/Dispatcharr into pr/JCBird1012/1062 2026-03-08 12:00:46 -05:00
SergeantPanda
9876a25e62 Bug Fix: XC stream refresh crashing with a null value in column "name" database error when a provider returns streams with a null or empty name. Affected streams are now assigned a generated fallback name in the format <account name> - <stream_id> so the refresh completes successfully and the stream remains accessible. A warning is logged for each affected stream. 2026-03-07 18:33:17 -06:00
SergeantPanda
3d27161755 Merge branch 'dev' of https://github.com/Dispatcharr/Dispatcharr into pr/nickgerrer/1022 2026-03-06 17:22:44 -06:00
Jonathan Caicedo
a51eb37075 fix: M3U EXTINF parsing for attributes ending in double equals
fixes: #1055
2026-03-06 08:10:30 -05:00
None
ce9f7ccbf9 fix(m3u): fix Celery worker memory leak during M3U/XC refresh
Restructure cleanup in refresh_single_m3u_account so del statements
run before gc.collect(), enabling cyclic garbage collection. Add worker_max_memory_per_child as a safety net against memory fragmentation.

Closes #1012, Closes #1053
2026-03-05 13:47:20 -06:00
Jonathan Caicedo
c6cf9443d2 fix: guard is_adult parsing against invalid values
or whatever other fun things providers might shove down the wire...
2026-03-05 14:16:21 -05:00
Nicholas Gerrer
858c81f826 perf: use bulk_create with update_conflicts for group settings save
Replace N+1 update_or_create() loop with bulk_create(update_conflicts=True)
wrapped in transaction.atomic(). On large M3U accounts with many groups,
the previous approach issued individual DB queries per group/category,
which could take minutes on slower hardware like Synology NAS devices.
2026-02-26 01:21:26 -05:00
SergeantPanda
e9a2cb4dbb
Merge pull request #1014 from CodeBormen/fix/861-M3U-downloading-endlessly
Some checks are pending
CI Pipeline / prepare (push) Waiting to run
CI Pipeline / docker (amd64, ubuntu-24.04) (push) Blocked by required conditions
CI Pipeline / docker (arm64, ubuntu-24.04-arm) (push) Blocked by required conditions
CI Pipeline / create-manifest (push) Blocked by required conditions
Build and Push Multi-Arch Docker Image / build-and-push (push) Waiting to run
Frontend Tests / test (push) Waiting to run
Fix #861: Prevent M3U/EPG tasks from downloading endlessly
2026-02-24 14:28:36 -06:00
SergeantPanda
74ce971b75 Bug Fix: Cron schedule got overwrote when changing/loading settings (signals issue) 2026-02-24 10:48:17 -06:00
None
e55ef41acb Fix uncovered lock_renewer.stop() paths in refresh_single_m3u_account
Five early-return paths released the Redis lock without stopping the
renewal thread, and the final release_task_lock was outside the finally block making it unreachable on exception. All exit paths now properly
stop the renewer before releasing the lock.
2026-02-23 00:48:07 -06:00
None
c841cfc8fc Fix #861: Prevent M3U endless downloading caused by Redis lock expiry
Large M3U downloads that exceed the 300s Redis lock TTL caused Celery Beat
to re-queue duplicate tasks, creating overlapping downloads that never complete.

Files changed:

- core/utils.py: Add TaskLockRenewer class — a daemon thread that periodically renews Redis lock TTL (every 120s) to prevent expiry during long-running tasks.

- apps/m3u/tasks.py: Apply TaskLockRenewer to refresh_single_m3u_account and refresh_m3u_groups; add HTTP timeout (30s connect, 60s read) to M3U download (the only download path missing one); stream M3U download to disk instead of accumulating in memory; add Celery task time limits (1 hour hard limit).

- apps/epg/tasks.py: Apply TaskLockRenewer to refresh_epg_data and parse_programs_for_tvg_id; add Celery task time limits (30 min / 1 hour).

Verified with a throttled test server: locks renewed at T+120s, T+240s, T+360s; 50,000 streams processed with no duplicate tasks.
2026-02-23 00:34:28 -06:00
SergeantPanda
ac1b43445e
Merge pull request #946 from CodeBormen/fix/945-XC-profile-refresh-extract-wrong-credentials
Fix XC URL sub-path handling in profile refresh and EPG creation
2026-02-16 16:04:53 -06:00
SergeantPanda
717cce92ec
Merge branch 'dev' into cron-scheduling 2026-02-16 10:55:33 -06:00
SergeantPanda
fb2f156fd8 Bug Fix: Fixes a bug with auto channel sync where channel numbers could be duplicated if multiple groups overlapped. 2026-02-13 15:07:24 -06:00
SergeantPanda
2c9f6d7360 Enhancement: For auto channel sync, allow using provider number, fixed start number or next available. (Closes #956, #433) 2026-02-13 14:34:22 -06:00
SergeantPanda
890992a9f9 feat(scheduling): add cron builder and refactor scheduling components (Closes #165)
Add cron expression support for M3U and EPG refreshes with interactive
builder modal and quick reference examples. Refactor backup scheduling
to use shared ScheduleInput component for consistency.

- New CronBuilder modal with preset buttons and custom field editors
- Info popover with common cron expression examples
- Shared ScheduleInput component for interval/cron toggle
2026-02-12 18:08:13 -06:00
None
8de23eec35 Fix XC URL sub-path handling in profile refresh and EPG creation
- Fix credential extraction in get_transformed_credentials() using negative
  indices anchored to the known tail structure instead of hardcoded indices
  that break when server URLs contain sub-paths
- Fix EPG URL construction in M3U form to normalize server URL to origin
  before appending xmltv.php endpoint

XC accounts with sub-paths in their server URL (e.g., http://server.com/portal/a/) caused two failures: profile refresh extracted wrong credentials from the URL path due to hardcoded array indices, and EPG auto-creation appended xmltv.php under the sub-path instead of at the domain root. Both fixes normalize away the sub-path using the same approach the backend's XCClient already uses for API calls.
2026-02-05 20:55:52 -06:00
SergeantPanda
027d114299 Enhancement: XtreamCodes Authentication Optimization: Reduced API calls during XC refresh by 50% by eliminating redundant authentication step. This should help reduce rate-limiting errors.
Some checks failed
Base Image Build / prepare (push) Has been cancelled
CI Pipeline / prepare (push) Has been cancelled
Build and Push Multi-Arch Docker Image / build-and-push (push) Has been cancelled
Frontend Tests / test (push) Has been cancelled
Base Image Build / docker (amd64, ubuntu-24.04) (push) Has been cancelled
Base Image Build / docker (arm64, ubuntu-24.04-arm) (push) Has been cancelled
Base Image Build / create-manifest (push) Has been cancelled
CI Pipeline / docker (amd64, ubuntu-24.04) (push) Has been cancelled
CI Pipeline / docker (arm64, ubuntu-24.04-arm) (push) Has been cancelled
CI Pipeline / create-manifest (push) Has been cancelled
2026-02-03 12:16:31 -06:00
SergeantPanda
9ffd595c96 Enhancement: Added stream_id (provider stream identifier) and stream_chno (provider channel number) fields to Stream model. For XC accounts, the stream hash now uses the stable stream_id instead of the URL when hashing, ensuring XC streams maintain their identity and channel associations even when account credentials or server URLs change. Supports both XC num and M3U tvg-chno/channel-number attributes. 2026-01-31 17:47:46 -06:00
SergeantPanda
5364123745 - Swagger/OpenAPI Migration: Migrated from drf-yasg (OpenAPI 2.0) to drf-spectacular (OpenAPI 3.0) for API documentation. This provides:
- Native Bearer token authentication support in Swagger UI - users can now enter just the JWT token and the "Bearer " prefix is automatically added
  - Modern OpenAPI 3.0 specification compliance
  - Better auto-generation of request/response schemas
  - Improved documentation accuracy with serializer introspection
2026-01-27 13:33:33 -06:00
SergeantPanda
d33d047a94 Enhancement: - Mature content filtering support:
- Added `is_adult` boolean field to both Stream and Channel models with database indexing for efficient filtering and sorting
  - Automatically populated during M3U/XC refresh operations by extracting `is_adult` value from provider data
  - Type-safe conversion supporting both integer (0/1) and string ("0"/"1") formats from different providers
  - UI controls in channel edit form (Switch with tooltip) and bulk edit form (Select dropdown) for easy management
  - XtreamCodes API support with proper integer formatting (0/1) in live stream responses
  - Automatic propagation from streams to channels during both single and bulk channel creation operations
  - Included in serializers for full API support
  - User-level content filtering: Non-admin users can opt to hide mature content channels across all interfaces (web UI, M3U playlists, EPG data, XtreamCodes API) via "Hide Mature Content" toggle in user settings (stored in custom_properties, admin users always see all content)
2026-01-17 15:00:28 -06:00
SergeantPanda
a84553d15c Enhancement: Stale status indicators for streams and groups: Added is_stale field to both Stream and ChannelGroupM3UAccount models to track items in their grace period (seen in previous refresh but not current). 2026-01-09 13:53:01 -06:00
SergeantPanda
cc9d38212e Enhancement: Groups now follow the same stale retention logic as streams, using the account's stale_stream_days setting. Groups that temporarily disappear from an M3U source are retained for the configured retention period instead of being immediately deleted, preserving user settings and preventing data loss when providers temporarily remove/re-add groups. (Closes #809) 2026-01-09 12:03:55 -06:00
SergeantPanda
73956924f5 Enhancement: Stream group as available hash option: Users can now select 'Group' as a hash key option in Settings → Stream Settings → M3U Hash Key, allowing streams to be differentiated by their group membership in addition to name, URL, TVG-ID, and M3U ID 2025-12-18 15:26:08 -06: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
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
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
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
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
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
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
91eaa64ebb Enhancement: Force a specific EPG for auto channel sync channels. 2025-10-18 13:43:49 -05:00
SergeantPanda
0a4c7cae25 Bug fix: Fix bug where channel logo would revert back to provider logo after a refresh (for auto channel sync channels) 2025-10-18 12:38:43 -05:00
SergeantPanda
ca8e9d0143 Enhancement: Add custom logo support for channel groups in Auto Sync Channels.
Closes #555
2025-10-17 10:03:21 -05:00
Ragchuck
ae8b85a3e2 feat: added support for rtsp 2025-10-15 22:06:01 +02:00
SergeantPanda
951af5f3fb Enhancement: Add auto-enable settings for new groups and categories in M3U and VOD components
Bug Fix: Remove orphaned categories for VOD and Series
Fixes #540
Closes #208
2025-10-09 15:28:37 -05:00
SergeantPanda
da245c409a Bug fix: Backend now notifies frontend when a new playlist is creating. This should fix where accounts will sometimes only show fetching groups after a new account is added. 2025-10-07 09:55:35 -05:00
SergeantPanda
13874d64ad Bug fix: If no streams are found during an XC account refresh we were not releasing the task lock and we weren't processing vods.
Fixes #449
2025-10-06 20:04:22 -05:00
SergeantPanda
e841343e5b Dont convert m3u_id to string for hash. 2025-10-02 11:06:10 -05:00
SergeantPanda
a3e4f23891 Enhancement: Add m3u_id parameter to generate_hash_key and update related calls 2025-10-02 09:14:22 -05:00
SergeantPanda
6fa12f90c5 Improved url transofrmation logic to support more advanced regex during profile refreshes. 2025-09-24 15:51:26 -05:00
SergeantPanda
63729fb0ea Improved logging for stream filters. 2025-09-21 10:42:23 -05:00
SergeantPanda
74aff3fb1a Enhance M3U profile management: add optional notes field, improve validation for default profiles, and update UI to display notes where applicable.
Also adds the ability to modify the name of the defualt profile.
Closes #280 [Feature]: add general text field in m3u/xs
2025-09-10 17:26:18 -05:00