Debian Codegraph @

flowblade-trunk/Flowblade/launch/flowblademotionheadless

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 motionheadless
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 speed = _get_arg_value(sys.argv, "speed")
35 write_file = _get_arg_value(sys.argv, "write_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 render_full_range = _get_arg_value(sys.argv, "render_full_range")
40 start_frame = _get_arg_value(sys.argv, "start_frame")
41 end_frame = _get_arg_value(sys.argv, "end_frame")
42 profile_desc_under_score = _get_arg_value(sys.argv, "profile_desc")
43 profile_desc = profile_desc_under_score.replace("_", " ") # We need to put underscores in profile names to get them here in one piece.
44 # Now we take underscores out to get correct MLT profile names.
45 except Exception as err:
46 print ("Failed to import mltxmlheadless")
47 print ("ERROR:", err)
48 print ("Installation was assumed to be at:", modules_path)
49 sys.exit(1)
50
51 motionheadless.main(modules_path, session_id, parent_folder, speed, write_file, profile_desc, encoding_option_index,
52 quality_option_index, source_path, render_full_range, start_frame, end_frame)
53
54
55
56