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'
|
'\tDownload and extract archive from: https://evermeet.cx/ffmpeg/\n'
|
||||||
'\tTarget: /usr/bin/ffmpeg\n')
|
'\tTarget: /usr/bin/ffmpeg\n')
|
||||||
if not path_ffmpeg:
|
if not path_ffmpeg:
|
||||||
if platform.startswith('linux'):
|
if platform.startswith('linux') or platform.startswith('darwin'):
|
||||||
path_ffmpeg = '/usr/bin/ffmpeg'
|
path_ffmpeg = '/usr/bin/ffmpeg'
|
||||||
elif platform.startswith('win32'):
|
elif platform.startswith('win32'):
|
||||||
path_ffmpeg = environ['PROGRAMFILES'] + "\\ffmpeg\\bin\\ffmpeg.exe"
|
path_ffmpeg = environ['PROGRAMFILES'] + "\\ffmpeg\\bin\\ffmpeg.exe"
|
||||||
elif platform.startswith('darwin'):
|
|
||||||
path_ffmpeg = '/usr/bin/ffmpeg'
|
|
||||||
if path.exists(path_ffmpeg):
|
if path.exists(path_ffmpeg):
|
||||||
return path_ffmpeg
|
return path_ffmpeg
|
||||||
else:
|
else:
|
||||||
|
@ -164,25 +162,11 @@ class FFmpeg:
|
||||||
print(que.get())
|
print(que.get())
|
||||||
sleep(sec)
|
sleep(sec)
|
||||||
if que.empty():
|
if que.empty():
|
||||||
cls._kill(pid)
|
Proc.kill(pid)
|
||||||
print('exit by watchdog')
|
print('exit by watchdog')
|
||||||
break
|
break
|
||||||
exit()
|
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__":
|
if __name__ == "__main__":
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
|
|
Loading…
Reference in New Issue
Block a user