1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-24 03:54:20 +00:00

actually this is a better fix

This commit is contained in:
Steffo 2018-12-24 21:35:03 +01:00
parent 197908991c
commit f2c624f86e

View file

@ -333,7 +333,7 @@ class VideoQueue:
def not_ready_videos(self, limit: typing.Optional[int] = None): def not_ready_videos(self, limit: typing.Optional[int] = None):
"""Return the non-ready videos in the first limit positions of the queue.""" """Return the non-ready videos in the first limit positions of the queue."""
video_list = [] video_list = []
for video in self.list[:limit]: for video in (self.list[:limit] + [self.now_playing]):
if not video.is_ready: if not video.is_ready:
video_list.append(video) video_list.append(video)
return video_list return video_list
@ -672,8 +672,7 @@ class RoyalDiscordBot(discord.Client):
while True: while True:
await asyncio.sleep(1) await asyncio.sleep(1)
# Might have some problems with del # Might have some problems with del
for index, video in enumerate(self.video_queue.not_ready_videos(self.max_videos_to_predownload) + for index, video in enumerate(self.video_queue.not_ready_videos(self.max_videos_to_predownload)):
[self.video_queue.now_playing]):
try: try:
with async_timeout.timeout(self.max_video_ready_time): with async_timeout.timeout(self.max_video_ready_time):
await loop.run_in_executor(executor, video.ready_up) await loop.run_in_executor(executor, video.ready_up)