git @ Cat's Eye Technologies kinoje / 056cf84
Improve help text. Default output filename does not include dir. Chris Pressey 5 years ago
1 changed file(s) with 15 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
2020 from yaml import CLoader as Loader
2121 except ImportError:
2222 from yaml import Loader
23
24
25 SUPPORTED_OUTPUT_FORMATS = ('.m4v', '.mp4', '.gif')
2326
2427
2528 class LoggingExecutor(object):
8689 help='A YAML file containing the template to render for each frame, '
8790 'as well as configuration for rendering the template.'
8891 )
89 argparser.add_argument('-o', '--output', metavar='FILENAME', type=str, default=None)
92 argparser.add_argument('-o', '--output', metavar='FILENAME', type=str, default=None,
93 help='The movie file to create. The extension of this filename '
94 'determines the output format and must be one of %r. '
95 'If not given, a default name will be chosen based on the '
96 'configuration filename with a .mp4 extension added.' % (SUPPORTED_OUTPUT_FORMATS,)
97 )
9098
9199 argparser.add_argument("--width", default=320, type=int)
92100 argparser.add_argument("--height", default=200, type=int)
112120 help="The number of frames to render for each second. Note that the "
113121 "tool that makes a movie file from images might not honour this value exactly."
114122 )
115 argparser.add_argument("--still", default=None, type=float)
123 argparser.add_argument("--still", default=None, type=float, metavar='INSTANT',
124 help="If given, generate only a single frame (at the specified instant "
125 "betwen 0.0 and 1.0) and display it using eog, instead of building "
126 "the whole movie."
127 )
116128 argparser.add_argument("--view", default=False, action='store_true')
117129 argparser.add_argument("--twitter", default=False, action='store_true',
118130 help="Make the last frame in a GIF animation delay only half as long."
148160 infilename = options.configfile
149161 outfilename = options.output
150162 if options.output is None:
151 (inbase, inext) = os.path.splitext(infilename)
163 (inbase, inext) = os.path.splitext(os.path.basename(infilename))
152164 outfilename = inbase + '.mp4'
153165 (whatever, outext) = os.path.splitext(outfilename)
154 SUPPORTED_OUTPUT_FORMATS = ('.m4v', '.mp4', '.gif')
155166 if outext not in SUPPORTED_OUTPUT_FORMATS:
156167 raise ValueError("%s not a supported output format (%r)" % (outext, SUPPORTED_OUTPUT_FORMATS))
157168