init
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
# python/core/shell.py
|
||||
|
||||
import shutil
|
||||
import subprocess
|
||||
from .exceptions import MediaDependencyError
|
||||
|
||||
def check_dependencies():
|
||||
"""检查系统依赖是否已正确安装"""
|
||||
tools = ['ffmpeg', 'ffprobe', 'mkvpropedit', 'mediainfo']
|
||||
missing = [tool for tool in tools if not shutil.which(tool)]
|
||||
if missing:
|
||||
raise MediaDependencyError(f"容器内缺少依赖: {', '.join(missing)}")
|
||||
|
||||
def run_command(cmd: list) -> subprocess.CompletedProcess:
|
||||
"""安全执行终端命令"""
|
||||
return subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
||||
Reference in New Issue
Block a user