mirror of
https://github.com/fHDHR/fHDHR_NextPVR.git
synced 2025-12-06 15:16:58 -05:00
Bugfixes
This commit is contained in:
parent
5f4092bdc8
commit
e86290e9fe
@ -101,6 +101,8 @@ class Direct_M3U8_Stream():
|
|||||||
self.fhdhr.logger.info("Connection Closed: %s" % e)
|
self.fhdhr.logger.info("Connection Closed: %s" % e)
|
||||||
finally:
|
finally:
|
||||||
self.fhdhr.logger.info("Connection Closed: Tuner Lock Removed")
|
self.fhdhr.logger.info("Connection Closed: Tuner Lock Removed")
|
||||||
|
if hasattr(self.fhdhr.origins.origins_dict[self.tuner.origin], "close_stream"):
|
||||||
|
self.fhdhr.origins.origins_dict[self.tuner.origin].close_stream(self.tuner.number, self.stream_args)
|
||||||
self.tuner.close()
|
self.tuner.close()
|
||||||
# raise TunerError("806 - Tune Failed")
|
# raise TunerError("806 - Tune Failed")
|
||||||
|
|
||||||
|
|||||||
@ -64,6 +64,8 @@ class Direct_Stream():
|
|||||||
finally:
|
finally:
|
||||||
req.close()
|
req.close()
|
||||||
self.fhdhr.logger.info("Connection Closed: Tuner Lock Removed")
|
self.fhdhr.logger.info("Connection Closed: Tuner Lock Removed")
|
||||||
|
if hasattr(self.fhdhr.origins.origins_dict[self.tuner.origin], "close_stream"):
|
||||||
|
self.fhdhr.origins.origins_dict[self.tuner.origin].close_stream(self.tuner.number, self.stream_args)
|
||||||
self.tuner.close()
|
self.tuner.close()
|
||||||
# raise TunerError("806 - Tune Failed")
|
# raise TunerError("806 - Tune Failed")
|
||||||
|
|
||||||
|
|||||||
@ -43,3 +43,6 @@ class Origins():
|
|||||||
|
|
||||||
if not hasattr(self.origins_dict[method], 'tuners'):
|
if not hasattr(self.origins_dict[method], 'tuners'):
|
||||||
self.origins_dict[method].tuners = 4
|
self.origins_dict[method].tuners = 4
|
||||||
|
|
||||||
|
if not hasattr(self.origins_dict[method], 'stream_method'):
|
||||||
|
self.origins_dict[method].stream_method = self.fhdhr.config.dict["streaming"]["method"]
|
||||||
|
|||||||
@ -26,7 +26,7 @@ class Channels():
|
|||||||
|
|
||||||
origin_methods = self.fhdhr.origins.valid_origins
|
origin_methods = self.fhdhr.origins.valid_origins
|
||||||
origin = request.args.get('origin', default=None, type=str)
|
origin = request.args.get('origin', default=None, type=str)
|
||||||
if origin not in origin_methods:
|
if origin and origin not in origin_methods:
|
||||||
return "%s Invalid channels origin" % origin
|
return "%s Invalid channels origin" % origin
|
||||||
|
|
||||||
if method == "get":
|
if method == "get":
|
||||||
|
|||||||
@ -63,6 +63,13 @@ class M3U():
|
|||||||
channel_items.append(channel_obj)
|
channel_items.append(channel_obj)
|
||||||
else:
|
else:
|
||||||
return "Channel Disabled"
|
return "Channel Disabled"
|
||||||
|
elif not origin and channel == "all" and str(channel) in [str(x) for x in self.fhdhr.device.channels.get_channel_list("id")]:
|
||||||
|
fileName = "channels.m3u"
|
||||||
|
for origin in list(self.fhdhr.origins.origins_dict.keys()):
|
||||||
|
for fhdhr_id in [x["id"] for x in self.fhdhr.device.channels.get_channels(origin)]:
|
||||||
|
channel_obj = self.fhdhr.device.channels.get_channel_obj("id", fhdhr_id, origin)
|
||||||
|
if channel_obj.enabled:
|
||||||
|
channel_items.append(channel_obj)
|
||||||
elif not origin and channel != "all" and str(channel) in [str(x) for x in self.fhdhr.device.channels.get_channel_list("id")]:
|
elif not origin and channel != "all" and str(channel) in [str(x) for x in self.fhdhr.device.channels.get_channel_list("id")]:
|
||||||
channel_obj = self.fhdhr.device.channels.get_channel_obj("id", channel)
|
channel_obj = self.fhdhr.device.channels.get_channel_obj("id", channel)
|
||||||
fileName = "%s.m3u" % channel_obj.number
|
fileName = "%s.m3u" % channel_obj.number
|
||||||
@ -88,7 +95,7 @@ class M3U():
|
|||||||
"tvg-name": str(channel_obj.dict['name']),
|
"tvg-name": str(channel_obj.dict['name']),
|
||||||
"tvg-id": str(channel_obj.number),
|
"tvg-id": str(channel_obj.number),
|
||||||
"tvg-logo": logourl,
|
"tvg-logo": logourl,
|
||||||
"group-title": self.fhdhr.config.dict["fhdhr"]["friendlyname"],
|
"group-title": channel_obj.origin,
|
||||||
"group-titleb": str(channel_obj.dict['name']),
|
"group-titleb": str(channel_obj.dict['name']),
|
||||||
"stream_url": "%s%s" % (base_url, channel_obj.api_stream_url)
|
"stream_url": "%s%s" % (base_url, channel_obj.api_stream_url)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,7 +31,7 @@ class W3U():
|
|||||||
if origin and origin not in origin_methods:
|
if origin and origin not in origin_methods:
|
||||||
return "%s Invalid channels origin" % origin
|
return "%s Invalid channels origin" % origin
|
||||||
|
|
||||||
channel_info_m3u = {
|
channel_info_w3u = {
|
||||||
"name": self.fhdhr.config.dict["fhdhr"]["friendlyname"],
|
"name": self.fhdhr.config.dict["fhdhr"]["friendlyname"],
|
||||||
"image": '%s/favicon.ico' % base_url,
|
"image": '%s/favicon.ico' % base_url,
|
||||||
"epg": '%s/api/xmltv' % base_url,
|
"epg": '%s/api/xmltv' % base_url,
|
||||||
@ -42,28 +42,35 @@ class W3U():
|
|||||||
|
|
||||||
if origin:
|
if origin:
|
||||||
if channel == "all":
|
if channel == "all":
|
||||||
fileName = "channels.m3u"
|
fileName = "channels.w3u"
|
||||||
for fhdhr_id in [x["id"] for x in self.fhdhr.device.channels.get_channels(origin)]:
|
for fhdhr_id in [x["id"] for x in self.fhdhr.device.channels.get_channels(origin)]:
|
||||||
channel_obj = self.fhdhr.device.channels.get_channel_obj("id", fhdhr_id, origin)
|
channel_obj = self.fhdhr.device.channels.get_channel_obj("id", fhdhr_id, origin)
|
||||||
if channel_obj.enabled:
|
if channel_obj.enabled:
|
||||||
channel_items.append(channel_obj)
|
channel_items.append(channel_obj)
|
||||||
elif str(channel) in [str(x) for x in self.fhdhr.device.channels.get_channel_list("number", origin)]:
|
elif str(channel) in [str(x) for x in self.fhdhr.device.channels.get_channel_list("number", origin)]:
|
||||||
channel_obj = self.fhdhr.device.channels.get_channel_obj("number", channel, origin)
|
channel_obj = self.fhdhr.device.channels.get_channel_obj("number", channel, origin)
|
||||||
fileName = "%s.m3u" % channel_obj.number
|
fileName = "%s.w3u" % channel_obj.number
|
||||||
if channel_obj.enabled:
|
if channel_obj.enabled:
|
||||||
channel_items.append(channel_obj)
|
channel_items.append(channel_obj)
|
||||||
else:
|
else:
|
||||||
return "Channel Disabled"
|
return "Channel Disabled"
|
||||||
elif channel != "all" and str(channel) in [str(x) for x in self.fhdhr.device.channels.get_channel_list("id", origin)]:
|
elif channel != "all" and str(channel) in [str(x) for x in self.fhdhr.device.channels.get_channel_list("id", origin)]:
|
||||||
channel_obj = self.fhdhr.device.channels.get_channel_obj("id", channel, origin)
|
channel_obj = self.fhdhr.device.channels.get_channel_obj("id", channel, origin)
|
||||||
fileName = "%s.m3u" % channel_obj.number
|
fileName = "%s.w3u" % channel_obj.number
|
||||||
if channel_obj.enabled:
|
if channel_obj.enabled:
|
||||||
channel_items.append(channel_obj)
|
channel_items.append(channel_obj)
|
||||||
else:
|
else:
|
||||||
return "Channel Disabled"
|
return "Channel Disabled"
|
||||||
|
elif not origin and channel == "all" and str(channel) in [str(x) for x in self.fhdhr.device.channels.get_channel_list("id")]:
|
||||||
|
fileName = "channels.w3u"
|
||||||
|
for origin in list(self.fhdhr.origins.origins_dict.keys()):
|
||||||
|
for fhdhr_id in [x["id"] for x in self.fhdhr.device.channels.get_channels(origin)]:
|
||||||
|
channel_obj = self.fhdhr.device.channels.get_channel_obj("id", fhdhr_id, origin)
|
||||||
|
if channel_obj.enabled:
|
||||||
|
channel_items.append(channel_obj)
|
||||||
elif not origin and channel != "all" and str(channel) in [str(x) for x in self.fhdhr.device.channels.get_channel_list("id")]:
|
elif not origin and channel != "all" and str(channel) in [str(x) for x in self.fhdhr.device.channels.get_channel_list("id")]:
|
||||||
channel_obj = self.fhdhr.device.channels.get_channel_obj("id", channel)
|
channel_obj = self.fhdhr.device.channels.get_channel_obj("id", channel)
|
||||||
fileName = "%s.m3u" % channel_obj.number
|
fileName = "%s.w3u" % channel_obj.number
|
||||||
if channel_obj.enabled:
|
if channel_obj.enabled:
|
||||||
channel_items.append(channel_obj)
|
channel_items.append(channel_obj)
|
||||||
else:
|
else:
|
||||||
@ -91,9 +98,9 @@ class W3U():
|
|||||||
# Sort the channels
|
# Sort the channels
|
||||||
sorted_channel_list = channel_sort(list(channels_info.keys()))
|
sorted_channel_list = channel_sort(list(channels_info.keys()))
|
||||||
for channel in sorted_channel_list:
|
for channel in sorted_channel_list:
|
||||||
channel_info_m3u["stations"].append(channels_info[channel])
|
channel_info_w3u["stations"].append(channels_info[channel])
|
||||||
|
|
||||||
channels_info_json = json.dumps(channel_info_m3u, indent=4)
|
channels_info_json = json.dumps(channel_info_w3u, indent=4)
|
||||||
|
|
||||||
resp = Response(status=200, response=channels_info_json, mimetype='application/json')
|
resp = Response(status=200, response=channels_info_json, mimetype='application/json')
|
||||||
resp.headers["content-disposition"] = "attachment; filename=%s" % fileName
|
resp.headers["content-disposition"] = "attachment; filename=%s" % fileName
|
||||||
|
|||||||
@ -36,9 +36,10 @@ def chan_edit_data(items, channel_id):
|
|||||||
|
|
||||||
|
|
||||||
def chan_edit_postform(chanlist):
|
def chan_edit_postform(chanlist):
|
||||||
|
origin = document["origin"].value
|
||||||
postForm = document.createElement('form')
|
postForm = document.createElement('form')
|
||||||
postForm.method = "POST"
|
postForm.method = "POST"
|
||||||
postForm.action = "/api/channels?method=modify&redirect=/channels_editor"
|
postForm.action = "/api/channels?method=modify&origin=%s&redirect=/channels_editor&origin=%s" % (origin, origin)
|
||||||
postForm.setRequestHeader = "('Content-Type', 'application/json')"
|
postForm.setRequestHeader = "('Content-Type', 'application/json')"
|
||||||
|
|
||||||
postData = document.createElement('input')
|
postData = document.createElement('input')
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<h4 style="text-align: center;">{{ fhdhr.config.dict["fhdhr"]["friendlyname"] }} Channels Editor</h4>
|
<h4 style="text-align: center;">{{ fhdhr.config.dict["fhdhr"]["friendlyname"] }} Channels Editor</h4>
|
||||||
|
<input type="hidden" id="origin" value="{{ origin }}">
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<table class="table-medium center">
|
<table class="table-medium center">
|
||||||
|
|||||||
@ -57,6 +57,8 @@ class Plugin_OBJ():
|
|||||||
ffmpeg_proc.communicate()
|
ffmpeg_proc.communicate()
|
||||||
ffmpeg_proc.kill()
|
ffmpeg_proc.kill()
|
||||||
self.plugin_utils.logger.info("Connection Closed: Tuner Lock Removed")
|
self.plugin_utils.logger.info("Connection Closed: Tuner Lock Removed")
|
||||||
|
if hasattr(self.fhdhr.origins.origins_dict[self.tuner.origin], "close_stream"):
|
||||||
|
self.fhdhr.origins.origins_dict[self.tuner.origin].close_stream(self.tuner.number, self.stream_args)
|
||||||
self.tuner.close()
|
self.tuner.close()
|
||||||
# raise TunerError("806 - Tune Failed")
|
# raise TunerError("806 - Tune Failed")
|
||||||
|
|
||||||
|
|||||||
@ -58,6 +58,8 @@ class Plugin_OBJ():
|
|||||||
vlc_proc.communicate()
|
vlc_proc.communicate()
|
||||||
vlc_proc.kill()
|
vlc_proc.kill()
|
||||||
self.plugin_utils.logger.info("Connection Closed: Tuner Lock Removed")
|
self.plugin_utils.logger.info("Connection Closed: Tuner Lock Removed")
|
||||||
|
if hasattr(self.fhdhr.origins.origins_dict[self.tuner.origin], "close_stream"):
|
||||||
|
self.fhdhr.origins.origins_dict[self.tuner.origin].close_stream(self.tuner.number, self.stream_args)
|
||||||
self.tuner.close()
|
self.tuner.close()
|
||||||
# raise TunerError("806 - Tune Failed")
|
# raise TunerError("806 - Tune Failed")
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user