From f14f47f059459118a5d3f9123c5f72a948ac3a4c Mon Sep 17 00:00:00 2001 From: Bruno Cauet Date: Wed, 4 Mar 2015 16:48:14 +0100 Subject: [PATCH] Renamed list_format_* into format_* --- beets/config_default.yaml | 4 ++-- beets/library.py | 4 ++-- beets/ui/__init__.py | 11 +++++++++++ docs/changelog.rst | 3 +++ docs/plugins/duplicates.rst | 2 +- docs/plugins/mbsync.rst | 4 ++-- docs/plugins/missing.rst | 2 +- docs/reference/config.rst | 26 ++++++++++++++++++++++---- test/test_library.py | 4 ++-- test/test_mbsync.py | 4 ++-- 10 files changed, 48 insertions(+), 16 deletions(-) diff --git a/beets/config_default.yaml b/beets/config_default.yaml index b98ffbfc6..e0b942d82 100644 --- a/beets/config_default.yaml +++ b/beets/config_default.yaml @@ -61,8 +61,8 @@ ui: action_default: turquoise action: blue -list_format_item: $artist - $album - $title -list_format_album: $albumartist - $album +format_item: $artist - $album - $title +format_album: $albumartist - $album time_format: '%Y-%m-%d %H:%M:%S' sort_album: albumartist+ album+ diff --git a/beets/library.py b/beets/library.py index 6e53352d7..333ff4238 100644 --- a/beets/library.py +++ b/beets/library.py @@ -418,7 +418,7 @@ class Item(LibModel): _sorts = {'artist': SmartArtistSort} - _format_config_key = 'list_format_item' + _format_config_key = 'format_item' @classmethod def _getters(cls): @@ -851,7 +851,7 @@ class Album(LibModel): """List of keys that are set on an album's items. """ - _format_config_key = 'list_format_album' + _format_config_key = 'format_album' @classmethod def _getters(cls): diff --git a/beets/ui/__init__.py b/beets/ui/__init__.py index ad1614bad..999067f53 100644 --- a/beets/ui/__init__.py +++ b/beets/ui/__init__.py @@ -871,6 +871,17 @@ def _configure(options): u'See documentation for more info.') config['ui']['color'].set(config['color'].get(bool)) + # Compatibility from list_format_{item,album} to format_{item,album} + for elem in ('item', 'album'): + old_key = 'list_format_{0}'.format(elem) + if config[old_key].exists(): + new_key = 'format_{0}'.format(elem) + log.warning('Warning: configuration uses "{0}" which is deprecated' + ' in favor of "{1}" now that it affects all commands. ' + 'See changelog & documentation.'.format(old_key, + new_key)) + config[new_key].set(config[old_key]) + config_path = config.user_config_path() if os.path.isfile(config_path): log.debug(u'user configuration: {0}', diff --git a/docs/changelog.rst b/docs/changelog.rst index 41266a7dc..527806a9a 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -71,6 +71,9 @@ Core changes: now affect (almost) every place where objects are printed and logged. (Previously, they only controlled the :ref:`list-cmd` command and a few other scattered pieces.) :bug:`1269` +* :ref:`list_format_album` and :ref:`list_format_album` have respectively been + renamed :ref:`format_album` and :ref:`format_item`. The old names still work + but each triggers a warning message. :bug:`1271` Fixes: diff --git a/docs/plugins/duplicates.rst b/docs/plugins/duplicates.rst index 18c2a8052..ecbda69cf 100644 --- a/docs/plugins/duplicates.rst +++ b/docs/plugins/duplicates.rst @@ -61,7 +61,7 @@ file. The available options mirror the command-line options: or album. This uses the same template syntax as beets' :doc:`path formats`. The usage is inspired by, and therefore similar to, the :ref:`list ` command. - Default: :ref:`list_format_item` + Default: :ref:`format_item` - **full**: List every track or album that has duplicates, not just the duplicates themselves. Default: ``no``. diff --git a/docs/plugins/mbsync.rst b/docs/plugins/mbsync.rst index cf89974e4..a7633a500 100644 --- a/docs/plugins/mbsync.rst +++ b/docs/plugins/mbsync.rst @@ -34,5 +34,5 @@ The command has a few command-line options: plugin will write new metadata to files' tags. To disable this, use the ``-W`` (``--nowrite``) option. * To customize the output of unrecognized items, use the ``-f`` - (``--format``) option. The default output is ``list_format_item`` or - ``list_format_album`` for items and albums, respectively. + (``--format``) option. The default output is ``format_item`` or + ``format_album`` for items and albums, respectively. diff --git a/docs/plugins/missing.rst b/docs/plugins/missing.rst index ffca94052..aab04e71b 100644 --- a/docs/plugins/missing.rst +++ b/docs/plugins/missing.rst @@ -36,7 +36,7 @@ configuration file. The available options are: track. This uses the same template syntax as beets' :doc:`path formats `. The usage is inspired by, and therefore similar to, the :ref:`list ` command. - Default: :ref:`list_format_item`. + Default: :ref:`format_item`. - **total**: Print a single count of missing tracks in all albums. Default: ``no``. diff --git a/docs/reference/config.rst b/docs/reference/config.rst index a64e73749..b7763c0b4 100644 --- a/docs/reference/config.rst +++ b/docs/reference/config.rst @@ -167,20 +167,38 @@ Defaults to ``yes``. list_format_item ~~~~~~~~~~~~~~~~ -Format to use when listing *individual items* with the :ref:`list-cmd` -command and other commands that need to print out items. Defaults to -``$artist - $album - $title``. The ``-f`` command-line option overrides -this setting. +Deprecated option, replaced by :ref:`format_item`. .. _list_format_album: list_format_album ~~~~~~~~~~~~~~~~~ +Deprecated option, replaced by :ref:`format_album`. + +.. _format_item: + +format_item +~~~~~~~~~~~ + +Format to use when listing *individual items* with the :ref:`list-cmd` +command and other commands that need to print out items. Defaults to +``$artist - $album - $title``. The ``-f`` command-line option overrides +this setting. + +It used to be named :ref:`list_format_item`. + +.. _format_album: + +format_album +~~~~~~~~~~~~ + Format to use when listing *albums* with :ref:`list-cmd` and other commands. Defaults to ``$albumartist - $album``. The ``-f`` command-line option overrides this setting. +It used to be named :ref:`list_format_album`. + .. _sort_item: sort_item diff --git a/test/test_library.py b/test/test_library.py index 1a2812b61..a496ef6c0 100644 --- a/test/test_library.py +++ b/test/test_library.py @@ -972,7 +972,7 @@ class TemplateTest(_common.LibTestCase): self.assertEqual(self.i.evaluate_template('$foo'), 'baz') def test_album_and_item_format(self): - config['list_format_album'] = u'foö $foo' + config['format_album'] = u'foö $foo' album = beets.library.Album() album.foo = 'bar' album.tagada = 'togodo' @@ -981,7 +981,7 @@ class TemplateTest(_common.LibTestCase): self.assertEqual(unicode(album), u"foö bar") self.assertEqual(str(album), b"fo\xc3\xb6 bar") - config['list_format_item'] = 'bar $foo' + config['format_item'] = 'bar $foo' item = beets.library.Item() item.foo = 'bar' item.tagada = 'togodo' diff --git a/test/test_mbsync.py b/test/test_mbsync.py index fc37fe8c3..701227366 100644 --- a/test/test_mbsync.py +++ b/test/test_mbsync.py @@ -73,8 +73,8 @@ class MbsyncCliTest(unittest.TestCase, TestHelper): self.assertEqual(album.album, 'album info') def test_message_when_skipping(self): - config['list_format_item'] = '$artist - $album - $title' - config['list_format_album'] = '$albumartist - $album' + config['format_item'] = '$artist - $album - $title' + config['format_album'] = '$albumartist - $album' # Test album with no mb_albumid. # The default format for an album include $albumartist so