mirror of
https://github.com/MichaByte/OnBoard-Live.git
synced 2025-12-06 10:53:41 -05:00
make random picker avoid same stream 2x in a row
This commit is contained in:
parent
60c7f70fe5
commit
5582a0ffae
1 changed files with 7 additions and 2 deletions
|
|
@ -27,8 +27,13 @@ async def update_active():
|
|||
for stream in streams:
|
||||
if stream["ready"]:
|
||||
active_streams.append(stream)
|
||||
active_stream = choice(active_streams)["name"]
|
||||
|
||||
try:
|
||||
new_stream = choice(active_streams)["name"]
|
||||
while new_stream == active_stream:
|
||||
new_stream = choice(active_streams)["name"]
|
||||
active_stream = new_stream
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
async def init_active_update_task():
|
||||
global active_stream
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue