diff --git a/beets/dbcore/db.py b/beets/dbcore/db.py index 6247ef41b..0c03f39ea 100644 --- a/beets/dbcore/db.py +++ b/beets/dbcore/db.py @@ -393,6 +393,12 @@ class Model(object): """ return FormattedMapping(self, for_path) + @property + def formatted(self): + """A `dict`-like view containing formatted values. + """ + return self._formatted_mapping(False) + def evaluate_template(self, template, for_path=False): """Evaluate a template (a string or a `Template` object) using the object's fields. If `for_path` is true, then no new path diff --git a/beets/ui/__init__.py b/beets/ui/__init__.py index 8d4cf84ad..00b217850 100644 --- a/beets/ui/__init__.py +++ b/beets/ui/__init__.py @@ -576,8 +576,8 @@ def _field_diff(field, old, new): return None # Get formatted values for output. - oldstr = old._get_formatted(field) - newstr = new._get_formatted(field) + oldstr = old.formatted.get(field, u'') + newstr = new.formatted.get(field, u'') # For strings, highlight changes. For others, colorize the whole # thing. @@ -617,7 +617,7 @@ def show_model_changes(new, old=None, fields=None, always=False): for field in set(new) - set(old): changes.append(u' {0}: {1}'.format( field, - colorize('red', new._get_formatted(field)) + colorize('red', new.formatted[field]) )) # Print changes.