diff --git a/beetsplug/convert.py b/beetsplug/convert.py index f11204924..9debd6ca1 100644 --- a/beetsplug/convert.py +++ b/beetsplug/convert.py @@ -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: diff --git a/docs/changelog.rst b/docs/changelog.rst index 31cd892f7..251057c20 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -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 diff --git a/docs/plugins/convert.rst b/docs/plugins/convert.rst index f5b258065..f2f28c63d 100644 --- a/docs/plugins/convert.rst +++ b/docs/plugins/convert.rst @@ -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