From 412f911b84eea1b31f05a95d5b7ac1781f8c16b6 Mon Sep 17 00:00:00 2001 From: Uriziel Date: Fri, 21 Sep 2012 14:59:52 +0200 Subject: [PATCH] Small fixes on mpc_api --- syncplay/mpc_api.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/syncplay/mpc_api.py b/syncplay/mpc_api.py index dde6c90..27241c5 100644 --- a/syncplay/mpc_api.py +++ b/syncplay/mpc_api.py @@ -22,6 +22,7 @@ class MPC_API: self.playstate = None self.fileplaying = None self.fileduration = None + self.filepath = None ''' Most likely won't be up to date unless you ask API to refresh it ''' @@ -184,10 +185,11 @@ class MPC_API: if(self.callbacks.on_update_playstate): thread.start_new_thread(self.callbacks.on_update_playstate,(self.playstate,)) elif(cmd == MPC_API_COMMANDS.CMD_NOWPLAYING): + self.filepath = value.split('|')[3] self.fileplaying = value.split('|')[3].split('\\').pop() - if(self.callbacks.on_update_filename): thread.start_new_thread(self.callbacks.on_update_filename,(self.fileplaying,)) self.fileduration = int(value.split('|')[4]) - if(self.callbacks.on_update_file_duration): thread.start_new_thread(self.callbacks.on_update_file_duration,(self.fileplaying,)) + if(self.callbacks.on_update_filename): thread.start_new_thread(self.callbacks.on_update_filename,(self.fileplaying,)) + if(self.callbacks.on_update_file_duration): thread.start_new_thread(self.callbacks.on_update_file_duration,(self.fileduration,)) elif(cmd == MPC_API_COMMANDS.CMD_CURRENTPOSITION): self.lastfileposition = float(value)