comparison bin/staticclient @ 1176:c78a8f8a08ec

new staticclient Ignore-this: 15830ee833744b2be9709407388d0065
author Drew Perttula <drewp@bigasterisk.com>
date Sun, 15 Jun 2014 06:50:04 +0000
parents
children 7772cc48e016
comparison
equal deleted inserted replaced
1175:e435649569f3 1176:c78a8f8a08ec
1 #!bin/python
2 """
3 push a dmx level forever
4 """
5 from __future__ import division, nested_scopes
6 import time, logging
7 from optparse import OptionParser
8 import logging, urllib
9 from twisted.internet import reactor, tksupport, task
10 from rdflib import URIRef, RDF, RDFS, Literal
11
12 from run_local import log
13 log.setLevel(logging.DEBUG)
14
15 from light9 import dmxclient, showconfig, networking
16
17 if __name__ == "__main__":
18 parser = OptionParser(usage="%prog")
19 parser.add_option('--chan', help='channel number, starts at 1', type=int) #todo: or name or uri
20 parser.add_option('--level', help='0..1', type=float)
21 parser.add_option('-v', action='store_true', help="log debug level")
22
23 opts, args = parser.parse_args()
24
25 log.setLevel(logging.DEBUG if opts.v else logging.INFO)
26
27 levels = [0] * (opts.chan - 1) + [opts.level]
28 log.info('staticclient will write this forever: %r', levels)
29 def write():
30 log.debug('writing %r', levels)
31 dmxclient.outputlevels(levels, twisted=1)
32 log.info('looping...')
33 task.LoopingCall(write).start(1)
34 reactor.run()