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) message = json.dumps(_message)
except (KeyboardInterrupt, SystemExit): except (KeyboardInterrupt, SystemExit):
raise raise
except Exception: except Exception as e:
pass LOG.exception(e)
LOG.debug(message) LOG.debug(message)
LOG.info("Staring Audio Services") LOG.info("Staring Audio Services")
ws.on('message', echo) ws.on('message', echo)
audio_service = AudioService(ws) AudioService(ws) # Connect audio service instance to message bus
try: try:
ws.run_forever() ws.run_forever()
except KeyboardInterrupt as exc: except KeyboardInterrupt as exc:

View File

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