From 9c9d05be36616f528c9d79d7bc54e48d2e938283 Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Thu, 12 Mar 2015 21:55:17 +0100 Subject: [PATCH] audio: Only warn about missing plugin on errors --- mopidy/audio/scan.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mopidy/audio/scan.py b/mopidy/audio/scan.py index 39cf172e..ed8e9eb9 100644 --- a/mopidy/audio/scan.py +++ b/mopidy/audio/scan.py @@ -108,7 +108,7 @@ class Scanner(object): """Polls for messages to collect data.""" start = time.time() timeout_s = self._timeout_ms / 1000.0 - tags, mime = {}, None + tags, mime, missing_description = {}, None, None while time.time() - start < timeout_s: if not self._bus.have_pending(): @@ -117,15 +117,17 @@ class Scanner(object): if message.type == gst.MESSAGE_ELEMENT: if gst.pbutils.is_missing_plugin_message(message): - description = _missing_plugin_desc(message) - raise exceptions.ScannerError(description) + missing_description = encoding.locale_decode( + _missing_plugin_desc(message)) elif message.type == gst.MESSAGE_APPLICATION: mime = message.structure.get_name() if mime.startswith('text/') or mime == 'application/xml': return tags, mime elif message.type == gst.MESSAGE_ERROR: - raise exceptions.ScannerError( - encoding.locale_decode(message.parse_error()[0])) + error = encoding.locale_decode(message.parse_error()[0]) + if missing_description: + error = '%s (%s)' % (missing_description, error) + raise exceptions.ScannerError(error) elif message.type == gst.MESSAGE_EOS: return tags, mime elif message.type == gst.MESSAGE_ASYNC_DONE: