annotate light8/dmxclient.py @ 167:79bc84310e80

changes from tonight's rehearsal: changes from tonight's rehearsal: - CueFader is closer to actually running the show, computes DMX levels to send. - KeyboardComposer is not a dummy. Use DMXDUMMY=1 to disable it. - Submaster: subs can now be "temporary" -- i.e. they shouldn't be saved or loaded. to save a temporary sub, make a copy of it with a proper name since the computed name will be ugly. Also, get_normalized_copy() and crossfade() methods added. linear_fade helper (shouldn't be in Submaster, probably) added too. - dmxchanedit: longer labels - cuelist1 now has some bogus data in it and some crap removed - dmxclient: now listens to the $DMXHOST and $DMXDUMMY env variables. - patchdata: now up to date with this year's show - danshow subs song{01..19}: removed. maybe we'll re-add them in an archive directory.
author dmcc
date Tue, 08 Jul 2003 16:19:55 +0000
parents 2dfe2c0ba052
children 238eede02bf9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
1 """ module for clients to use for easy talking to the dmx
45b12307c695 Initial revision
drewp
parents:
diff changeset
2 server. sending levels is now a simple call to
45b12307c695 Initial revision
drewp
parents:
diff changeset
3 dmxclient.outputlevels(..)
45b12307c695 Initial revision
drewp
parents:
diff changeset
4
45b12307c695 Initial revision
drewp
parents:
diff changeset
5 client id is formed from sys.argv[0] and the PID. """
45b12307c695 Initial revision
drewp
parents:
diff changeset
6
45b12307c695 Initial revision
drewp
parents:
diff changeset
7 import xmlrpclib,os,sys,socket,time
45b12307c695 Initial revision
drewp
parents:
diff changeset
8 _dmx=None
45b12307c695 Initial revision
drewp
parents:
diff changeset
9
45b12307c695 Initial revision
drewp
parents:
diff changeset
10 _id="%s-%s" % (sys.argv[0].replace('.py','').replace('./',''),os.getpid())
45b12307c695 Initial revision
drewp
parents:
diff changeset
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
45b12307c695 Initial revision
drewp
parents:
diff changeset
13 """present a list of dmx channel levels, each scaled from
45b12307c695 Initial revision
drewp
parents:
diff changeset
14 0..1. list can be any length- it will apply to the first len() dmx
45b12307c695 Initial revision
drewp
parents:
diff changeset
15 channels.
45b12307c695 Initial revision
drewp
parents:
diff changeset
16
45b12307c695 Initial revision
drewp
parents:
diff changeset
17 if the server is not found, outputlevels will block for a
45b12307c695 Initial revision
drewp
parents:
diff changeset
18 second."""
45b12307c695 Initial revision
drewp
parents:
diff changeset
19
45b12307c695 Initial revision
drewp
parents:
diff changeset
20 global _dmx,_id
45b12307c695 Initial revision
drewp
parents:
diff changeset
21
45b12307c695 Initial revision
drewp
parents:
diff changeset
22 if _dmx is None:
167
79bc84310e80 changes from tonight's rehearsal:
dmcc
parents: 141
diff changeset
23 host = os.getenv('DMXHOST', 'localhost')
79bc84310e80 changes from tonight's rehearsal:
dmcc
parents: 141
diff changeset
24 _dmx=xmlrpclib.Server("http://%s:8030" % host)
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
25
120
b75bfbcf5979 new modules: dmxclient provides a very convenient way for clients to talk to the
drewp
parents: 0
diff changeset
26 try:
b75bfbcf5979 new modules: dmxclient provides a very convenient way for clients to talk to the
drewp
parents: 0
diff changeset
27 _dmx.outputlevels(_id,levellist)
b75bfbcf5979 new modules: dmxclient provides a very convenient way for clients to talk to the
drewp
parents: 0
diff changeset
28 except socket.error,e:
141
2dfe2c0ba052 fixed an err msg
drewp
parents: 120
diff changeset
29 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
30 time.sleep(1)
b75bfbcf5979 new modules: dmxclient provides a very convenient way for clients to talk to the
drewp
parents: 0
diff changeset
31 except xmlrpclib.Fault,e:
b75bfbcf5979 new modules: dmxclient provides a very convenient way for clients to talk to the
drewp
parents: 0
diff changeset
32 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
33 time.sleep(1)
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
34
167
79bc84310e80 changes from tonight's rehearsal:
dmcc
parents: 141
diff changeset
35 dummy = os.getenv('DMXDUMMY')
79bc84310e80 changes from tonight's rehearsal:
dmcc
parents: 141
diff changeset
36 if dummy:
79bc84310e80 changes from tonight's rehearsal:
dmcc
parents: 141
diff changeset
37 print "dmxclient: DMX is in dummy mode."
79bc84310e80 changes from tonight's rehearsal:
dmcc
parents: 141
diff changeset
38 def bogus(*args):
79bc84310e80 changes from tonight's rehearsal:
dmcc
parents: 141
diff changeset
39 pass
79bc84310e80 changes from tonight's rehearsal:
dmcc
parents: 141
diff changeset
40 outputlevels = bogus