From 4ae693947b3400fb99db9acc50f84f42ac2ec7b4 Mon Sep 17 00:00:00 2001 From: schneefux Date: Wed, 24 Sep 2014 21:29:26 +0100 Subject: Fix small issues with music module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- client/music.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'client/music.py') 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"]) -- cgit v1.3.1