diff options
| author | Rapptz <[email protected]> | 2017-07-19 05:57:12 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2017-07-19 05:58:20 -0400 |
| commit | 5d75c44651e91b8dd15327c6c5406758d9101e28 (patch) | |
| tree | 649188f7b65805e89539dcb1324653817986cb81 | |
| parent | [commands] Fix Command.root_parent not properly working. (diff) | |
| download | discord.py-5d75c44651e91b8dd15327c6c5406758d9101e28.tar.xz discord.py-5d75c44651e91b8dd15327c6c5406758d9101e28.zip | |
Call cleanup on AudioSource.__del__.
| -rw-r--r-- | discord/player.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/discord/player.py b/discord/player.py index 17056e9c..6b0416df 100644 --- a/discord/player.py +++ b/discord/player.py @@ -84,6 +84,9 @@ class AudioSource: """ pass + def __del__(self): + self.cleanup() + class PCMAudio(AudioSource): """Represents raw 16-bit 48KHz stereo PCM audio source. @@ -169,6 +172,8 @@ class FFmpegPCMAudio(AudioSource): def cleanup(self): proc = self._process + if proc is None: + return log.info('Preparing to terminate ffmpeg process %s.', proc.pid) proc.kill() @@ -179,6 +184,8 @@ class FFmpegPCMAudio(AudioSource): else: log.info('ffmpeg process %s successfully terminated with return code of %s.', proc.pid, proc.returncode) + self._process = None + class PCMVolumeTransformer(AudioSource): """Transforms a previous :class:`AudioSource` to have volume controls. |