diff --git a/Handlers/PlayHandler.py b/Handlers/PlayHandler.py index 218db30..3463010 100644 --- a/Handlers/PlayHandler.py +++ b/Handlers/PlayHandler.py @@ -14,6 +14,7 @@ from Parallelism.Commands import VCommands, VCommandsType from Music.VulkanBot import VulkanBot from typing import Union from discord import Interaction +from Music.Playlist import Playlist class PlayHandler(AbstractHandler): @@ -38,7 +39,7 @@ class PlayHandler(AbstractHandler): # Get the process context for the current guild processManager = self.config.getProcessManager() processInfo = processManager.getOrCreatePlayerInfo(self.guild, self.ctx) - playlist = processInfo.getPlaylist() + playlist: Playlist = processInfo.getPlaylist() process = processInfo.getProcess() if not process.is_alive(): # If process has not yet started, start process.start() diff --git a/Parallelism/PlayerProcess.py b/Parallelism/PlayerProcess.py index f20611e..836ddd9 100644 --- a/Parallelism/PlayerProcess.py +++ b/Parallelism/PlayerProcess.py @@ -119,6 +119,7 @@ class PlayerProcess(Process): if song is not None: self.__loop.create_task(self.__playSong(song), name=f'Song {song.identifier}') + self.__playing = True async def __playSong(self, song: Song) -> None: """Function that will trigger the player to play the song""" @@ -139,7 +140,7 @@ class PlayerProcess(Process): return self.__playing = True - self.__playingSong = song + self.__songPlaying = song player = FFmpegPCMAudio(song.source, **self.FFMPEG_OPTIONS) self.__guild.voice_client.play(player, after=lambda e: self.__playNext(e)) @@ -168,7 +169,7 @@ class PlayerProcess(Process): self.__loop.create_task(self.__playSong(song), name=f'Song {song.identifier}') else: self.__playlist.loop_off() - self.__playingSong = None + self.__songPlaying = None self.__playing = False # Send a command to the main process put this one to sleep sleepCommand = VCommands(VCommandsType.SLEEPING) @@ -253,7 +254,7 @@ class PlayerProcess(Process): sleepCommand = VCommands(VCommandsType.SLEEPING) self.__queueSend.put(sleepCommand) self.__guild.voice_client.stop() - self.__playingSong = None + self.__songPlaying = None await self.__guild.voice_client.disconnect() self.__semStopPlaying.release() diff --git a/Parallelism/ProcessManager.py b/Parallelism/ProcessManager.py index ccfc667..d0792d1 100644 --- a/Parallelism/ProcessManager.py +++ b/Parallelism/ProcessManager.py @@ -65,6 +65,7 @@ class ProcessManager(Singleton): def getRunningPlayerInfo(self, guild: Guild) -> ProcessInfo: """Return the process info for the guild, if not, return None""" if guild.id not in self.__playersProcess.keys(): + print('Process Info not found') return None return self.__playersProcess[guild.id] diff --git a/requirements.txt b/requirements.txt index 476b8f1..d0e0801 100644 Binary files a/requirements.txt and b/requirements.txt differ