From ae9ece1e6216dfe3a7844360968822f6994c383a Mon Sep 17 00:00:00 2001 From: Jack Wilsdon Date: Fri, 29 Apr 2016 14:51:13 +0100 Subject: [PATCH 1/3] Make format extension optional The format extension defaults to the name of the format if it is not provided. --- beetsplug/convert.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/beetsplug/convert.py b/beetsplug/convert.py index dd57918d6..80a0127c9 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: From be897e964a18c3277b8080812371ca0a6fe79d08 Mon Sep 17 00:00:00 2001 From: Jack Wilsdon Date: Fri, 29 Apr 2016 14:54:00 +0100 Subject: [PATCH 2/3] Specify the optionality of the file extension in documentation Also change "command-line" to "command" for accuracy. --- docs/plugins/convert.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 From ab05fb83b7b64427786ed9512f76158b18185ec5 Mon Sep 17 00:00:00 2001 From: Jack Wilsdon Date: Fri, 29 Apr 2016 18:24:45 +0100 Subject: [PATCH 3/3] Add convert extension changes to changelog --- docs/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 073c2caa8..529f41d52 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