From 9ead239c9f4f62853a1448a8eb260cb2447b3011 Mon Sep 17 00:00:00 2001 From: PavelMuhortov Date: Sun, 20 Jun 2021 19:22:46 +0300 Subject: [PATCH] remove '_kill' method --- ffmpeger.py | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/ffmpeger.py b/ffmpeger.py index 21eaffb..a06830d 100644 --- a/ffmpeger.py +++ b/ffmpeger.py @@ -65,12 +65,10 @@ class FFmpeg: '\tDownload and extract archive from: https://evermeet.cx/ffmpeg/\n' '\tTarget: /usr/bin/ffmpeg\n') if not path_ffmpeg: - if platform.startswith('linux'): + if platform.startswith('linux') or platform.startswith('darwin'): path_ffmpeg = '/usr/bin/ffmpeg' elif platform.startswith('win32'): path_ffmpeg = environ['PROGRAMFILES'] + "\\ffmpeg\\bin\\ffmpeg.exe" - elif platform.startswith('darwin'): - path_ffmpeg = '/usr/bin/ffmpeg' if path.exists(path_ffmpeg): return path_ffmpeg else: @@ -164,25 +162,11 @@ class FFmpeg: print(que.get()) sleep(sec) if que.empty(): - cls._kill(pid) + Proc.kill(pid) print('exit by watchdog') break exit() - @classmethod - def _kill(cls, pid: int): - """ - Kill the process by means of the OS - :param pid: process ID - :return: None - """ - if platform.startswith('linux'): - Popen(['kill', '-s', 'SIGKILL', str(pid)]) - elif platform.startswith('win32'): - Popen(['taskkill', '/PID', str(pid), '/F']) - elif platform.startswith('darwin'): - Popen(['kill', '-s', 'SIGKILL', str(pid)]) - if __name__ == "__main__": from argparse import ArgumentParser