From 03ae1bee09b3076e509651853e16cbb613cdb5c0 Mon Sep 17 00:00:00 2001 From: rocky4546 <24759693+rocky4546@users.noreply.github.com> Date: Tue, 5 Nov 2024 14:08:41 -0600 Subject: [PATCH] Added URL Path Only checking --- lib/common/utils.py | 2 +- lib/streams/m3u8_queue.py | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/common/utils.py b/lib/common/utils.py index 38d5334..854d9f1 100644 --- a/lib/common/utils.py +++ b/lib/common/utils.py @@ -37,7 +37,7 @@ import lib.common.exceptions as exceptions -VERSION = '0.9.15.00-RC02' +VERSION = '0.9.15.00-RC03' CABERNET_URL = 'https://github.com/cabernetwork/cabernet' CABERNET_ID = 'cabernet' CABERNET_REPO = 'manifest.json' diff --git a/lib/streams/m3u8_queue.py b/lib/streams/m3u8_queue.py index 5b91e3d..5f2c501 100644 --- a/lib/streams/m3u8_queue.py +++ b/lib/streams/m3u8_queue.py @@ -440,6 +440,7 @@ def __init__(self, _config, _plugins, _channel_dict): PARALLEL_DOWNLOADS = self.config[_channel_dict['namespace'].lower()]['stream-g_concurrent_downloads'] self.config_section = utils.instance_config_section(_channel_dict['namespace'], _channel_dict['instance']) self.use_full_duplicate_checking = self.config[self.config_section]['player-enable_full_duplicate_checking'] + self.use_pathonly_checking = self.config[self.config_section].get('player-enable_pathonly_checking') self.is_running = True self.duration = 6 @@ -599,6 +600,8 @@ def add_to_stream_queue(self, _playlist): for index, segment in enumerate(reversed(_playlist.segments)): if self.use_full_duplicate_checking: uri = segment.absolute_uri + elif self.use_pathonly_checking: + uri = urllib.parse.urlparse(segment.absolute_uri).path else: uri = segment.get_path_from_uri() dt = self.segment_date_time(segment) @@ -622,8 +625,13 @@ def add_segment(self, _segment, _key, _default_played=False): self.set_cue_status(_segment) if self.use_full_duplicate_checking: uri = _segment.absolute_uri + elif self.use_pathonly_checking: + uri = urllib.parse.urlparse(_segment.absolute_uri).path else: uri = _segment.get_path_from_uri() + + + uri_full = _segment.absolute_uri dt = self.segment_date_time(_segment) if self.use_date_on_key: @@ -664,7 +672,7 @@ def add_segment(self, _segment, _key, _default_played=False): # queue is closed, terminating pass else: - self.logger.warning('DUPICATE FOUND {}'.format(uri_dt)) + self.logger.warning('DUPLICATE FOUND {}'.format(uri_dt)) return 0 @@ -682,6 +690,8 @@ def remove_from_stream_queue(self, _playlist): for segment in _playlist.segments[disc_index:total_index]: if self.use_full_duplicate_checking: s_uri = segment.absolute_uri + elif self.use_pathonly_checking: + s_uri = urllib.parse.urlparse(segment.absolute_uri).path else: s_uri = segment.get_path_from_uri() s_dt = self.segment_date_time(segment) @@ -705,6 +715,8 @@ def remove_from_stream_queue(self, _playlist): for segment_m3u8 in _playlist.segments: if self.use_full_duplicate_checking: s_uri = segment_m3u8.absolute_uri + elif self.use_pathonly_checking: + s_uri = urllib.parse.urlparse(segment_m3u8.absolute_uri).path else: s_uri = segment_m3u8.get_path_from_uri() s_dt = self.segment_date_time(segment_m3u8)