mirror of
https://github.com/beetbox/beets.git
synced 2026-01-30 20:13:37 +01:00
fix #280: unicode error when formatting artpath
The `artpath` field for Albums is a bytestring, not a Unicode string, and this was causing a UnicodeDecodeError in `format_for_path`.
This commit is contained in:
parent
4d62a83210
commit
71666c7ac2
1 changed files with 4 additions and 4 deletions
|
|
@ -196,12 +196,12 @@ def format_for_path(value, key=None, pathmod=None):
|
|||
pathmod = pathmod or os.path
|
||||
|
||||
if isinstance(value, basestring):
|
||||
if isinstance(value, str):
|
||||
value = value.decode('utf8', 'ignore')
|
||||
sep_repl = beets.config['path_sep_replace'].get(unicode)
|
||||
for sep in (pathmod.sep, pathmod.altsep):
|
||||
if sep:
|
||||
value = value.replace(
|
||||
sep,
|
||||
beets.config['path_sep_replace'].get(unicode),
|
||||
)
|
||||
value = value.replace(sep, sep_repl)
|
||||
elif key in ('track', 'tracktotal', 'disc', 'disctotal'):
|
||||
# Pad indices with zeros.
|
||||
value = u'%02i' % (value or 0)
|
||||
|
|
|
|||
Loading…
Reference in a new issue