modify: use formatted values in _showdiff()

Perhaps we should use this for other commands also. One outstanding issue is
strange highlighting (e.g., "True -> False" helpfully shows that the "e" did
not change).
This commit is contained in:
Adrian Sampson 2014-02-13 21:33:58 -08:00
parent be31ac683a
commit a2075d31e5
2 changed files with 6 additions and 1 deletions

View file

@ -1128,7 +1128,8 @@ def modify_items(lib, mods, query, write, move, album, confirm):
# Show each change.
for field, value in fsets.iteritems():
if _showdiff(field, obj.get(field), value):
if _showdiff(field, obj._get_formatted(field),
obj._format(field, value)):
changed.add(obj)
# Still something to do?

View file

@ -16,6 +16,10 @@ consequences for all users are:
* :ref:`Date-based queries <datequery>` are now possible. Try getting every
track you added in February 2014 with ``beet ls added:2014-02`` or in the
whole decade with ``added:2010..``. Thanks to Stig Inge Lea Bjørnsen.
* The :ref:`modify-cmd` command is now better at parsing and formatting
fields. You can assign to boolean fields like ``comp``, for example, using
either the words "true" or "false" or the numerals 1 and 0. Any
boolean-esque value is normalized to a real boolean.
For developers, the short version of the story is that Item and Album objects
provide *uniform access* across fixed, flexible, and computed attributes.