ICE and Python

Ice/DBus, Web-Interfaces, Management tools

ICE and Python

Postby nickeh » Fri Dec 05, 2014 9:19 am

Hi,

I tried to connect to my Mumble server using ICE and Python but I can't get it to work.
I have copied Murmur.ice to the same folder as my python script but when I execute the script

Code: Select all
import Ice
Ice.loadSlice("Murmur.ice")


I get this:

Code: Select all
error: Can't open include file "Ice/SliceChecksumDict.ice"
    #include <Ice/SliceChecksumDict.ice>


I found the SliceChecksumDict.inc under /usr/share/Ice-3.5.1/slice/Ice/SliceChecksumDict.ice and I tried to copy it to a subfolder called Ice under the folder were my python scrip was but without success.

There is probably a very easy solution to this but I havn't figured it out.

Thanks in advance!
nickeh
 
Posts: 11
Joined: Fri Dec 05, 2014 9:05 am

Re: ICE and Python

Postby darkman802 » Fri Dec 05, 2014 9:36 am

Try this, -I tells ice where to look for other include directories that contain .ice files.

Code: Select all
Import Ice
Ice.loadSlice('-I/usr/share/Ice-3.5.1/slice', ['Murmur.ice'])
import Murmur
darkman802
 
Posts: 7
Joined: Fri May 16, 2014 5:12 am

Re: ICE and Python

Postby nickeh » Fri Dec 05, 2014 11:14 am

Thanks darkman802!!!

How do I provide the ICE read/write password? I have this code

Code: Select all
#!/usr/bin/python
import Ice
Ice.loadSlice('-I/usr/share/Ice-3.5.1/slice', ['Murmur.ice'])
import Murmur

comm = Ice.initialize()
pxy = comm.stringToProxy("Meta:tcp -h 127.0.0.1 -p 6502")
meta = Murmur.MetaPrx.checkedCast(pxy)
server = meta.getServer(1)
channels = server.getChannels()
users = server.getUsers()


and I get this output indicating that I'm missing the credentials

Code: Select all
Traceback (most recent call last):
  File "mumbleICE.py", line 9, in <module>
    server = meta.getServer(1)
  File "Murmur.ice", line 3949, in getServer
   
Murmur.InvalidSecretException: exception ::Murmur::InvalidSecretException
{
}
nickeh
 
Posts: 11
Joined: Fri Dec 05, 2014 9:05 am

Re: ICE and Python

Postby darkman802 » Fri Dec 05, 2014 12:25 pm

Code: Select all
comm.getImplicitContext().put('secret', 'yourSecretGoesHere')
darkman802
 
Posts: 7
Joined: Fri May 16, 2014 5:12 am

Re: ICE and Python

Postby nickeh » Fri Dec 05, 2014 8:14 pm

Yes, I found that line before but when I use it I get this

Code: Select all
comm.getImplicitContext().put('secret', 'mySecretHere')
AttributeError: 'NoneType' object has no attribute 'put'


the whole code looks like this.
Code: Select all
#!/usr/bin/python
import Ice
Ice.loadSlice('-I/usr/share/Ice-3.5.1/slice', ['Murmur.ice'])
import Murmur

comm = Ice.initialize()
comm.getImplicitContext().put('secret', 'read')
pxy = comm.stringToProxy("Meta:tcp -h 127.0.0.1 -p 6502")
meta = Murmur.MetaPrx.checkedCast(pxy)
server = meta.getServer(1)
channels = server.getChannels()
state = server.getChannelState(2)
users = server.getUsers()


Also what should I look for when I want to see who is talking on the channels including anyone whispering (to another channel and to whom)?

Maybe I should have explained my case from the beginning but here it goes :)

I'm trying to use Mumble as a intercom for broadcast. For now I have figured out how the beltpacks should work but the basestation requires the operator to see who is calling. The beltpacks are based on Olimex A20 mini computers (about the same size as a Raspberry Pi case) that only have one button (headless and only running Mumble + python script). When the button is pressed a python script reads the GPIO and sends (the set key code to Mumble running in X) for example CTRL+1 (Whisper to the Director) as long as it is pressed.

There are in the beginning atleast two basestations (small box on the table, Video (Director) + Audio (Sound Designer)) and the director has for example three buttons. One button for talking to cameras CTRL+1 = Whisper to camera group, CTRL + 2 Floormanager and CTRL +3 Audio basestation (Sound Designer). When a button is pressed a led will light up showing that is broadcasting, double clicking locks the channel to stay broadcasting. If for example the Sound Engineer (Audio channel) wants to talk to the director (that sits in the Video channel) he/she can hear the broadcast but I would like to have another led lighing up above the audio button so that is easier to see who is broadcasting. That's is why I would like to find who is talking to who.

Example channel setup (I didn't remember how all titles are translated so a few are probably wrong :) )

Audio
-Sound Designer
-Sound Technician 1
-Sound Technician 2
Video
-Director
-CAM 1
-CAM 2
-CAM 3
-FM
LIGHT (in future)
-Head of Camera
-Lightdesk
-Light Technician 1

and the list could go on :)
nickeh
 
Posts: 11
Joined: Fri Dec 05, 2014 9:05 am

Re: ICE and Python

Postby fwaggle » Fri Dec 05, 2014 9:07 pm

It's been ages since I mucked around with Ice under Python, but try switching the order around:

Code: Select all
comm = Ice.initialize()
pxy = comm.stringToProxy("Meta:tcp -h 127.0.0.1 -p 6502")
comm.getImplicitContext().put('secret', 'read')

I'm not sure if it'll help or not, but Ice does lots of things weird.
Full disclosure: I used to run a commercial Mumble host, and my opinions do not reflect the opinions of the Mumble project.
Avatar is stolen from here
User avatar
fwaggle
Team member
Team member
 
Posts: 218
Joined: Tue Oct 06, 2009 10:40 pm
Location: Australia

Re: ICE and Python

Postby nickeh » Fri Dec 05, 2014 9:31 pm

I have tried it like you suggested fwaggle and in a few other places but I always get the same error. Disabling the line (and changing settings in Murmur) works perfectly. So still open for suggestions ;)
nickeh
 
Posts: 11
Joined: Fri Dec 05, 2014 9:05 am

Re: ICE and Python

Postby darkman802 » Sat Dec 06, 2014 6:02 am

You probably need to set up the shared context in Ice.

Code: Select all
initdata = Ice.InitializationData()
initdata.properties = Ice.createProperties(None, initdata.properties)
initdata.properties.setProperty('Ice.ImplicitContext', 'Shared')
comm = Ice.initialize(sys.argv, initdata)
comm.getImplicitContext().put('secret', 'mySecretHere')
darkman802
 
Posts: 7
Joined: Fri May 16, 2014 5:12 am

Re: ICE and Python

Postby nickeh » Sat Dec 06, 2014 10:50 am

You rock darkman802!

Now it is working, so where can I read more about how to talk with the Mumble server? I still need to know who is speaking/whispering and to whom.

Thanks in advance!
nickeh
 
Posts: 11
Joined: Fri Dec 05, 2014 9:05 am

Re: ICE and Python

Postby Lindee » Sat Dec 06, 2014 5:48 pm

As a old theatre guy, and now an AV production guy....


THIS IS AWESOME!!! Once you get it where you're happy, please put up specs and everything or start selling this! (If mumble TOS/Copyright allow)
Lindee
 
Posts: 83
Joined: Fri Sep 19, 2014 12:20 pm

Next

Return to Scripting

Who is online

Users browsing this forum: No registered users and 1 guest

cron