mirror of
https://github.com/fHDHR/fHDHR_NextPVR.git
synced 2025-12-06 16:56:57 -05:00
Compare commits
No commits in common. "9c72f30a99524e6695d61b5a4943ebfbe9fee17b" and "0de184c2428aedaf97314d276f62143da0a122be" have entirely different histories.
9c72f30a99
...
0de184c242
@ -57,7 +57,7 @@ class Tuners():
|
||||
raise TunerError("805 - All Tuners In Use")
|
||||
|
||||
tunernumber = self.get_available_tuner(origin)
|
||||
self.tuners[origin][str(tunernumber)].channel_scan(origin)
|
||||
self.tuners[str(tunernumber)].channel_scan(origin)
|
||||
|
||||
if not tunernumber:
|
||||
raise TunerError("805 - All Tuners In Use")
|
||||
|
||||
@ -17,7 +17,7 @@ class Stream():
|
||||
self.method = Direct_Stream(fhdhr, stream_args, tuner)
|
||||
else:
|
||||
plugin_name = self.fhdhr.config.dict["streaming"]["valid_methods"][stream_args["method"]]["plugin"]
|
||||
self.method = self.fhdhr.plugins.plugins[plugin_name].Plugin_OBJ(fhdhr, self.fhdhr.plugins.plugins[plugin_name].plugin_utils, stream_args, tuner)
|
||||
self.method = self.fhdhr.plugins.plugins[plugin_name].Plugin_OBJ(self.fhdhr.plugins.plugins[plugin_name].plugin_utils, stream_args, tuner)
|
||||
|
||||
def get(self):
|
||||
return self.method.get()
|
||||
|
||||
@ -101,8 +101,6 @@ 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")
|
||||
|
||||
|
||||
@ -64,8 +64,6 @@ 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")
|
||||
|
||||
|
||||
@ -43,6 +43,3 @@ 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"]
|
||||
|
||||
@ -26,7 +26,7 @@ class Channels():
|
||||
|
||||
origin_methods = self.fhdhr.origins.valid_origins
|
||||
origin = request.args.get('origin', default=None, type=str)
|
||||
if origin and origin not in origin_methods:
|
||||
if origin not in origin_methods:
|
||||
return "%s Invalid channels origin" % origin
|
||||
|
||||
if method == "get":
|
||||
|
||||
@ -63,13 +63,6 @@ class M3U():
|
||||
channel_items.append(channel_obj)
|
||||
else:
|
||||
return "Channel Disabled"
|
||||
elif not origin and channel == "all":
|
||||
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
|
||||
@ -95,7 +88,7 @@ class M3U():
|
||||
"tvg-name": str(channel_obj.dict['name']),
|
||||
"tvg-id": str(channel_obj.number),
|
||||
"tvg-logo": logourl,
|
||||
"group-title": channel_obj.origin,
|
||||
"group-title": self.fhdhr.config.dict["fhdhr"]["friendlyname"],
|
||||
"group-titleb": str(channel_obj.dict['name']),
|
||||
"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:
|
||||
return "%s Invalid channels origin" % origin
|
||||
|
||||
channel_info_w3u = {
|
||||
channel_info_m3u = {
|
||||
"name": self.fhdhr.config.dict["fhdhr"]["friendlyname"],
|
||||
"image": '%s/favicon.ico' % base_url,
|
||||
"epg": '%s/api/xmltv' % base_url,
|
||||
@ -42,35 +42,28 @@ class W3U():
|
||||
|
||||
if origin:
|
||||
if channel == "all":
|
||||
fileName = "channels.w3u"
|
||||
fileName = "channels.m3u"
|
||||
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.w3u" % channel_obj.number
|
||||
fileName = "%s.m3u" % 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.w3u" % channel_obj.number
|
||||
fileName = "%s.m3u" % channel_obj.number
|
||||
if channel_obj.enabled:
|
||||
channel_items.append(channel_obj)
|
||||
else:
|
||||
return "Channel Disabled"
|
||||
elif not origin and channel == "all":
|
||||
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.w3u" % channel_obj.number
|
||||
fileName = "%s.m3u" % channel_obj.number
|
||||
if channel_obj.enabled:
|
||||
channel_items.append(channel_obj)
|
||||
else:
|
||||
@ -98,9 +91,9 @@ class W3U():
|
||||
# Sort the channels
|
||||
sorted_channel_list = channel_sort(list(channels_info.keys()))
|
||||
for channel in sorted_channel_list:
|
||||
channel_info_w3u["stations"].append(channels_info[channel])
|
||||
channel_info_m3u["stations"].append(channels_info[channel])
|
||||
|
||||
channels_info_json = json.dumps(channel_info_w3u, indent=4)
|
||||
channels_info_json = json.dumps(channel_info_m3u, indent=4)
|
||||
|
||||
resp = Response(status=200, response=channels_info_json, mimetype='application/json')
|
||||
resp.headers["content-disposition"] = "attachment; filename=%s" % fileName
|
||||
|
||||
@ -36,10 +36,9 @@ 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&origin=%s&redirect=/channels_editor&origin=%s" % (origin, origin)
|
||||
postForm.action = "/api/channels?method=modify&redirect=/channels_editor"
|
||||
postForm.setRequestHeader = "('Content-Type', 'application/json')"
|
||||
|
||||
postData = document.createElement('input')
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
{% 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">
|
||||
|
||||
@ -23,8 +23,7 @@ def setup(plugin):
|
||||
|
||||
class Plugin_OBJ():
|
||||
|
||||
def __init__(self, fhdhr, plugin_utils, stream_args, tuner):
|
||||
self.fhdhr = fhdhr
|
||||
def __init__(self, plugin_utils, stream_args, tuner):
|
||||
self.plugin_utils = plugin_utils
|
||||
self.stream_args = stream_args
|
||||
self.tuner = tuner
|
||||
@ -58,8 +57,6 @@ 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")
|
||||
|
||||
|
||||
@ -23,8 +23,7 @@ def setup(plugin):
|
||||
|
||||
class Plugin_OBJ():
|
||||
|
||||
def __init__(self, fhdhr, plugin_utils, stream_args, tuner):
|
||||
self.fhdhr = fhdhr
|
||||
def __init__(self, plugin_utils, stream_args, tuner):
|
||||
self.plugin_utils = plugin_utils
|
||||
self.stream_args = stream_args
|
||||
self.tuner = tuner
|
||||
@ -59,8 +58,6 @@ 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")
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user