annotate flax/littletimeline.py @ 2450:a4052905ca7d default tip

notes about how rdfdb syncs, or should sync
author drewp@bigasterisk.com
date Mon, 03 Jun 2024 23:01:54 -0700
parents 2f48cb9219ed
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
1 #!/usr/bin/python
45b12307c695 Initial revision
drewp
parents:
diff changeset
2
121
2f48cb9219ed now does a little show, with two fades
drewp
parents: 113
diff changeset
3 """ a test that listens to ascoltami player and outputs a light to
2f48cb9219ed now does a little show, with two fades
drewp
parents: 113
diff changeset
4 dmxserver """
2f48cb9219ed now does a little show, with two fades
drewp
parents: 113
diff changeset
5
2f48cb9219ed now does a little show, with two fades
drewp
parents: 113
diff changeset
6 from __future__ import division
2f48cb9219ed now does a little show, with two fades
drewp
parents: 113
diff changeset
7 import xmlrpclib,time,socket,sys
2f48cb9219ed now does a little show, with two fades
drewp
parents: 113
diff changeset
8 sys.path.append("../light8")
2f48cb9219ed now does a little show, with two fades
drewp
parents: 113
diff changeset
9 import dmxclient
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
10
45b12307c695 Initial revision
drewp
parents:
diff changeset
11 player=xmlrpclib.Server("http://localhost:8040")
121
2f48cb9219ed now does a little show, with two fades
drewp
parents: 113
diff changeset
12 print "found player"
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
13
45b12307c695 Initial revision
drewp
parents:
diff changeset
14 t1=time.time()
45b12307c695 Initial revision
drewp
parents:
diff changeset
15 while 1:
45b12307c695 Initial revision
drewp
parents:
diff changeset
16 try:
45b12307c695 Initial revision
drewp
parents:
diff changeset
17 playtime=player.gettime()
45b12307c695 Initial revision
drewp
parents:
diff changeset
18 except socket.error,e:
45b12307c695 Initial revision
drewp
parents:
diff changeset
19 print "server error %r, waiting"%e
45b12307c695 Initial revision
drewp
parents:
diff changeset
20 time.sleep(2)
121
2f48cb9219ed now does a little show, with two fades
drewp
parents: 113
diff changeset
21
2f48cb9219ed now does a little show, with two fades
drewp
parents: 113
diff changeset
22 lev=0
2f48cb9219ed now does a little show, with two fades
drewp
parents: 113
diff changeset
23 for low,high,func in ((0,20,0),
2f48cb9219ed now does a little show, with two fades
drewp
parents: 113
diff changeset
24 (20,30,(playtime-20)/10),
2f48cb9219ed now does a little show, with two fades
drewp
parents: 113
diff changeset
25 (30,170,1),
2f48cb9219ed now does a little show, with two fades
drewp
parents: 113
diff changeset
26 (170,189,1-(playtime-170)/19),
2f48cb9219ed now does a little show, with two fades
drewp
parents: 113
diff changeset
27 ):
2f48cb9219ed now does a little show, with two fades
drewp
parents: 113
diff changeset
28 if low<=playtime<high:
2f48cb9219ed now does a little show, with two fades
drewp
parents: 113
diff changeset
29 lev=func
2f48cb9219ed now does a little show, with two fades
drewp
parents: 113
diff changeset
30
2f48cb9219ed now does a little show, with two fades
drewp
parents: 113
diff changeset
31 print "Send",lev
2f48cb9219ed now does a little show, with two fades
drewp
parents: 113
diff changeset
32 dmxclient.outputlevels([lev])
2f48cb9219ed now does a little show, with two fades
drewp
parents: 113
diff changeset
33
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
34 time.sleep(.01)