From 3af5fc96bfe7d6fd48cf19418fa63ac8eb47b8c9 Mon Sep 17 00:00:00 2001 From: rocky4546 <24759693+rocky4546@users.noreply.github.com> Date: Thu, 23 Sep 2021 08:06:33 -0500 Subject: [PATCH 1/4] Update decorators.py Reduce retries so it only tries twice before giving up. --- lib/common/decorators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/common/decorators.py b/lib/common/decorators.py index e0f7e13..9983db6 100755 --- a/lib/common/decorators.py +++ b/lib/common/decorators.py @@ -37,7 +37,7 @@ def handle_url_except(f=None, timeout=None): return functools.partial(handle_url_except, timeout=timeout) def wrapper_func(self, *args, **kwargs): ex_save = '' - i = 3 + i = 2 while i > 0: i -= 1 try: From 3f949115716a07a856cec831a2d1d1e6899819cd Mon Sep 17 00:00:00 2001 From: rocky4546 <24759693+rocky4546@users.noreply.github.com> Date: Thu, 23 Sep 2021 08:10:33 -0500 Subject: [PATCH 2/4] Change timeout from 1 second to 5 seconds With durations of sections being mostly around 6 seconds and the 2 tries it takes to time out, having more than 5 seconds would lead to missing sections. --- lib/streams/m3u8_queue.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/streams/m3u8_queue.py b/lib/streams/m3u8_queue.py index 5959660..34d0c36 100755 --- a/lib/streams/m3u8_queue.py +++ b/lib/streams/m3u8_queue.py @@ -73,11 +73,11 @@ def __init__(self, _config, _channel_dict): self.key_list = {} self.start() - @handle_url_except(timeout=1.0) + @handle_url_except() def get_uri_data(self, _uri): header = {'User-agent': utils.DEFAULT_USER_AGENT} req = urllib.request.Request(_uri, headers=header) - with urllib.request.urlopen(req, timeout=1.0) as resp: + with urllib.request.urlopen(req, timeout=5.0) as resp: x = resp.read() return x @@ -384,13 +384,13 @@ def remove_from_stream_queue(self, _playlist): def start(_config, _plugins, _m3u8_queue, _data_queue, _channel_dict, extra=None): """ - All items in this process must handle a socket timeout of 1.0 + All items in this process must handle a socket timeout of 5.0 """ global IN_QUEUE global STREAM_QUEUE global OUT_QUEUE global TERMINATE_REQUESTED - socket.setdefaulttimeout(1.0) + socket.setdefaulttimeout(5.0) IN_QUEUE = _m3u8_queue STREAM_QUEUE = Queue() OUT_QUEUE = _data_queue @@ -407,5 +407,5 @@ def start(_config, _plugins, _m3u8_queue, _data_queue, _channel_dict, extra=None except (KeyboardInterrupt, EOFError): TERMINATE_REQUESTED = True STREAM_QUEUE.put({'uri': 'terminate'}) - time.sleep(1.0) + time.sleep(5.0) sys.exit() From 383c3ddae1cfecf733335e1ff046669f90070ccc Mon Sep 17 00:00:00 2001 From: rocky4546 <24759693+rocky4546@users.noreply.github.com> Date: Thu, 23 Sep 2021 08:14:09 -0500 Subject: [PATCH 3/4] generate blank msg at start of video --- lib/streams/internal_proxy.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/streams/internal_proxy.py b/lib/streams/internal_proxy.py index f74b551..cac8336 100755 --- a/lib/streams/internal_proxy.py +++ b/lib/streams/internal_proxy.py @@ -69,7 +69,7 @@ def __init__(self, _plugins, _hdhr_queue): self.out_queue = Queue(maxsize=3) self.terminate_queue = None self.tc_match = re.compile( r'^.+[^\d]+(\d*)\.ts' ) - self.idle_counter = 0 + self.idle_counter = 30 def terminate(self, *args): try: @@ -103,7 +103,6 @@ def stream(self, _channel_dict, _wfile, _terminate_queue): self.wfile = _wfile self.terminate_queue = _terminate_queue - while True: try: self.check_termination() From b356d540f3521533aeb8b1a7e8d66634e729bc0f Mon Sep 17 00:00:00 2001 From: rocky4546 <24759693+rocky4546@users.noreply.github.com> Date: Thu, 23 Sep 2021 08:47:18 -0500 Subject: [PATCH 4/4] roll version --- lib/common/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/common/utils.py b/lib/common/utils.py index d02f43d..8caa179 100755 --- a/lib/common/utils.py +++ b/lib/common/utils.py @@ -34,7 +34,7 @@ import lib.common.exceptions as exceptions -VERSION = '0.9.3.9' +VERSION = '0.9.3.10' CABERNET_URL = 'https://github.com/cabernetwork/cabernet' CABERNET_NAMESPACE = 'Cabernet' DEFAULT_USER_AGENT = 'Mozilla/5.0'