Adrian Sampson committed 008ccef

item templates now expand all fields

A user noticed that $id wasn't being expanded. There's no good reason for

Comments (0)

Files changed (2)

         # 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.
                 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
   ``beet modify artpath=...`` works). Thanks to Lucas Duailibe.
 * :doc:`/plugins/zero`: Fix a crash when nulling out a field that contains
+* 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.