mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-01-23 02:35:14 +00:00
Updated M3U stream URLs
Changed M3U urls to use proxy
This commit is contained in:
parent
7a7cd0711d
commit
505551f312
3 changed files with 8 additions and 4 deletions
|
|
@ -12,5 +12,5 @@ urlpatterns = [
|
|||
re_path(r'^epg/?$', generate_epg, name='generate_epg'),
|
||||
|
||||
# Allow both `/stream/<int:stream_id>` and `/stream/<int:stream_id>/`
|
||||
re_path(r'^stream/(?P<stream_id>\d+)/?$', stream_view, name='stream'),
|
||||
re_path(r'^stream/(?P<channel_uuid>[0-9a-fA-F\-]+)/?$', stream_view, name='stream'),
|
||||
]
|
||||
|
|
|
|||
|
|
@ -22,7 +22,11 @@ def generate_m3u(request):
|
|||
f'#EXTINF:-1 tvg-id="{tvg_id}" tvg-name="{tvg_name}" tvg-logo="{tvg_logo}" '
|
||||
f'tvg-chno="{channel_number}" group-title="{group_title}",{channel.name}\n'
|
||||
)
|
||||
stream_url = request.build_absolute_uri(reverse('output:stream', args=[channel.id]))
|
||||
|
||||
base_url = request.build_absolute_uri('/')[:-1]
|
||||
stream_url = f"{base_url}/proxy/ts/stream/{channel.uuid}"
|
||||
|
||||
#stream_url = request.build_absolute_uri(reverse('output:stream', args=[channel.id]))
|
||||
m3u_content += extinf_line + stream_url + "\n"
|
||||
|
||||
response = HttpResponse(m3u_content, content_type="application/x-mpegURL")
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ def settings_view(request):
|
|||
return render(request, 'settings.html')
|
||||
|
||||
|
||||
def stream_view(request, stream_id):
|
||||
def stream_view(request, channel_uuid):
|
||||
"""
|
||||
Streams the first available stream for the given channel.
|
||||
It uses the channel’s assigned StreamProfile.
|
||||
|
|
@ -40,7 +40,7 @@ def stream_view(request, stream_id):
|
|||
redis_client = redis.Redis(host=settings.REDIS_HOST, port=6379, db=int(getattr(settings, "REDIS_DB", "0")))
|
||||
|
||||
# Retrieve the channel by the provided stream_id.
|
||||
channel = Channel.objects.get(channel_number=stream_id)
|
||||
channel = Channel.objects.get(uuid=channel_uuid)
|
||||
logger.debug("Channel retrieved: ID=%s, Name=%s", channel.id, channel.name)
|
||||
|
||||
# Ensure the channel has at least one stream.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue