Merge pull request #2742 from broddo/hook/bug

Addresses hook.py ability to handle non-string item properties
This commit is contained in:
Adrian Sampson 2017-11-22 14:02:08 -05:00 committed by GitHub
commit 9ee643f54c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View file

@ -64,10 +64,8 @@ class CodingFormatter(string.Formatter):
converted = super(CodingFormatter, self).convert_field(value,
conversion)
try:
converted = converted.decode(self._coding)
except UnicodeEncodeError:
pass
if isinstance(converted, bytes):
return converted.decode(self._coding)
return converted

View file

@ -34,6 +34,10 @@ New features:
Fixes:
* :doc:`/plugins/hook`: Fixed a problem whereby accessing non-string properties of
objects such as item or album (e.g. item.track) would cause a crash.
Thanks to :user:`broddo`.
:bug:`2740`
* :doc:`/plugins/play`: When ``relative_to`` is set, correctly emit relative paths
even when querying for albums rather than tracks.
Thanks to :user:`j000`.