Debian Codegraph @

flowblade-trunk/Flowblade/launch/flowbladegmicheadless

raw
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 gmicheadless
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 script = _get_arg_value(sys.argv, "script")
33 clip_path = _get_arg_value(sys.argv, "clip_path")
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 gmic_frame_offset = _get_arg_value(sys.argv, "gmic_frame_offset")
40 except Exception as err:
41 print ("Failed to import gmicheadless")
42 print ("ERROR:", err)
43 print ("Installation was assumed to be at:", modules_path)
44 sys.exit(1)
45
46 gmicheadless.main(modules_path, session_id, parent_folder, script, clip_path, range_in, range_out, profile_desc, gmic_frame_offset)
47
48
49
50