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

Merge pull request #153 from deathbybandaid/dev

Bugfixes
This commit is contained in:
Deathbybandaid 2021-01-30 10:42:48 -05:00 committed by GitHub
commit b16fcf3b51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 37 additions and 10 deletions

View File

@ -101,6 +101,8 @@ class Direct_M3U8_Stream():
self.fhdhr.logger.info("Connection Closed: %s" % e)
finally:
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()
# raise TunerError("806 - Tune Failed")

View File

@ -64,6 +64,8 @@ class Direct_Stream():
finally:
req.close()
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()
# raise TunerError("806 - Tune Failed")

View File

@ -43,3 +43,6 @@ class Origins():
if not hasattr(self.origins_dict[method], 'tuners'):
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"]

View File

@ -26,7 +26,7 @@ class Channels():
origin_methods = self.fhdhr.origins.valid_origins
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
if method == "get":

View File

@ -63,6 +63,13 @@ class M3U():
channel_items.append(channel_obj)
else:
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")]:
channel_obj = self.fhdhr.device.channels.get_channel_obj("id", channel)
fileName = "%s.m3u" % channel_obj.number
@ -88,7 +95,7 @@ class M3U():
"tvg-name": str(channel_obj.dict['name']),
"tvg-id": str(channel_obj.number),
"tvg-logo": logourl,
"group-title": self.fhdhr.config.dict["fhdhr"]["friendlyname"],
"group-title": channel_obj.origin,
"group-titleb": str(channel_obj.dict['name']),
"stream_url": "%s%s" % (base_url, channel_obj.api_stream_url)
}

View File

@ -31,7 +31,7 @@ class W3U():
if origin and origin not in origin_methods:
return "%s Invalid channels origin" % origin
channel_info_m3u = {
channel_info_w3u = {
"name": self.fhdhr.config.dict["fhdhr"]["friendlyname"],
"image": '%s/favicon.ico' % base_url,
"epg": '%s/api/xmltv' % base_url,
@ -42,28 +42,35 @@ class W3U():
if origin:
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)]:
channel_obj = self.fhdhr.device.channels.get_channel_obj("id", fhdhr_id, origin)
if channel_obj.enabled:
channel_items.append(channel_obj)
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)
fileName = "%s.m3u" % channel_obj.number
fileName = "%s.w3u" % channel_obj.number
if channel_obj.enabled:
channel_items.append(channel_obj)
else:
return "Channel Disabled"
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)
fileName = "%s.m3u" % channel_obj.number
fileName = "%s.w3u" % channel_obj.number
if channel_obj.enabled:
channel_items.append(channel_obj)
else:
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")]:
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:
channel_items.append(channel_obj)
else:
@ -91,9 +98,9 @@ class W3U():
# Sort the channels
sorted_channel_list = channel_sort(list(channels_info.keys()))
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.headers["content-disposition"] = "attachment; filename=%s" % fileName

View File

@ -36,9 +36,10 @@ def chan_edit_data(items, channel_id):
def chan_edit_postform(chanlist):
origin = document["origin"].value
postForm = document.createElement('form')
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')"
postData = document.createElement('input')

View File

@ -3,6 +3,7 @@
{% block content %}
<h4 style="text-align: center;">{{ fhdhr.config.dict["fhdhr"]["friendlyname"] }} Channels Editor</h4>
<input type="hidden" id="origin" value="{{ origin }}">
<div class="container">
<table class="table-medium center">

View File

@ -57,6 +57,8 @@ class Plugin_OBJ():
ffmpeg_proc.communicate()
ffmpeg_proc.kill()
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()
# raise TunerError("806 - Tune Failed")

View File

@ -58,6 +58,8 @@ class Plugin_OBJ():
vlc_proc.communicate()
vlc_proc.kill()
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()
# raise TunerError("806 - Tune Failed")