mirror of
https://github.com/mediacms-io/mediacms.git
synced 2026-06-06 17:13:02 -04:00
fix: update documentation and fix smaller issues (#1520)
This commit is contained in:
+13
-9
@@ -453,17 +453,21 @@ def kill_ffmpeg_process(filepath):
|
||||
filepath: Path to the file being processed by ffmpeg
|
||||
|
||||
Returns:
|
||||
subprocess.CompletedProcess: Result of the kill command
|
||||
bool: True if the lookup ran, False if input was unusable
|
||||
"""
|
||||
if not filepath:
|
||||
if not filepath or not isinstance(filepath, str):
|
||||
return False
|
||||
cmd = "ps aux|grep 'ffmpeg'|grep %s|grep -v grep |awk '{print $2}'" % filepath
|
||||
result = subprocess.run(cmd, stdout=subprocess.PIPE, shell=True)
|
||||
pid = result.stdout.decode("utf-8").strip()
|
||||
if pid:
|
||||
cmd = "kill -9 %s" % pid
|
||||
result = subprocess.run(cmd, stdout=subprocess.PIPE, shell=True)
|
||||
return result
|
||||
try:
|
||||
ps = subprocess.run(["ps", "aux"], stdout=subprocess.PIPE, check=False)
|
||||
except OSError:
|
||||
return False
|
||||
for line in ps.stdout.decode("utf-8", "replace").splitlines():
|
||||
if "ffmpeg" not in line or filepath not in line or "grep" in line:
|
||||
continue
|
||||
parts = line.split()
|
||||
if len(parts) > 1 and parts[1].isdigit():
|
||||
subprocess.run(["kill", "-9", parts[1]], check=False)
|
||||
return True
|
||||
|
||||
|
||||
def copy_video(original_media, copy_encodings=True, title_suffix="(Trimmed)"):
|
||||
|
||||
Reference in New Issue
Block a user