1
0
mirror of https://github.com/fHDHR/fHDHR_NextPVR.git synced 2025-12-06 07:46:58 -05:00

Merge pull request #120 from deathbybandaid/dev

Enhance M3U and Stream URLs
This commit is contained in:
Deathbybandaid 2021-01-08 11:13:57 -05:00 committed by GitHub
commit f5967e718a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 31 additions and 15 deletions

View File

@ -153,7 +153,7 @@ class Channel():
'GuideNumber': self.number,
'GuideName': self.dict['name'],
'Tags': ",".join(self.dict['tags']),
'URL': self.stream_url,
'URL': self.hdhr_stream_url,
'HD': self.dict["HD"],
"Favorite": self.dict["favorite"],
}
@ -163,11 +163,27 @@ class Channel():
return "/api/images?method=generate&type=channel&message=%s" % self.number
@property
def stream_url(self):
return '/auto/v%s' % self.number
def hdhr_stream_url(self):
return '/auto/%s' % self.hdhr_stream_ident
@property
def play_url(self):
def hdhr_stream_ident(self):
return 'v%s' % self.number
@property
def rmg_stream_url(self):
return "/devices/%s/media/%s" % (self.fhdhr.config.dict["main"]["uuid"], self.rmg_stream_ident)
@property
def rmg_stream_ident(self):
return "id://%s" % self.number
@property
def api_stream_url(self):
return '/api/tuners?method=%s&channel=%s' % (self.fhdhr.config.dict["fhdhr"]["stream_type"], self.number)
@property
def m3u_url(self):
return '/api/m3u?method=get&channel=%s' % self.number
def set_favorite(self, enablement):

View File

@ -29,8 +29,8 @@ class Channels():
for fhdhr_id in [x["id"] for x in self.fhdhr.device.channels.get_channels()]:
channel_obj = self.fhdhr.device.channels.list[fhdhr_id]
channel_dict = channel_obj.dict.copy()
channel_dict["play_url"] = channel_obj.play_url
channel_dict["stream_url"] = channel_obj.stream_url
channel_dict["m3u_url"] = channel_obj.m3u_url
channel_dict["stream_url"] = channel_obj.api_stream_url
channels_info[channel_obj.number] = channel_dict
# Sort the channels

View File

@ -75,7 +75,7 @@ class M3U():
"tvg-logo": logourl,
"group-title": self.fhdhr.config.dict["fhdhr"]["friendlyname"],
"group-titleb": str(channel_obj.dict['name']),
"stream_url": "%s%s" % (base_url, channel_obj.stream_url)
"stream_url": "%s%s" % (base_url, channel_obj.api_stream_url)
}
# Sort the channels

View File

@ -24,7 +24,7 @@ class Channels_Editor_HTML():
channel_dict["number"] = channel_obj.number
channel_dict["chan_thumbnail"] = channel_obj.thumbnail
channel_dict["play_url"] = channel_obj.play_url
channel_dict["m3u_url"] = channel_obj.m3u_url
channelslist[channel_dict["number"]] = channel_dict

View File

@ -29,7 +29,7 @@ class Channels_HTML():
channel_dict["number"] = channel_obj.number
channel_dict["chan_thumbnail"] = channel_obj.thumbnail
channel_dict["play_url"] = channel_obj.play_url
channel_dict["m3u_url"] = channel_obj.m3u_url
channelslist[channel_dict["number"]] = channel_dict
if channel_dict["enabled"]:

View File

@ -67,7 +67,7 @@ class Guide_HTML():
chan_dict["number"] = chan_obj.number
chan_dict["chan_thumbnail"] = chan_obj.thumbnail
chan_dict["enabled"] = chan_obj.dict["enabled"]
chan_dict["play_url"] = chan_obj.play_url
chan_dict["m3u_url"] = chan_obj.m3u_url
chan_dict["listing_thumbnail"] = chan_dict["listing_thumbnail"] or chan_obj.thumbnail
else:

View File

@ -27,7 +27,7 @@ class RMG_Devices_DeviceKey_Channels():
if channel_obj.enabled:
sub_el(out, 'Channel',
drm="0",
channelIdentifier="id://%s" % channel_obj.number,
channelIdentifier=channel_obj.rmg_stream_ident,
name=channel_obj.dict["name"],
origin=channel_obj.dict["callsign"],
number=str(channel_obj.number),

View File

@ -48,9 +48,9 @@
<tr>
<td>
{% if chan_dict["enabled"] %}
<a href="{{ chan_dict["play_url"] }}">Play</a>
<a href="{{ chan_dict["m3u_url"] }}">Play</a>
{% else %}
<a href="{{ chan_dict["play_url"] }}" style="visibility:hidden">Play</a>
<a href="{{ chan_dict["m3u_url"] }}" style="visibility:hidden">Play</a>
{% endif %}
</td>

View File

@ -35,9 +35,9 @@
{% if source in ["blocks", "origin", fhdhr.config.dict["main"]["dictpopname"]] %}
<td>
{% if chan_dict["enabled"] %}
<a href="{{ chan_dict["play_url"] }}">Play</a>
<a href="{{ chan_dict["m3u_url"] }}">Play</a>
{% else %}
<a href="{{ chan_dict["play_url"] }}" style="visibility:hidden">Play</a>
<a href="{{ chan_dict["m3u_url"] }}" style="visibility:hidden">Play</a>
{% endif %}
</td>
{% endif %}