diff --git a/src/controller/player.py b/src/controller/player.py index 3629dab..7bf584a 100644 --- a/src/controller/player.py +++ b/src/controller/player.py @@ -17,13 +17,18 @@ class audioPlayer(object): self.is_playing = False self.stream = None self.vol = 100 + self.is_working = False def play(self, url): if self.stream != None and self.stream.is_playing == True: self.stream.stop() - self.stream = URLStream(url=url) - self.stream.volume = self.vol/100.0 - self.stream.play() + # Make sure that there are no other sounds trying to be played. + if self.is_working == False: + self.is_working = True + self.stream = URLStream(url=url) + self.stream.volume = self.vol/100.0 + self.stream.play() + self.is_working = False def stop(self): if self.stream != None and self.stream.is_playing == True: diff --git a/src/sessionmanager/session.py b/src/sessionmanager/session.py index eef2f37..1f80edd 100644 --- a/src/sessionmanager/session.py +++ b/src/sessionmanager/session.py @@ -93,6 +93,7 @@ def compose_status(status, session): return [user, message, created_at] def compose_audio(audio, session): + if audio == False: return [_(u"Audio removed from library"), "", ""] return [audio["title"], audio["artist"], utils.seconds_to_string(audio["duration"])] class vkSession(object): @@ -160,6 +161,7 @@ class vkSession(object): self.authorise() else: self.authorise() + self.get_my_data() def authorise(self): self.vk.login(self.settings["vk"]["user"], self.settings["vk"]["password"]) @@ -234,4 +236,7 @@ class vkSession(object): for i in data["profiles"]: self.db["users"][i["uid"]] = u"{0} {1}".format(i["first_name"], i["last_name"]) for i in data["groups"]: - self.db["groups"][i["gid"]] = i["name"] \ No newline at end of file + self.db["groups"][i["gid"]] = i["name"] + + def get_my_data(self): + self.user_id = self.vk.client.users.get(fields="uid")[0]["uid"] \ No newline at end of file