Fix issues reported by codacy
parent
8527074ee3
commit
bfa26e6916
|
@ -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:
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue