Skip to content

Commit

Permalink
poll stats until stream starts
Browse files Browse the repository at this point in the history
fixes issue #29
  • Loading branch information
jonian committed Sep 30, 2018
1 parent a2964eb commit e7607f9
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions acestream_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __init__(self, host='127.0.0.1', port='6878', timeout=10, output=subprocess.
self.port = port
self.wait = timeout
self.live = False
self.poll = False
self.poll = True
self.stdo = { 'stdout': output, 'stderr': output }

@property
Expand Down Expand Up @@ -174,14 +174,12 @@ def open_stream(self, url, emit_stats=False):
setattr(self, key, output_res[key])

self.emit('message', 'waiting')

if emit_stats:
self.poll = True
self.poll_stats()
self.poll_stats()

while not self.live:
time.sleep(1)

self.poll = emit_stats
self.emit('message', 'started')

def close_stream(self):
Expand Down

0 comments on commit e7607f9

Please sign in to comment.