diff --git a/pyweb/mumble/MumbleCtlDbus.py b/pyweb/mumble/MumbleCtlDbus.py index cb442ea..df4e8f6 100644 --- a/pyweb/mumble/MumbleCtlDbus.py +++ b/pyweb/mumble/MumbleCtlDbus.py @@ -108,7 +108,26 @@ class MumbleCtlDbus_118(MumbleCtlBase): return ret; def getPlayers(self, srvid): - return MumbleCtlDbus_118.convertDbusTypeToNative(self._getDbusServerObject(srvid).getPlayers()) + players = MumbleCtlDbus_118.convertDbusTypeToNative(self._getDbusServerObject(srvid).getPlayers()); + + ret = {}; + + for playerObj in players: + ret[ playerObj[0] ] = ObjectInfo( + session = playerObj[0], + mute = playerObj[1], + deaf = playerObj[2], + suppress = playerObj[3], + selfMute = playerObj[4], + selfDeaf = playerObj[5], + channel = playerObj[6], + userid = playerObj[7], + name = playerObj[8], + onlinesecs = playerObj[9], + bytespersec = playerObj[10] + ); + + return ret; def getRegisteredPlayers(self, srvid, filter = ''): return MumbleCtlDbus_118.convertDbusTypeToNative(self._getDbusServerObject(srvid).getRegisteredPlayers( filter ) ) diff --git a/pyweb/mumble/MumbleCtlIce.py b/pyweb/mumble/MumbleCtlIce.py index c467c95..83c10d9 100644 --- a/pyweb/mumble/MumbleCtlIce.py +++ b/pyweb/mumble/MumbleCtlIce.py @@ -113,14 +113,7 @@ class MumbleCtlIce_118(MumbleCtlBase): @protectDjangoErrPage def getPlayers(self, srvid): - users = self._getIceServerObject(srvid).getPlayers() - ret = [] - - for x in users: - user = users[x] - ret.append([user.session, user.mute, user.deaf, user.suppressed, user.selfMute, user.selfDeaf, user.channel, user.playerid, self.setUnicodeFlag(user.name), user.onlinesecs, user.bytespersec]) - - return ret + return self._getIceServerObject(srvid).getPlayers() @protectDjangoErrPage def getDefaultConf(self): @@ -308,15 +301,7 @@ class MumbleCtlIce_120(MumbleCtlIce_118): @protectDjangoErrPage def getPlayers(self, srvid): - serv = self._getIceServerObject(srvid); - users = serv.getUsers() - ret = [] - - for x in users: - user = users[x] - ret.append([user.session, user.mute, user.deaf, user.suppress, user.selfMute, user.selfDeaf, user.channel, user.userid, self.setUnicodeFlag(user.name), user.onlinesecs, user.bytespersec]) - - return ret + return self._getIceServerObject(srvid).getUsers(); @protectDjangoErrPage def registerPlayer(self, srvid, name, email, password): diff --git a/pyweb/mumble/mmobjects.py b/pyweb/mumble/mmobjects.py index eb90826..f91c62d 100644 --- a/pyweb/mumble/mmobjects.py +++ b/pyweb/mumble/mmobjects.py @@ -194,7 +194,18 @@ class mmPlayer( object ): # mumbleuser = models.MumbleUser(); def __init__( self, srvInstance, playerObj, playerChan ): - ( self.userid, self.muted, self.deafened, self.suppressed, self.selfmuted, self.selfdeafened, chanID, self.dbaseid, self.name, onlinetime, self.bytesPerSec ) = playerObj; + self.userid = playerObj.session; + self.muted = playerObj.mute; + self.deafened = playerObj.deaf; + self.suppressed = playerObj.suppress; + self.selfmuted = playerObj.selfMute; + self.selfdeafened = playerObj.selfDeaf; + chanID = playerObj.channel; + self.dbaseid = playerObj.userid; + self.name = playerObj.name; + onlinetime = playerObj.onlinesecs; + self.bytesPerSec = playerObj.bytespersec; + self.onlinesince = datetime.datetime.fromtimestamp( float( time() - onlinetime ) ); self.channel = playerChan; self.channel.players.append( self ); diff --git a/pyweb/mumble/models.py b/pyweb/mumble/models.py index 691235c..ffc5f88 100644 --- a/pyweb/mumble/models.py +++ b/pyweb/mumble/models.py @@ -338,9 +338,9 @@ class Mumble( models.Model ): self._channels[0].name = self.name; self.players = {}; - for thePlayer in self.ctl.getPlayers(self.srvid): + for thePlayer in self.ctl.getPlayers(self.srvid).values(): # Players - Fields: 0 = UserID, 6 = ChannelID - self.players[ thePlayer[0] ] = mmPlayer( self, thePlayer, self._channels[ thePlayer[6] ] ); + self.players[ thePlayer.session ] = mmPlayer( self, thePlayer, self._channels[ thePlayer.channel ] ); self._channels[0].sort();