0
|
1 #!/usr/bin/python
|
|
2
|
121
|
3 """ a test that listens to ascoltami player and outputs a light to
|
|
4 dmxserver """
|
|
5
|
|
6 from __future__ import division
|
|
7 import xmlrpclib,time,socket,sys
|
|
8 sys.path.append("../light8")
|
|
9 import dmxclient
|
0
|
10
|
|
11 player=xmlrpclib.Server("http://localhost:8040")
|
121
|
12 print "found player"
|
0
|
13
|
|
14 t1=time.time()
|
|
15 while 1:
|
|
16 try:
|
|
17 playtime=player.gettime()
|
|
18 except socket.error,e:
|
|
19 print "server error %r, waiting"%e
|
|
20 time.sleep(2)
|
121
|
21
|
|
22 lev=0
|
|
23 for low,high,func in ((0,20,0),
|
|
24 (20,30,(playtime-20)/10),
|
|
25 (30,170,1),
|
|
26 (170,189,1-(playtime-170)/19),
|
|
27 ):
|
|
28 if low<=playtime<high:
|
|
29 lev=func
|
|
30
|
|
31 print "Send",lev
|
|
32 dmxclient.outputlevels([lev])
|
|
33
|
0
|
34 time.sleep(.01)
|