Find ffmpeg exec function from Lutris.net
This commit is contained in:
parent
cb556f53d5
commit
b98d0d2c73
1 changed files with 27 additions and 2 deletions
|
@ -41,13 +41,34 @@ params = {
|
|||
"recursive": False}
|
||||
|
||||
VERSION = "0.1dev"
|
||||
exec_ffmpeg = os.path.join("ffmpeg")
|
||||
|
||||
|
||||
def log(msg):
|
||||
sys.stdout.write(msg + "\n")
|
||||
|
||||
|
||||
def execute(command, shell=False):
|
||||
"""
|
||||
Execute a system command and return its results.
|
||||
Thanxx Strycote from Lutyris.net
|
||||
"""
|
||||
try:
|
||||
stdout, stderr = subprocess.Popen(command,
|
||||
shell=shell,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE).communicate()
|
||||
except OSError as ex:
|
||||
print('Could not run command %s: %s', command, ex)
|
||||
return
|
||||
return stdout.strip()
|
||||
|
||||
|
||||
def find_executable(exec_name):
|
||||
if not exec_name:
|
||||
raise ValueError("find_executable: exec_name required")
|
||||
return execute(['which', exec_name])
|
||||
|
||||
|
||||
def listFile(directory, pattern, recursive):
|
||||
log("searching in directory" + directory)
|
||||
files_list = []
|
||||
|
@ -159,7 +180,11 @@ def encode_h264(src, dest):
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
log("export_video v" + VERSION + "FFMPEG exec " + exec_ffmpeg)
|
||||
exec_ffmpeg = find_executable("ffmpeg")
|
||||
if not exec_ffmpeg:
|
||||
log("ffmpeg not found, exiting")
|
||||
sys.exit(2)
|
||||
# log("export_video v" + VERSION + "FFMPEG exec " + exec_ffmpeg)
|
||||
processArg(sys.argv[1:])
|
||||
if not params["file_input"]:
|
||||
log("you must specify a file / directory" + params["file_input"])
|
||||
|
|
Reference in a new issue