Changeset - 62e9761a5f13
[Not reviewed]
default
0 1 0
David McClosky - 20 years ago 2005-06-16 23:49:53
dmcc@bigasterisk.com
dmxclient has better clientids, cleanups
- clientids include hostname, strip path prefixes
- twisted is imported on demand
1 file changed with 5 insertions and 5 deletions:
0 comments (0 inline, 0 general)
light9/dmxclient.py
Show inline comments
 
@@ -5,11 +5,12 @@ dmxclient.outputlevels(..)
 
client id is formed from sys.argv[0] and the PID.  """
 

	
 
import xmlrpclib,os,sys,socket,time
 
from twisted.web.xmlrpc import Proxy
 
from light9 import networking
 
_dmx=None
 

	
 
_id="%s-%s" % (sys.argv[0].replace('.py','').replace('./',''),os.getpid())
 
procname = os.path.basename(sys.argv[0])
 
procname = procname.replace('.py', '')
 
_id = "%s-%s-%s" % (procname, socket.gethostname(), os.getpid())
 

	
 
def outputlevels(levellist,twisted=0,clientid=_id):
 
    """present a list of dmx channel levels, each scaled from
 
@@ -26,6 +27,7 @@ def outputlevels(levellist,twisted=0,cli
 
        if not twisted:
 
            _dmx=xmlrpclib.Server(url)
 
        else:
 
            from twisted.web.xmlrpc import Proxy
 
            _dmx = Proxy(url)
 

	
 
    if not twisted:
 
@@ -44,10 +46,8 @@ def outputlevels(levellist,twisted=0,cli
 
        d = _dmx.callRemote('outputlevels',clientid,levellist)
 
        d.addErrback(err)
 

	
 
    
 
dummy = os.getenv('DMXDUMMY')
 
if dummy:
 
    print "dmxclient: DMX is in dummy mode."
 
    def bogus(*args,**kw):
 
    def outputlevels(*args, **kw):
 
        pass
 
    outputlevels = bogus
0 comments (0 inline, 0 general)