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:
commit
f5967e718a
@ -153,7 +153,7 @@ class Channel():
|
|||||||
'GuideNumber': self.number,
|
'GuideNumber': self.number,
|
||||||
'GuideName': self.dict['name'],
|
'GuideName': self.dict['name'],
|
||||||
'Tags': ",".join(self.dict['tags']),
|
'Tags': ",".join(self.dict['tags']),
|
||||||
'URL': self.stream_url,
|
'URL': self.hdhr_stream_url,
|
||||||
'HD': self.dict["HD"],
|
'HD': self.dict["HD"],
|
||||||
"Favorite": self.dict["favorite"],
|
"Favorite": self.dict["favorite"],
|
||||||
}
|
}
|
||||||
@ -163,11 +163,27 @@ class Channel():
|
|||||||
return "/api/images?method=generate&type=channel&message=%s" % self.number
|
return "/api/images?method=generate&type=channel&message=%s" % self.number
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def stream_url(self):
|
def hdhr_stream_url(self):
|
||||||
return '/auto/v%s' % self.number
|
return '/auto/%s' % self.hdhr_stream_ident
|
||||||
|
|
||||||
@property
|
@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
|
return '/api/m3u?method=get&channel=%s' % self.number
|
||||||
|
|
||||||
def set_favorite(self, enablement):
|
def set_favorite(self, enablement):
|
||||||
|
|||||||
@ -29,8 +29,8 @@ class Channels():
|
|||||||
for fhdhr_id in [x["id"] for x in self.fhdhr.device.channels.get_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_obj = self.fhdhr.device.channels.list[fhdhr_id]
|
||||||
channel_dict = channel_obj.dict.copy()
|
channel_dict = channel_obj.dict.copy()
|
||||||
channel_dict["play_url"] = channel_obj.play_url
|
channel_dict["m3u_url"] = channel_obj.m3u_url
|
||||||
channel_dict["stream_url"] = channel_obj.stream_url
|
channel_dict["stream_url"] = channel_obj.api_stream_url
|
||||||
channels_info[channel_obj.number] = channel_dict
|
channels_info[channel_obj.number] = channel_dict
|
||||||
|
|
||||||
# Sort the channels
|
# Sort the channels
|
||||||
|
|||||||
@ -75,7 +75,7 @@ class M3U():
|
|||||||
"tvg-logo": logourl,
|
"tvg-logo": logourl,
|
||||||
"group-title": self.fhdhr.config.dict["fhdhr"]["friendlyname"],
|
"group-title": self.fhdhr.config.dict["fhdhr"]["friendlyname"],
|
||||||
"group-titleb": str(channel_obj.dict['name']),
|
"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
|
# Sort the channels
|
||||||
|
|||||||
@ -24,7 +24,7 @@ class Channels_Editor_HTML():
|
|||||||
|
|
||||||
channel_dict["number"] = channel_obj.number
|
channel_dict["number"] = channel_obj.number
|
||||||
channel_dict["chan_thumbnail"] = channel_obj.thumbnail
|
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
|
channelslist[channel_dict["number"]] = channel_dict
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ class Channels_HTML():
|
|||||||
|
|
||||||
channel_dict["number"] = channel_obj.number
|
channel_dict["number"] = channel_obj.number
|
||||||
channel_dict["chan_thumbnail"] = channel_obj.thumbnail
|
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
|
channelslist[channel_dict["number"]] = channel_dict
|
||||||
if channel_dict["enabled"]:
|
if channel_dict["enabled"]:
|
||||||
|
|||||||
@ -67,7 +67,7 @@ class Guide_HTML():
|
|||||||
chan_dict["number"] = chan_obj.number
|
chan_dict["number"] = chan_obj.number
|
||||||
chan_dict["chan_thumbnail"] = chan_obj.thumbnail
|
chan_dict["chan_thumbnail"] = chan_obj.thumbnail
|
||||||
chan_dict["enabled"] = chan_obj.dict["enabled"]
|
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
|
chan_dict["listing_thumbnail"] = chan_dict["listing_thumbnail"] or chan_obj.thumbnail
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -27,7 +27,7 @@ class RMG_Devices_DeviceKey_Channels():
|
|||||||
if channel_obj.enabled:
|
if channel_obj.enabled:
|
||||||
sub_el(out, 'Channel',
|
sub_el(out, 'Channel',
|
||||||
drm="0",
|
drm="0",
|
||||||
channelIdentifier="id://%s" % channel_obj.number,
|
channelIdentifier=channel_obj.rmg_stream_ident,
|
||||||
name=channel_obj.dict["name"],
|
name=channel_obj.dict["name"],
|
||||||
origin=channel_obj.dict["callsign"],
|
origin=channel_obj.dict["callsign"],
|
||||||
number=str(channel_obj.number),
|
number=str(channel_obj.number),
|
||||||
|
|||||||
@ -48,9 +48,9 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
{% if chan_dict["enabled"] %}
|
{% if chan_dict["enabled"] %}
|
||||||
<a href="{{ chan_dict["play_url"] }}">Play</a>
|
<a href="{{ chan_dict["m3u_url"] }}">Play</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="{{ chan_dict["play_url"] }}" style="visibility:hidden">Play</a>
|
<a href="{{ chan_dict["m3u_url"] }}" style="visibility:hidden">Play</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|||||||
@ -35,9 +35,9 @@
|
|||||||
{% if source in ["blocks", "origin", fhdhr.config.dict["main"]["dictpopname"]] %}
|
{% if source in ["blocks", "origin", fhdhr.config.dict["main"]["dictpopname"]] %}
|
||||||
<td>
|
<td>
|
||||||
{% if chan_dict["enabled"] %}
|
{% if chan_dict["enabled"] %}
|
||||||
<a href="{{ chan_dict["play_url"] }}">Play</a>
|
<a href="{{ chan_dict["m3u_url"] }}">Play</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="{{ chan_dict["play_url"] }}" style="visibility:hidden">Play</a>
|
<a href="{{ chan_dict["m3u_url"] }}" style="visibility:hidden">Play</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user