Commit graph

38 commits

Author SHA1 Message Date
SergeantPanda
14bfd25d9a feat(timeshift): enhance catch-up session handling with optional duration support
- Introduced an optional `duration` parameter for catch-up sessions, allowing clients to specify the programme length in minutes. This value is preferred over EPG-derived durations and includes a buffer for provider lag.
- Updated the API views and serializers to accept and process the new `duration` field.
- Enhanced the catch-up proxy implementation to utilize the client-supplied duration, improving playback accuracy.
- Added tests to validate the new duration handling and ensure proper integration with existing functionality.
2026-07-16 21:26:06 +00:00
Dillard Blom
e5d33861e6 Accept QUERY-style incoming catch-up requests (streaming/timeshift.php)
Clients that build catch-up requests in QUERY layout (e.g. Open-TV /
Fred TV: /streaming/timeshift.php?username=...&stream=...&start=...)
had no matching urlpattern, so the request silently fell through to
the frontend's <path:unused_path> catch-all and got served index.html
(200 OK, wrong content) instead of reaching the proxy — no error, no
log line, the client just fails to play.

The PATH-style layout (timeshift/<user>/<pass>/<stream_id>/<ts>/<dur>)
already worked; QUERY-style autodetection already existed for outgoing
provider requests (helpers.build_timeshift_url_format_a/_b) but was
never mirrored to the incoming route.

Split timeshift_proxy into a shared _timeshift_proxy_impl plus two thin
entry points (PATH-style timeshift_proxy, new QUERY-style
timeshift_proxy_query) so both incoming layouts are recognized.

Reported against the predecessor plugin as dispatcharr_timeshift#10;
reproduced identically against dispatcharr:dev (confirmed via nginx
access log: a QUERY-style request returned 200 with a response body
exactly matching the size of frontend/dist/index.html).
2026-07-13 22:13:42 +02:00
SergeantPanda
e596a508c7 refactor(models): Simplify comments for catch-up fields in Stream and Channel models, clarifying their population process. Update migration docstring for consistency. Remove outdated comments in ProxyServer and URLs related to timeshift handling. 2026-06-26 12:39:54 -05:00
Cédric Marcoux
4f45249067 fix(timeshift): resolve catch-up channel by Channel.id only + cleanup
- timeshift_proxy(): drop the resolve_channel_by_provider_stream_id
  fallback. The client only ever sends Dispatcharr's internal Channel.id,
  so resolve by id and return 404 on miss. Remove the dead `channel = None`
  sentinel and the now-unused import.
- Delete the now-orphaned resolve_channel_by_provider_stream_id helper and
  its local Stream import from apps/channels/utils.py (zero remaining refs).
- Import django.core.cache.cache at module top-level instead of inside
  _get_cached_format_index / _set_cached_format_index.
- Fix the stale dispatcharr/urls.py comment: the "duration" slot carries
  Channel.id, not the provider stream_id.
- Genericize provider host references in code comments.
2026-06-01 12:51:14 +02:00
Cédric Marcoux
2781b21a89 feat: built-in XC catch-up (timeshift) support
Adds native catch-up/timeshift replay for Xtream Codes providers through
the same HTTPStreamReader transport pipeline as live TV.

Timeshift proxy (apps/timeshift/):
- URL cascade: 3 candidate timestamp formats per provider, per-account
  format cache for fast-forward seek performance
- MPEG-TS preamble stripping (shared with HTTPStreamReader)
- Stats integration: timeshift viewers appear on /stats with TIMESHIFT badge
- Auth via hmac.compare_digest on XC password

Catchup detection — denormalized for zero-cost output queries:
- Stream.is_catchup + Stream.catchup_days populated at XC import time
- Channel.has_catchup + Channel.catchup_days + Channel.catchup_provider_stream_id
  rolled up via ChannelStream post_save signal (UI path) and explicit SQL
  after bulk_create (import path)
- _xc_channel_entry() reads denormalized fields instead of per-channel
  custom_properties JSON introspection (eliminates N+1 queries)
- Migration 0038 backfills existing data via raw SQL

XC API enhancements:
- server_info.timezone + start/end + time_now use configured timezone
  (triple consistency rule — fixes wrong-programme-plays bug)
- Dynamic has_archive flag + auto prev_days for catch-up channels
- XMLTV timestamps rewritten to local timezone for catch-up clients

HTTPStreamReader extended (apps/proxy/live_proxy/input/http_streamer.py):
- 1 MB pipe buffer via fcntl F_SETPIPE_SZ (eliminates producer/consumer
  ping-pong that halved throughput)
- Pre-opened response= for URL cascade workflows
- strip_ts_preamble= for XC servers emitting PHP warnings before TS
- find_ts_sync() as shared utility
- Builds on upstream O_NONBLOCK + select() write loop

Provider stream_id lookup order:
- stream_xc() and xc_get_epg() try internal Channel.id first, fall back
  to provider stream_id only when needed (avoids unconditional query on
  every request)

Also includes:
- VOD provider cascade in stream_vod() — iterates all M3U relations by
  priority when first provider is at capacity
- Defensive null-safety: custom_sid: None → "" in get_live_streams,
  get_vod_streams, get_vod_info, get_series_info (fixes iPlayTV crash on
  JSON null for string fields)
- Timeshift settings UI (timezone selector, debug toggle)
- StreamConnectionCard violet TIMESHIFT badge
- Orphan cleanup skips timeshift_* virtual channels
2026-05-27 13:13:20 +02:00
SergeantPanda
dc649ffd88 Enhancement: Initial fmp4 support and major ts_proxy refactor 2026-05-08 17:46:47 -05:00
dekzter
a19be96ced fleshed out user limits and termination logic 2026-03-25 17:33:26 -04:00
SergeantPanda
bd1e0e8f07 Bug fix: Admin URL Conflict with XC Streams: Updated nginx configuration to only redirect exact /admin and /admin/ paths to login in production, preventing interference with stream URLs that use "admin" as a username (e.g., /admin/password/stream_id now properly routes to stream handling instead of being redirected). 2026-01-27 14:36:57 -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
fa2b3fbe3e Merge branch 'dev' of https://github.com/Dispatcharr/Dispatcharr into vod-relationtest 2025-08-19 18:24:27 -05:00
SergeantPanda
e12ce4e596 Swagger endpoint can now be accessed with or without a trailing slash. 2025-08-19 18:16:21 -05:00
SergeantPanda
d054e2cac5 Add XC endpoints for VOD. 2025-08-08 09:03:25 -05:00
SergeantPanda
d18817acb0 Track VOD connections in Redis. 2025-08-05 21:24:41 -05:00
SergeantPanda
4accd2be85 Pull advanced info from provider when opening a movie. 2025-08-03 22:02:34 -05:00
SergeantPanda
84aa631196 Initial backend commit for vod 2025-08-02 10:42:36 -05:00
dekzter
3f445607e0 looooots of updates for user-management, initial commit of access control 2025-05-31 18:01:46 -04:00
dekzter
74d58515d0 user management, user levels, user level channel access 2025-05-18 11:19:34 -04:00
Dispatcharr
aa6cbf3b65 Removed HDHR from root url 2025-03-21 08:22:17 -05:00
SergeantPanda
fe83e8a03e Merge branch 'main' of https://github.com/Dispatcharr/Dispatcharr into Proxy 2025-03-07 08:34:21 -06:00
Dispatcharr
e305f1cba0 Fixed HDHR
Changed URLs so they would properly work as a HDHR device.
2025-03-06 18:43:14 -06:00
dekzter
3ecb49375c Websockets, fixed channel name collision, added back in multi-stream per channel support 2025-03-05 17:04:43 -05:00
SergeantPanda
4b349d1051 Updated urls and views to allow for initializing the channels. 2025-03-04 10:13:54 -06:00
SergeantPanda
15c277e0d4 Reordered and cleaned up urls. 2025-03-04 09:28:07 -06:00
SergeantPanda
aa74d5a9fd Adds an extra redirect. 2025-03-04 09:19:38 -06:00
SergeantPanda
32462672bd Merge branch 'main' of https://github.com/SergeantPanda/Dispatcharr into Proxy 2025-03-04 08:13:27 -06:00
SergeantPanda
1ad84164a6 Fixed issues with not being able to create a super user. 2025-03-03 19:43:12 -06:00
SergeantPanda
85e41d5def Initial integration. 2025-03-03 18:40:30 -06:00
Dispatcharr
814d6a6cda Added Super User Creator
Added creator
Corrected license in swagger
2025-03-03 14:57:38 -06:00
Dispatcharr
9cbf70a4ec Added hdhr urls 2025-03-02 15:08:34 -06:00
Dispatcharr
d1121504d1 Fixed trailing slash
Fixed trailing slash on main urls
Fixed trailing slash on output urls
2025-02-27 09:51:54 -06:00
kappa118
9a027f1cc7 port updates 2025-02-27 09:29:25 -05:00
kappa118
6e62179416 now proxying api requests through dev react server, no need for api configuration 2025-02-26 21:45:16 -05:00
kappa118
1e4275ea7a core django changes for new react ui 2025-02-26 20:02:13 -05:00
Dispatcharr
d89bf35c0d Pre-Alpha v4
Added settings page
Added EPG functionality
2025-02-24 15:04:03 -06:00
Dispatcharr
9da7adda92 Pre Alpha v4
Added login page
Added login/logout buttons
Added m3u settings
Added stream profiles to channels and streams
Added ability to add individual stream outside of m3u file
Added ability to add youtube live links as a stream source
Deleted migrations
Deleted pycache folders
Changed HDHR to get ip dynamically
2025-02-22 20:43:55 -06:00
Dispatcharr
1fb7a0c9eb Alpha v3
Added user agents
Added Stream Profiles
Added new API calls
2025-02-21 15:31:59 -06:00
Dispatcharr
3978e60ce9 Pre Alpha 2
Added FFMPEG
Removed "is_active"
Added m3u output
2025-02-19 16:55:23 -06:00
Dispatcharr
8edb743ebd Initial commit 2025-02-18 11:14:09 -06:00