From 12aaa2ee34138a532eae94f6c4bc5e9c7980e32c Mon Sep 17 00:00:00 2001 From: jizz Date: Wed, 5 Dec 2012 11:05:12 +1100 Subject: [PATCH] updated art_destination art_filename now acceptable as a string or a Template --- beets/library.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/beets/library.py b/beets/library.py index b57c51943..5d9921d63 100644 --- a/beets/library.py +++ b/beets/library.py @@ -1562,14 +1562,21 @@ class Album(BaseAlbum): items, so the album must contain at least one item or item_dir must be provided. """ + + if isinstance(self._library.art_filename,Template): + art_filename_template = self._library.art_filename,Template + else: + art_filename_template = Template(self._library.art_filename) + + 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) + sanitized_art_filename = util.sanitize_for_path(self.evaluate_template(art_filename_template),os.path) _, ext = os.path.splitext(image) dest = os.path.join(item_dir, util.sanitize_path(sanitized_art_filename) + ext) - return dest + return bytestring_path(dest) def set_art(self, path, copy=True): """Sets the album's cover art to the image at the given path.