diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2014-09-24 21:29:26 +0100 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2014-09-24 21:29:26 +0100 |
| commit | 4ae693947b3400fb99db9acc50f84f42ac2ec7b4 (patch) | |
| tree | 5780e522cd25718218bfcdd7292f5de914f05dd6 /client | |
| parent | ea3026c133755bf3e35ad78fa253786bc9ff7c36 (diff) | |
| download | jasper-client-4ae693947b3400fb99db9acc50f84f42ac2ec7b4.tar.gz jasper-client-4ae693947b3400fb99db9acc50f84f42ac2ec7b4.zip | |
Fix small issues with music module
The reconnect wrapper couldn’t be used to return values and this
sometimes caused crashes when getting current playback status. Also
espeak was only being passed track names etc in ASCII so fixed to allow
UTF-8 to get through.
Diffstat (limited to 'client')
| -rw-r--r-- | client/music.py | 6 | ||||
| -rw-r--r-- | client/speaker.py | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/client/music.py b/client/music.py index 2b6c055..ca9b776 100644 --- a/client/music.py +++ b/client/music.py @@ -17,14 +17,14 @@ def reconnect(func, *default_args, **default_kwargs): # sometimes not enough to just connect try: - func(self, *default_args, **default_kwargs) + return func(self, *default_args, **default_kwargs) except: self.client = MPDClient() self.client.timeout = None self.client.idletimeout = None self.client.connect("localhost", 6600) - func(self, *default_args, **default_kwargs) + return func(self, *default_args, **default_kwargs) return wrap @@ -103,7 +103,7 @@ class Music: self.client.play() - #@reconnect -- this makes the function return None for some reason! + @reconnect def current_song(self): item = self.client.playlistinfo(int(self.client.status()["song"]))[0] result = "%s by %s" % (item["title"], item["artist"]) diff --git a/client/speaker.py b/client/speaker.py index 8344132..c20c01b 100644 --- a/client/speaker.py +++ b/client/speaker.py @@ -21,7 +21,7 @@ class eSpeakSpeaker: return os.system("which espeak") == 0 def say(self, phrase, OPTIONS=" -vdefault+m3 -p 40 -s 160 --stdout > say.wav"): - os.system("espeak " + json.dumps(phrase) + OPTIONS) + os.system("espeak " + json.dumps(phrase, False, False) + OPTIONS) self.play("say.wav") def play(self, filename): |
