Update beets/library.py

Fix for Issue 450: Expand templates in art_filename config option
This commit is contained in:
jizz 2012-12-04 16:25:18 +11:00
parent 131b191885
commit 6b7b54062f

View file

@ -1002,7 +1002,7 @@ class Library(BaseLibrary):
self.path = bytestring_path(normpath(path))
self.directory = bytestring_path(normpath(directory))
self.path_formats = path_formats
self.art_filename = bytestring_path(art_filename)
self.art_filename = art_filename
self.replacements = replacements
self._memotable = {} # Used for template substitution performance.
@ -1564,8 +1564,11 @@ class Album(BaseAlbum):
"""
image = bytestring_path(image)
item_dir = item_dir or self.item_dir()
sanitized_art_filename = util.sanitize_for_path(self.evaluate_template(self._library.art_filename),os.path)
_, ext = os.path.splitext(image)
dest = os.path.join(item_dir, self._library.art_filename + ext)
dest = os.path.join(item_dir, util.sanitize_path(sanitized_art_filename) + ext)
return dest
def set_art(self, path, copy=True):