From ce81b362dc338d7c1216b68183d46e59051d7b97 Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Mon, 15 Feb 2016 00:00:30 +0100 Subject: [PATCH] stream: Add scheme and blacklist check to translate_uri We don't bother with this inside the unwrap code as if something redirects us so be it. --- mopidy/stream/actor.py | 7 +++++++ tests/stream/test_playback.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/mopidy/stream/actor.py b/mopidy/stream/actor.py index b42985d0..ff99264d 100644 --- a/mopidy/stream/actor.py +++ b/mopidy/stream/actor.py @@ -74,6 +74,13 @@ class StreamLibraryProvider(backend.LibraryProvider): class StreamPlaybackProvider(backend.PlaybackProvider): def translate_uri(self, uri): + if urllib.parse.urlsplit(uri).scheme not in self.backend.uri_schemes: + return None + + if self.backend._blacklist_re.match(uri): + logger.debug('URI matched metadata lookup blacklist: %s', uri) + return uri + return _unwrap_stream( uri, timeout=self.backend._timeout, diff --git a/tests/stream/test_playback.py b/tests/stream/test_playback.py index 4ff684ca..1816f73e 100644 --- a/tests/stream/test_playback.py +++ b/tests/stream/test_playback.py @@ -30,7 +30,7 @@ def config(): 'stream': { 'timeout': TIMEOUT, 'metadata_blacklist': [], - 'protocols': ['file'], + 'protocols': ['http'], }, 'file': { 'enabled': False