Improve help text. Default output filename does not include dir.
Chris Pressey
8 years ago
20 | 20 | from yaml import CLoader as Loader |
21 | 21 | except ImportError: |
22 | 22 | from yaml import Loader |
23 | ||
24 | ||
25 | SUPPORTED_OUTPUT_FORMATS = ('.m4v', '.mp4', '.gif') | |
23 | 26 | |
24 | 27 | |
25 | 28 | class LoggingExecutor(object): |
86 | 89 | help='A YAML file containing the template to render for each frame, ' |
87 | 90 | 'as well as configuration for rendering the template.' |
88 | 91 | ) |
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 | ) | |
90 | 98 | |
91 | 99 | argparser.add_argument("--width", default=320, type=int) |
92 | 100 | argparser.add_argument("--height", default=200, type=int) |
112 | 120 | help="The number of frames to render for each second. Note that the " |
113 | 121 | "tool that makes a movie file from images might not honour this value exactly." |
114 | 122 | ) |
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 | ) | |
116 | 128 | argparser.add_argument("--view", default=False, action='store_true') |
117 | 129 | argparser.add_argument("--twitter", default=False, action='store_true', |
118 | 130 | help="Make the last frame in a GIF animation delay only half as long." |
148 | 160 | infilename = options.configfile |
149 | 161 | outfilename = options.output |
150 | 162 | if options.output is None: |
151 | (inbase, inext) = os.path.splitext(infilename) | |
163 | (inbase, inext) = os.path.splitext(os.path.basename(infilename)) | |
152 | 164 | outfilename = inbase + '.mp4' |
153 | 165 | (whatever, outext) = os.path.splitext(outfilename) |
154 | SUPPORTED_OUTPUT_FORMATS = ('.m4v', '.mp4', '.gif') | |
155 | 166 | if outext not in SUPPORTED_OUTPUT_FORMATS: |
156 | 167 | raise ValueError("%s not a supported output format (%r)" % (outext, SUPPORTED_OUTPUT_FORMATS)) |
157 | 168 |