Debian Codegraph @

flowblade-trunk/Flowblade/launch/flowbladestabilizedvideoheadless

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 stabilizedvideoheadless
23 import editorstate # Used to decide which translations from file system are used
24 root_dir = modules_path.split("/")[1]
25
26 # And we need this for translations?
27 if root_dir != "home":
28 editorstate.app_running_from = editorstate.RUNNING_FROM_INSTALLATION
29 else:
30 editorstate.app_running_from = editorstate.RUNNING_FROM_DEV_VERSION
31
32 session_id = _get_arg_value(sys.argv, "session_id")
33 parent_folder = _get_arg_value(sys.argv, "parent_folder")
34 write_file = _get_arg_value(sys.argv, "write_file")
35 results_file = _get_arg_value(sys.argv, "results_file")
36 encoding_option_index = _get_arg_value(sys.argv, "encoding_option_index")
37 quality_option_index = _get_arg_value(sys.argv, "quality_option_index")
38 source_path = _get_arg_value(sys.argv, "source_path")
39 profile_desc_under_score = _get_arg_value(sys.argv, "profile_desc")
40 profile_desc = profile_desc_under_score.replace("_", " ") # We need to put underscores in profile names to get them here in one piece.
41 # Now we take underscores out to get correct MLT profile names.
42 except Exception as err:
43 print ("Failed to import mltxmlheadless")
44 print ("ERROR:", err)
45 print ("Installation was assumed to be at:", modules_path)
46 sys.exit(1)
47
48 stabilizedvideoheadless.main( modules_path, session_id, parent_folder, write_file, results_file, profile_desc, encoding_option_index,
49 quality_option_index, source_path)