Renamed list_format_* into format_*

This commit is contained in:
Bruno Cauet 2015-03-04 16:48:14 +01:00
parent f14dbf4e89
commit f14f47f059
10 changed files with 48 additions and 16 deletions

View file

@ -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+

View file

@ -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):

View file

@ -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}',

View file

@ -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:

View file

@ -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</reference/pathformat>`. The usage is inspired by, and
therefore similar to, the :ref:`list <list-cmd>` 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``.

View file

@ -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.

View file

@ -36,7 +36,7 @@ configuration file. The available options are:
track. This uses the same template syntax as beets'
:doc:`path formats </reference/pathformat>`. The usage is inspired by, and
therefore similar to, the :ref:`list <list-cmd>` command.
Default: :ref:`list_format_item`.
Default: :ref:`format_item`.
- **total**: Print a single count of missing tracks in all albums.
Default: ``no``.

View file

@ -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

View file

@ -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'

View file

@ -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