Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Schema test and final flake

  • Loading branch information...
commit 87ec8734b2cef984ea667d58eb5836f9423d7ac2 1 parent 76c68fc
@kingosticks authored
View
2  mopidy_tunein/translator.py
@@ -11,7 +11,7 @@
TUNEIN_ID_PROGRAM = 'program'
TUNEIN_ID_STATION = 'station'
-TUNEIN_ID_GROUP= 'group'
+TUNEIN_ID_GROUP = 'group'
TUNEIN_ID_TOPIC = 'topic'
TUNEIN_ID_CATEGORY = 'category'
TUNEIN_ID_REGION = 'region'
View
19 mopidy_tunein/tunein.py
@@ -41,10 +41,10 @@ def _memoized(*args):
value = func(*args)
self.cache[args] = (value, now)
return value
-
+
except TypeError:
- return func(*args) # uncachable
-
+ return func(*args)
+
def clear():
self.cache.clear()
@@ -127,7 +127,7 @@ def __init__(self, timeout):
self._base_uri = 'http://opml.radiotime.com/%s'
self._timeout = timeout / 1000.0
self._stations = {}
-
+
def reload(self):
self._stations.clear()
self._tunein.clear()
@@ -165,7 +165,7 @@ def categories(self, category=''):
def locations(self, location):
args = '&id=' + location
results = self._tunein('Browse.ashx', args)
- # TODO: Support filters here
+ # TODO: Support filters here
return [x for x in results if 'guide_id' in x]
def _browse(self, section_name, guide_id):
@@ -186,7 +186,7 @@ def related(self, guide_id):
return self._browse('Related', guide_id)
def shows(self, guide_id):
- return self._browse('Show', guide_id)#
+ return self._browse('Show', guide_id)
def episodes(self, guide_id):
args = '&c=pbrowse&id=' + guide_id
@@ -211,13 +211,12 @@ def parse_stream_url(self, url):
logger.debug('Using tunein stream url parsing')
extension = urlparse.urlparse(url).path[-4:]
if extension in ['.mp3', '.wma']:
- # Catch these easy ones
- return [url]
+ return [url] # Catch these easy ones
results = []
playlist, content_type = self._get_playlist(url)
if playlist:
parser = find_playlist_parser(extension, content_type)
- if parser:
+ if parser:
playlist_data = StringIO.StringIO(playlist)
results = [u for u in parser(playlist_data) if u is not None]
@@ -269,7 +268,7 @@ def _tunein(self, variant, args):
data = response.json()
if (data['head']['status'] != '200'):
raise requests.exceptions.HTTPError(data['head']['status'],
- data['head']['fault'])
+ data['head']['fault'])
return data['body']
except Exception as e:
logger.error('Tunein request failed: %s', e)
View
4 tests/test_extension.py
@@ -20,8 +20,6 @@ def test_get_config_schema(self):
schema = ext.get_config_schema()
- # TODO Test the content of your config schema
- #self.assertIn('username', schema)
- #self.assertIn('password', schema)
+ self.assertIn('timeout', schema)
# TODO Write more tests
Please sign in to comment.
Something went wrong with that request. Please try again.