Skip to content

Commit

Permalink
Fix Streamlink processing
Browse files Browse the repository at this point in the history
  • Loading branch information
rocky4546 committed Mar 2, 2023
1 parent 1e6ecf5 commit 78c0af0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

import lib.common.exceptions as exceptions

VERSION = '0.9.9.9'
VERSION = '0.9.9.10'
CABERNET_URL = 'https://github.com/cabernetwork/cabernet'
CABERNET_NAMESPACE = 'Cabernet'
DEFAULT_USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:92.0) Gecko/20100101 Firefox/92.0'
Expand Down
15 changes: 10 additions & 5 deletions lib/streams/streamlink_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ def stream(self, _channel_dict, _write_buffer):
self.logger.warning('Unknown Channel {}'.format(_channel_dict['uid']))
return
self.streamlink_proc = self.open_streamlink_proc(channel_uri)
if not self.streamlink_proc:
return
time.sleep(0.01)
self.last_refresh = time.time()
self.block_prev_time = self.last_refresh
Expand Down Expand Up @@ -196,18 +198,21 @@ def open_streamlink_proc(self, _channel_uri):
self.config['paths']['streamlink_path'],
'--stdout',
'--quiet',
'--hds-segment-threads', '2',
'--ffmpeg-fout', 'mpegts',
'--hls-segment-attempts', '2',
'--hls-segment-timeout', '5',
uri,
'720,best'
]
streamlink_command.extend(str_array)
streamlink_process = subprocess.Popen(
streamlink_command,
stdout=subprocess.PIPE,
bufsize=-1)
try:
streamlink_process = subprocess.Popen(
streamlink_command,
stdout=subprocess.PIPE,
bufsize=-1)
except:
self.logger.error('Streamlink Binary Not Found: {}'.format(self.config['paths']['streamlink_path']))
return
self.stream_queue = StreamQueue(188, streamlink_process, self.channel_dict['uid'])
time.sleep(0.1)
return streamlink_process

0 comments on commit 78c0af0

Please sign in to comment.