From e75718d1960a691be48ac91ff03c47fc1e94fb6f Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Wed, 29 May 2013 10:10:07 -0700 Subject: [PATCH] use album template fields in item templates This lets you use, for example, the example album bitrate field in path formats. --- beets/library.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/beets/library.py b/beets/library.py index e401f0eea..d1b0b6d09 100644 --- a/beets/library.py +++ b/beets/library.py @@ -423,10 +423,15 @@ class Item(object): mapping['albumartist'] = mapping['artist'] # Get values from plugins. - for key, value in plugins.template_values(self).iteritems(): + for key, value in plugins.template_values(self).items(): if sanitize: value = format_for_path(value, key, pathmod) mapping[key] = value + if album: + for key, value in plugins.album_template_values(album).items(): + if sanitize: + value = format_for_path(value, key, pathmod) + mapping[key] = value # Get template functions. funcs = DefaultTemplateFunctions(self, lib, pathmod).functions()