diff --git a/beetsplug/hook.py b/beetsplug/hook.py index 833f0feaa..b6270fd50 100644 --- a/beetsplug/hook.py +++ b/beetsplug/hook.py @@ -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 diff --git a/docs/changelog.rst b/docs/changelog.rst index d20bc86f6..fe19403f0 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -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`.