#380: Template.safe_substitute

This way, you almost never need to use the $$ escape sequence.
This commit is contained in:
Adrian Sampson 2013-10-06 12:01:42 -07:00
parent dfea8ea05e
commit a6798f9ba3
2 changed files with 4 additions and 4 deletions

View file

@ -93,7 +93,7 @@ def encode(source, dest):
for arg in command:
arg = arg.encode('utf-8')
opts.append(Template(arg).substitute({
opts.append(Template(arg).safe_substitute({
'source': source,
'dest': dest,
}))

View file

@ -83,9 +83,9 @@ These config options control the transcoding process:
* ``command`` is the command line to use to transcode audio. A default
command, usually using an FFmpeg invocation, is implied by the ``format``
option. The tokens ``$source`` and ``$dest`` in the command are replaced
with the paths to the existing and new file. (Use ``$$`` to emit a literal
dollars sign.) For example, the command ``ffmpeg -i $source -y -aq 4 $dest``
transcodes to MP3 using FFmpeg at the V4 quality level.
with the paths to the existing and new file. For example, the command
``ffmpeg -i $source -y -aq 4 $dest`` transcodes to MP3 using FFmpeg at the
V4 quality level.
Here's an example configuration::