Skip to content

Commit 645c5ab

Browse files
committed
fix: check FFmpeg availability without sudo
1 parent 0120091 commit 645c5ab

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

clefincode_chat/setup/install.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import frappe
2-
import subprocess
2+
import shutil
33

44
def ensure_contact_custom_fields():
55
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
@@ -17,7 +17,7 @@ def after_install():
1717
ensure_contact_custom_fields()
1818
create_roles()
1919
create_users_profiles()
20-
install_ffmpeg()
20+
check_ffmpeg()
2121
add_default_limited_roles()
2222
# =================================================================================
2323
def create_roles():
@@ -101,12 +101,9 @@ def create_users_profiles():
101101

102102
frappe.db.commit()
103103
# =================================================================================
104-
def install_ffmpeg():
105-
try:
106-
subprocess.run(["sudo", "apt", "update", "--fix-missing" , "-y",], check=True)
107-
subprocess.run(["sudo", "apt", "install", "ffmpeg", "--fix-missing" , "-y"], check=True)
108-
except subprocess.CalledProcessError as e:
109-
print(f"An error occurred: {e}")
104+
def check_ffmpeg():
105+
if not shutil.which("ffmpeg"):
106+
print("Warning: FFmpeg is not installed. Install it manually to enable audio and video processing.")
110107
# =================================================================================
111108

112109
def add_default_limited_roles():

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[deploy.dependencies.apt]
2+
packages = ["ffmpeg"]

0 commit comments

Comments
 (0)