Fix issues reported by codacy

pull/1197/head
Åke Forslund 2017-11-02 19:54:51 +01:00
parent 8527074ee3
commit bfa26e6916
2 changed files with 7 additions and 5 deletions

View File

@ -462,13 +462,13 @@ def main():
message = json.dumps(_message)
except (KeyboardInterrupt, SystemExit):
raise
except Exception:
pass
except Exception as e:
LOG.exception(e)
LOG.debug(message)
LOG.info("Staring Audio Services")
ws.on('message', echo)
audio_service = AudioService(ws)
AudioService(ws) # Connect audio service instance to message bus
try:
ws.run_forever()
except KeyboardInterrupt as exc:

View File

@ -55,12 +55,13 @@ class AudioService():
"""
self.info = message.data
def queue(self, tracks=[]):
def queue(self, tracks=None):
""" Queue up a track to playing playlist.
Args:
tracks: track uri or list of track uri's
"""
tracks = tracks or []
if isinstance(tracks, basestring):
tracks = [tracks]
elif not isinstance(tracks, list):
@ -69,7 +70,7 @@ class AudioService():
self.emitter.emit(Message('mycroft.audio.service.queue',
data={'tracks': tracks}))
def play(self, tracks=[], utterance=''):
def play(self, tracks=None, utterance=''):
""" Start playback.
Args:
@ -77,6 +78,7 @@ class AudioService():
utterance: forward utterance for further processing by the
audio service.
"""
tracks = tracks or []
if isinstance(tracks, basestring):
tracks = [tracks]
elif not isinstance(tracks, list):