remove '_kill' method
This commit is contained in:
parent
ec3ead528b
commit
9ead239c9f
20
ffmpeger.py
20
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
|
||||
|
|
Loading…
Reference in New Issue
Block a user