| 1 |
#!/usr/bin/python3 |
| 2 |
|
| 3 |
import sys |
| 4 |
import os |
| 5 |
|
| 6 |
def _get_arg_value(args, key_str): |
| 7 |
for arg in sys.argv: |
| 8 |
parts = arg.split(":") |
| 9 |
if len(parts) > 1: |
| 10 |
if parts[0] == key_str: |
| 11 |
return parts[1] |
| 12 |
|
| 13 |
return None |
| 14 |
|
| 15 |
modules_path = os.path.dirname(os.path.abspath(sys.argv[0])).rstrip("/launch") |
| 16 |
|
| 17 |
sys.path.insert(0, modules_path) |
| 18 |
import processutils |
| 19 |
processutils.update_sys_path(modules_path) |
| 20 |
|
| 21 |
try: |
| 22 |
import mltxmlheadless |
| 23 |
import editorstate # Used to decide which translations from file system are used |
| 24 |
root_dir = modules_path.split("/")[1] |
| 25 |
if root_dir != "home": |
| 26 |
editorstate.app_running_from = editorstate.RUNNING_FROM_INSTALLATION |
| 27 |
else: |
| 28 |
editorstate.app_running_from = editorstate.RUNNING_FROM_DEV_VERSION |
| 29 |
|
| 30 |
session_id = _get_arg_value(sys.argv, "session_id") |
| 31 |
parent_folder = _get_arg_value(sys.argv, "parent_folder") |
| 32 |
xml_file_path = _get_arg_value(sys.argv, "xml_file_path") |
| 33 |
video_file_name = _get_arg_value(sys.argv, "video_file_name") |
| 34 |
range_in = _get_arg_value(sys.argv, "range_in") |
| 35 |
range_out = _get_arg_value(sys.argv, "range_out") |
| 36 |
profile_desc_under_score = _get_arg_value(sys.argv, "profile_desc") |
| 37 |
profile_desc = profile_desc_under_score.replace("_", " ") # We need to put underscores in profile names to get them here in one piece. |
| 38 |
# Now we take underscores out to get correct MLT profile names. |
| 39 |
except Exception as err: |
| 40 |
print ("Failed to import mltxmlheadless") |
| 41 |
print ("ERROR:", err) |
| 42 |
print ("Installation was assumed to be at:", modules_path) |
| 43 |
sys.exit(1) |
| 44 |
|
| 45 |
mltxmlheadless.main(modules_path, session_id, parent_folder, xml_file_path, video_file_name, range_in, range_out, profile_desc) |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|