python version screwup workaround

This commit is contained in:
Carsten Burgard 2022-04-15 15:53:30 +02:00
parent 280cbaed92
commit 60ef54d8e4

View File

@ -318,18 +318,22 @@ class Plex(commands.Cog):
self.np_message_id = await self.ctx.send(embed=embed, file=img) self.np_message_id = await self.ctx.send(embed=embed, file=img)
async def _play_next(self): async def _play_next(self):
try:
from asyncio.exceptions import CancelledError
except ImportError:
from concurrent.futures._base import CancelledError
if self.is_looping: if self.is_looping:
self.current_track = self.is_looping self.current_track = self.is_looping
else: else:
try: try:
self.current_track = await self.play_queue.get() self.current_track = await self.play_queue.get()
except asyncio.exceptions.CancelledError: except CancelledError:
bot_log.debug("failed to pop queue") bot_log.debug("failed to pop queue")
if not self.current_track and self.loop_queue: if not self.current_track and self.loop_queue:
try: try:
self.current_track = await self.loop_queue.get() self.current_track = await self.loop_queue.get()
except asyncio.exceptions.CancelledError: except CancelledError:
bot_log.debug("failed to pop queue") bot_log.debug("failed to pop queue")
self.play_queue = self.loop_queue self.play_queue = self.loop_queue
self.loop_queue = asyncio.Queue() self.loop_queue = asyncio.Queue()