mirror of
https://github.com/beetbox/beets.git
synced 2025-12-22 08:34:23 +01:00
Fix a UnicodeDecodeError when using path in templates
This commit is contained in:
parent
a2ff20979f
commit
e273f9dfa9
1 changed files with 5 additions and 2 deletions
|
|
@ -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())
|
||||
|
|
|
|||
Loading…
Reference in a new issue