Debian Codegraph @

flowblade-trunk/Flowblade/launch/flowbladetrackingheadless

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 print("process trackingheadless PID:", os.getpid())
22
23 try:
24 import trackingheadless
25 root_dir = modules_path.split("/")[1]
26
27 session_id = _get_arg_value(sys.argv, "session_id")
28 parent_folder = _get_arg_value(sys.argv, "parent_folder")
29 write_file = _get_arg_value(sys.argv, "write_file")
30 data_file_path = _get_arg_value(sys.argv, "data_file_path")
31 clip_path = _get_arg_value(sys.argv, "clip_path")
32 clip_in = _get_arg_value(sys.argv, "clip_in")
33 clip_out = _get_arg_value(sys.argv, "clip_out")
34 step = _get_arg_value(sys.argv, "step")
35 algo = _get_arg_value(sys.argv, "algo")
36 rect_under_score = _get_arg_value(sys.argv, "rect")
37 rect = rect_under_score.replace("_", " ")
38 profile_desc_under_score = _get_arg_value(sys.argv, "profile_desc")
39 profile_desc = profile_desc_under_score.replace("_", " ") # We need to put underscores in profile names to get them here in one piece.
40 # Now we take underscores out to get correct MLT profile names.
41 except Exception as err:
42 print ("Failed to import trackingheadless")
43 print ("ERROR:", err)
44 print ("Installation was assumed to be at:", modules_path)
45 sys.exit(1)
46
47 trackingheadless.main(modules_path, session_id, parent_folder, profile_desc, clip_path, clip_in, clip_out, write_file, data_file_path, step, algo, rect)
48
49
50
51