Small fixes on mpc_api

This commit is contained in:
Uriziel 2012-09-21 14:59:52 +02:00
parent a92d307486
commit 412f911b84

View File

@ -22,6 +22,7 @@ class MPC_API:
self.playstate = None self.playstate = None
self.fileplaying = None self.fileplaying = None
self.fileduration = None self.fileduration = None
self.filepath = None
''' '''
Most likely won't be up to date unless you ask API to refresh it 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,)) if(self.callbacks.on_update_playstate): thread.start_new_thread(self.callbacks.on_update_playstate,(self.playstate,))
elif(cmd == MPC_API_COMMANDS.CMD_NOWPLAYING): elif(cmd == MPC_API_COMMANDS.CMD_NOWPLAYING):
self.filepath = value.split('|')[3]
self.fileplaying = value.split('|')[3].split('\\').pop() 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]) 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): elif(cmd == MPC_API_COMMANDS.CMD_CURRENTPOSITION):
self.lastfileposition = float(value) self.lastfileposition = float(value)