Mercurial > code > home > repos > light9
changeset 1176:c78a8f8a08ec
new staticclient
Ignore-this: 15830ee833744b2be9709407388d0065
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Sun, 15 Jun 2014 06:50:04 +0000 |
parents | e435649569f3 |
children | eccb02a704cf |
files | bin/staticclient |
diffstat | 1 files changed, 34 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/staticclient Sun Jun 15 06:50:04 2014 +0000 @@ -0,0 +1,34 @@ +#!bin/python +""" +push a dmx level forever +""" +from __future__ import division, nested_scopes +import time, logging +from optparse import OptionParser +import logging, urllib +from twisted.internet import reactor, tksupport, task +from rdflib import URIRef, RDF, RDFS, Literal + +from run_local import log +log.setLevel(logging.DEBUG) + +from light9 import dmxclient, showconfig, networking + +if __name__ == "__main__": + parser = OptionParser(usage="%prog") + parser.add_option('--chan', help='channel number, starts at 1', type=int) #todo: or name or uri + parser.add_option('--level', help='0..1', type=float) + parser.add_option('-v', action='store_true', help="log debug level") + + opts, args = parser.parse_args() + + log.setLevel(logging.DEBUG if opts.v else logging.INFO) + + levels = [0] * (opts.chan - 1) + [opts.level] + log.info('staticclient will write this forever: %r', levels) + def write(): + log.debug('writing %r', levels) + dmxclient.outputlevels(levels, twisted=1) + log.info('looping...') + task.LoopingCall(write).start(1) + reactor.run()