From a6798f9ba33178fd9b9f1598f7851d2a8dcb5071 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Sun, 6 Oct 2013 12:01:42 -0700 Subject: [PATCH] #380: Template.safe_substitute This way, you almost never need to use the $$ escape sequence. --- beetsplug/convert.py | 2 +- docs/plugins/convert.rst | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/beetsplug/convert.py b/beetsplug/convert.py index 9428fa162..720f7fa1d 100644 --- a/beetsplug/convert.py +++ b/beetsplug/convert.py @@ -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, })) diff --git a/docs/plugins/convert.rst b/docs/plugins/convert.rst index 8adbb27f6..5eff02f1e 100644 --- a/docs/plugins/convert.rst +++ b/docs/plugins/convert.rst @@ -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::