Mercurial > code > home > repos > light9
annotate light8/dmxclient.py @ 141:2dfe2c0ba052
fixed an err msg
fixed an err msg
changed hostname of dmx server to 'dash'
author | drewp |
---|---|
date | Sun, 15 Jun 2003 15:19:06 +0000 |
parents | b75bfbcf5979 |
children | 79bc84310e80 |
rev | line source |
---|---|
0 | 1 """ module for clients to use for easy talking to the dmx |
2 server. sending levels is now a simple call to | |
3 dmxclient.outputlevels(..) | |
4 | |
5 client id is formed from sys.argv[0] and the PID. """ | |
6 | |
7 import xmlrpclib,os,sys,socket,time | |
8 _dmx=None | |
9 | |
10 _id="%s-%s" % (sys.argv[0].replace('.py','').replace('./',''),os.getpid()) | |
11 | |
120
b75bfbcf5979
new modules: dmxclient provides a very convenient way for clients to talk to the
drewp
parents:
0
diff
changeset
|
12 def outputlevels(levellist): |
0 | 13 """present a list of dmx channel levels, each scaled from |
14 0..1. list can be any length- it will apply to the first len() dmx | |
15 channels. | |
16 | |
17 if the server is not found, outputlevels will block for a | |
18 second.""" | |
19 | |
20 global _dmx,_id | |
21 | |
22 if _dmx is None: | |
141 | 23 _dmx=xmlrpclib.Server("http://dash:8030") |
0 | 24 |
120
b75bfbcf5979
new modules: dmxclient provides a very convenient way for clients to talk to the
drewp
parents:
0
diff
changeset
|
25 try: |
b75bfbcf5979
new modules: dmxclient provides a very convenient way for clients to talk to the
drewp
parents:
0
diff
changeset
|
26 _dmx.outputlevels(_id,levellist) |
b75bfbcf5979
new modules: dmxclient provides a very convenient way for clients to talk to the
drewp
parents:
0
diff
changeset
|
27 except socket.error,e: |
141 | 28 print "dmx server error %s, waiting"%e |
120
b75bfbcf5979
new modules: dmxclient provides a very convenient way for clients to talk to the
drewp
parents:
0
diff
changeset
|
29 time.sleep(1) |
b75bfbcf5979
new modules: dmxclient provides a very convenient way for clients to talk to the
drewp
parents:
0
diff
changeset
|
30 except xmlrpclib.Fault,e: |
b75bfbcf5979
new modules: dmxclient provides a very convenient way for clients to talk to the
drewp
parents:
0
diff
changeset
|
31 print "outputlevels had xml fault: %s" % e |
b75bfbcf5979
new modules: dmxclient provides a very convenient way for clients to talk to the
drewp
parents:
0
diff
changeset
|
32 time.sleep(1) |
0 | 33 |