Simplify orchestrator.
Chris Pressey
4 years ago
11 | 11 | |
12 | 12 | from kinoje.expander import Expander |
13 | 13 | from kinoje.renderer import Renderer |
14 | from kinoje.compiler import Compiler | |
14 | from kinoje.compiler import Compiler, SUPPORTED_OUTPUT_FORMATS | |
15 | 15 | |
16 | 16 | from kinoje.utils import LoggingExecutor, load_config_file |
17 | ||
18 | ||
19 | SUPPORTED_OUTPUT_FORMATS = ('.m4v', '.mp4', '.gif') | |
20 | 17 | |
21 | 18 | |
22 | 19 | def main(): |
41 | 38 | output_filename = configbase + '.mp4' |
42 | 39 | else: |
43 | 40 | output_filename = options.output |
44 | (whatever, outext) = os.path.splitext(output_filename) | |
45 | if outext not in SUPPORTED_OUTPUT_FORMATS: | |
46 | raise ValueError("%s not a supported output format (%r)" % (outext, SUPPORTED_OUTPUT_FORMATS)) | |
41 | ||
42 | CompilerClass = Compiler.get_class_for(output_filename) | |
47 | 43 | |
48 | 44 | config = load_config_file(options.configfile) |
49 | 45 | |
62 | 58 | renderer.render_all() |
63 | 59 | |
64 | 60 | print('compiling frames to movie...') |
65 | compiler = Compiler.get_class_for(output_filename)(config, frames_dir, output_filename, exe=exe, tqdm=tqdm) | |
61 | compiler = CompilerClass(config, frames_dir, output_filename, exe=exe, tqdm=tqdm) | |
66 | 62 | compiler.compile_all() |
67 | 63 | |
68 | 64 | exe.close() |