From e273f9dfa9b7ac4ec4a96d73baf161f03f3bca7e Mon Sep 17 00:00:00 2001 From: Jakob Schnitzer Date: Tue, 9 Oct 2012 19:11:09 +0200 Subject: [PATCH] Fix a UnicodeDecodeError when using path in templates --- beets/library.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/beets/library.py b/beets/library.py index b5e60d657..dff5e013c 100644 --- a/beets/library.py +++ b/beets/library.py @@ -29,7 +29,8 @@ from unidecode import unidecode from beets.mediafile import MediaFile from beets import plugins from beets import util -from beets.util import bytestring_path, syspath, normpath, samefile +from beets.util import bytestring_path, syspath, normpath, samefile,\ + displayable_path from beets.util.functemplate import Template MAX_FILENAME_LENGTH = 200 @@ -351,7 +352,7 @@ class Item(object): # Additional fields in non-sanitized case. if not sanitize: - mapping['path'] = self.path + mapping['path'] = displayable_path(self.path) # Use the album artist if the track artist is not set and # vice-versa. @@ -1585,6 +1586,8 @@ class Album(BaseAlbum): for key in ALBUM_KEYS: mapping[key] = getattr(self, key) + mapping['artpath'] = displayable_path(mapping['artpath']) + # Get template functions. funcs = DefaultTemplateFunctions().functions() funcs.update(plugins.template_funcs())