Merge pull request #1974 from jackwilsdon/make-convert-extension-optional

Make convert extension optional
This commit is contained in:
Jack Wilsdon 2016-05-08 16:30:30 +01:00
commit 5f3c27990d
3 changed files with 8 additions and 7 deletions

View file

@ -60,10 +60,10 @@ def get_format(fmt=None):
try:
format_info = config['convert']['formats'][fmt].get(dict)
command = format_info['command']
extension = format_info['extension']
extension = format_info.get('extension', fmt)
except KeyError:
raise ui.UserError(
u'convert: format {0} needs "command" and "extension" fields'
u'convert: format {0} needs the "command" field'
.format(fmt)
)
except ConfigTypeError:

View file

@ -8,6 +8,7 @@ New features:
* :doc:`/plugins/convert`: A new `album_art_maxwidth` lets you resize album
art while copying it.
* :doc:`/plugins/convert`: Make `extension` optional for conversion formats.
* :doc:`/plugins/importadded`: A new `preserve_write_mtimes` option
lets you preserve mtime of files after each write.
* :doc:`/plugins/lyrics`: The plugin can now translate the fetched lyrics to a

View file

@ -113,12 +113,12 @@ default. To convert the audio to `wav`, run ``beet convert -f wav``.
This will also use the format key (`wav`) as the file extension.
Each entry in the ``formats`` map consists of a key (the name of the
format) as well as the command and the possibly the file extension.
format) as well as the command and optionally the file extension.
``extension`` is the filename extension to be used for newly transcoded
files. If only the command is given as a string, the file extension
defaults to the format's name. ``command`` is the command-line to use
to transcode audio. The tokens ``$source`` and ``$dest`` in the command
are replaced with the paths to the existing and new file.
files. If only the command is given as a string or the extension is not
provided, the file extension defaults to the format's name. ``command`` is the
command to use to transcode audio. The tokens ``$source`` and ``$dest`` in the
command are replaced with the paths to the existing and new file.
The plugin in comes with default commands for the most common audio
formats: `mp3`, `alac`, `flac`, `aac`, `opus`, `ogg`, `wmv`. For