item templates now expand all fields

A user noticed that $id wasn't being expanded. There's no good reason for
that.
This commit is contained in:
Adrian Sampson 2013-06-02 16:49:10 -07:00
parent cff06431cc
commit 5904959b8a
2 changed files with 7 additions and 3 deletions

View file

@ -399,7 +399,7 @@ class Item(object):
# Build the mapping for substitution in the template,
# beginning with the values from the database.
mapping = {}
for key in ITEM_KEYS_META:
for key in ITEM_KEYS:
# Get the values from either the item or its album.
if key in ALBUM_KEYS_ITEM and album is not None:
# From album.
@ -411,8 +411,10 @@ class Item(object):
value = format_for_path(value, key, pathmod)
mapping[key] = value
# Additional fields in non-sanitized case.
if not sanitize:
# Include the path if we're not sanitizing to construct a path.
if sanitize:
del mapping['path']
else:
mapping['path'] = displayable_path(self.path)
# Use the album artist if the track artist is not set and

View file

@ -51,6 +51,8 @@ Changelog
``beet modify artpath=...`` works). Thanks to Lucas Duailibe.
* :doc:`/plugins/zero`: Fix a crash when nulling out a field that contains
None.
* Templates can now refer to non-tag item fields (e.g., ``$id`` and
``$album_id``).
* Various UI enhancements to the importer due to Tai Lee:
* More consistent format and colorization of album and track metadata.