git @ Cat's Eye Technologies kinoje / c91730c
Fix libdir command param, and other things about the renderer. Chris Pressey 2 years ago
4 changed file(s) with 15 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
00 duration: 1.44
1 command_template: povray +L{indir} -D +I{infile} +O{outfile} +W{width} +H{height} +A
1 command_template: povray +L{libdir} -D +I{infile} +O{outfile} +W{width} +H{height} +A
22 template: |-
33 global_settings { assumed_gamma 2.2 }
44
00 duration: 2.0
1 width: 400
2 height: 400
13 command_template: inkscape -z -e {outfile} -w {width} -h {height} {infile}
24 template: |-
35 <?xml version="1.0" standalone="no"?>
1414 class Renderer(object):
1515 """Takes a source directory filled with text files and a destination directory and
1616 creates one image file in the destination directory from each text file in the source."""
17 def __init__(self, command_template, src, dest, exe, width=320, height=200):
18 self.command_template = command_template
17 def __init__(self, config, src, dest, exe):
18 self.command_template = config['command_template']
19 self.libdir = config['libdir']
1920 self.src = src
2021 self.dest = dest
2122 self.exe = exe
22 self.width = width
23 self.height = height
23 self.width = config['width']
24 self.height = config['height']
2425
2526 def render_all(self):
2627 for filename in sorted(os.listdir(self.src)):
3435 def render(self, frame, full_srcname, full_destname):
3536 cmd = self.command_template.format(
3637 infile=full_srcname,
37 indir=self.src,
38 libdir=self.libdir,
3839 outfile=full_destname,
3940 width=self.width,
4041 height=self.height
5758
5859 options = argparser.parse_args(sys.argv[1:])
5960
60 with open(options.configfile, 'r') as file_:
61 config = yaml.load(file_, Loader=Loader)
61 config = load_config_file(options.configfile)
6262
63 exe = LoggingExecutor('movie.log')
63 exe = LoggingExecutor('renderer.log')
6464
65 renderer = Renderer(config['command_template'], options.instantsdir, options.framesdir, exe)
65 renderer = Renderer(config, options.instantsdir, options.framesdir, exe)
6666 renderer.render_all()
6767
6868 exe.close()
0 import os
01 import sys
12 from subprocess import check_call
23
1011
1112 with open(filename, 'r') as file_:
1213 config = yaml.load(file_, Loader=Loader)
14
15 config['libdir'] = os.path.dirname(filename)
1316
1417 config['start'] = float(config.get('start', 0.0))
1518 config['stop'] = float(config.get('stop', 1.0))