|
@ -138,9 +138,12 @@ def MumbleCtlIce( connstring, slicefile=None, icesecret=None ): |
|
|
elif murmurversion[:2] == (1, 2) and murmurversion[:3] < 2: |
|
|
elif murmurversion[:2] == (1, 2) and murmurversion[:3] < 2: |
|
|
return MumbleCtlIce_120( connstring, meta ); |
|
|
return MumbleCtlIce_120( connstring, meta ); |
|
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
|
elif murmurversion[:3] == 2: |
|
|
return MumbleCtlIce_122( connstring, meta ); |
|
|
return MumbleCtlIce_122( connstring, meta ); |
|
|
|
|
|
|
|
|
|
|
|
elif murmurversion[:3] == 3: |
|
|
|
|
|
return MumbleCtlIce_123( connstring, meta ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MumbleCtlIce_118(MumbleCtlBase): |
|
|
class MumbleCtlIce_118(MumbleCtlBase): |
|
|
method = "ICE"; |
|
|
method = "ICE"; |
|
@ -500,27 +503,28 @@ class MumbleCtlIce_120(MumbleCtlIce_118): |
|
|
class MumbleCtlIce_122(MumbleCtlIce_120): |
|
|
class MumbleCtlIce_122(MumbleCtlIce_120): |
|
|
@protectDjangoErrPage |
|
|
@protectDjangoErrPage |
|
|
def getTexture(self, srvid, mumbleid): |
|
|
def getTexture(self, srvid, mumbleid): |
|
|
|
|
|
raise ValueError( "This method is buggy in 1.2.2, sorry dude." ); |
|
|
|
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
|
|
|
def setTexture(self, srvid, mumbleid, infile): |
|
|
|
|
|
img = open( infile, "rb" ) |
|
|
|
|
|
self._getIceServerObject(srvid).setTexture(mumbleid, img) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MumbleCtlIce_123(MumbleCtlIce_120): |
|
|
|
|
|
@protectDjangoErrPage |
|
|
|
|
|
def getTexture(self, srvid, mumbleid): |
|
|
|
|
|
import sys |
|
|
texture = self._getIceServerObject(srvid).getTexture(mumbleid) |
|
|
texture = self._getIceServerObject(srvid).getTexture(mumbleid) |
|
|
if len(texture) == 0: |
|
|
if len(texture) == 0: |
|
|
raise ValueError( "No Texture has been set." ); |
|
|
raise ValueError( "No Texture has been set." ); |
|
|
imgdata = "" |
|
|
|
|
|
for idx in range( 0, len(texture)-4, 4 ): |
|
|
|
|
|
bgra = unpack( "4B", texture[idx:idx+4] ); |
|
|
|
|
|
imgdata += pack( "4B", bgra[2], bgra[1], bgra[0], bgra[3] ); |
|
|
|
|
|
# return an 600x60 RGBA image object created from the data |
|
|
|
|
|
return Image.fromstring( "RGBA", ( 88, 60 ), imgdata ); |
|
|
|
|
|
|
|
|
from StringIO import StringIO |
|
|
|
|
|
return Image.open( StringIO( texture ) ) |
|
|
|
|
|
|
|
|
@protectDjangoErrPage |
|
|
@protectDjangoErrPage |
|
|
def setTexture(self, srvid, mumbleid, infile): |
|
|
def setTexture(self, srvid, mumbleid, infile): |
|
|
# open image, convert to RGBA, and resize to 600x60 |
|
|
# open image, convert to RGBA, and resize to 600x60 |
|
|
img = Image.open( infile ).convert( "RGBA" ).transform( ( 88, 60 ), Image.EXTENT, ( 0, 0, 88, 60 ) ); |
|
|
|
|
|
# iterate over the list and pack everything into a string |
|
|
|
|
|
bgrastring = ""; |
|
|
|
|
|
for ent in list( img.getdata() ): |
|
|
|
|
|
# ent is in RGBA format, but Murmur wants BGRA (ARGB inverse), so stuff needs |
|
|
|
|
|
# to be reordered when passed to pack() |
|
|
|
|
|
bgrastring += pack( "4B", ent[2], ent[1], ent[0], ent[3] ); |
|
|
|
|
|
# finally call murmur and set the texture |
|
|
|
|
|
self._getIceServerObject(srvid).setTexture(mumbleid, bgrastring) |
|
|
|
|
|
|
|
|
img = open( infile, "rb" ) |
|
|
|
|
|
self._getIceServerObject(srvid).setTexture(mumbleid, img) |
|
|
|
|
|
|
|
|
|
|
|
|