Skip to content

Commit

Permalink
Added URL Path Only checking
Browse files Browse the repository at this point in the history
  • Loading branch information
rocky4546 committed Nov 5, 2024
1 parent c6dd403 commit 03ae1be
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
14 changes: 13 additions & 1 deletion lib/streams/m3u8_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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:
Expand Down Expand Up @@ -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

Expand All @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 03ae1be

Please sign in to comment.