Changeset - 46d319974176
[Not reviewed]
default
0 13 0
drewp@bigasterisk.com - 14 years ago 2011-06-15 05:30:19
drewp@bigasterisk.com
move networking settings to config.n3
Ignore-this: 42a6390f9354a171c4d43e1c65a551ca
13 files changed with 50 insertions and 45 deletions:
0 comments (0 inline, 0 general)
bin/ascoltami2
Show inline comments
 
@@ -42,7 +42,7 @@ if __name__ == "__main__":
 

	
 
    parser = optparse.OptionParser()
 
    parser.add_option('--show',
 
        help='show URI, like http://light9.bigasterisk.com/show/dance2008')
 
        help='show URI, like http://light9.bigasterisk.com/show/dance2008', default=showconfig.showUri())
 
    parser.add_option("-v", "--verbose", action="store_true",
 
                      help="logging.DEBUG")
 
    (options, args) = parser.parse_args()
 
@@ -54,5 +54,4 @@ if __name__ == "__main__":
 
            
 
    graph = showconfig.getGraph()
 
    app = App(graph, URIRef(options.show))
 
    musicPort = networking.musicPort()
 
    app.run(musicPort)
 
    app.run(networking.musicPlayer.port)
bin/curvecalc
Show inline comments
 
@@ -80,7 +80,7 @@ class Music:
 
        
 
    def current_time(self):
 
        """return deferred which gets called with the current time"""
 
        d = self.player.request("GET", networking.musicUrl() + "time")
 
        d = self.player.request("GET", networking.musicPlayer.path("time"))
 
        d.addCallback(self._timeReturned)
 
        return d
 

	
 
@@ -96,7 +96,8 @@ class Music:
 
    
 
    def seekplay_or_pause(self,t):
 
        d = self.player.request("POST",
 
                                networking.musicUrl() + "seekPlayOrPause", bodyProducer=StringProducer(jsonlib.write({"t" : t})))
 
                                networking.musicPlayer.path("seekPlayOrPause"),
 
                                bodyProducer=StringProducer(jsonlib.write({"t" : t})))
 

	
 
class Expr(object):
 
    """singleton, provides functions for use in subterm expressions,
bin/dmxserver
Show inline comments
 
@@ -213,7 +213,7 @@ print options
 
if options.dummy:
 
    os.environ['DMXDUMMY'] = "1"
 

	
 
port = networking.dmxServerPort()
 
port = networking.dmxServer.port
 
print "starting xmlrpc server on port %s" % port
 
reactor.listenTCP(port,server.Site(XMLRPCServe(options)))
 
reactor.run()
bin/kcclient
Show inline comments
 
@@ -13,7 +13,7 @@ fadesecs = '0'
 
if len(sys.argv)>3:
 
    fadesecs = sys.argv[3]
 

	
 
levelServer = Resource(networking.keyboardComposerUrl())
 
levelServer = Resource(networking.keyboardComposer.url)
 
levelServer.post('fadesub', subname=subname, level=level, secs=fadesecs)
 

	
 

	
bin/keyboardcomposer
Show inline comments
 
@@ -470,7 +470,7 @@ if __name__ == "__main__":
 

	
 
    import twisted.internet
 
    try:
 
        reactor.listenTCP(networking.kcPort(),
 
        reactor.listenTCP(networking.keyboardComposer.port,
 
                          server.Site(LevelServerHttp(kc.name_to_subtk)))
 
    except twisted.internet.error.CannotListenError, e:
 
        print "Can't (and won't!) start level server:"
bin/lightsim
Show inline comments
 
@@ -118,7 +118,7 @@ if __name__ == '__main__':
 
    window = Window(requiredImages(graph))
 
    window.show()
 

	
 
    serv = Proxy(networking.dmxServerUrl())
 
    serv = Proxy(networking.dmxServer.url)
 
    pollFreq = updatefreq.Updatefreq()
 
    LoopingCall(poll, graph, serv, pollFreq, window.glWidget).start(.05)
 

	
bin/musicPad
Show inline comments
 
@@ -4,7 +4,7 @@ rewrite all the songs with silence at th
 
"""
 
import sys, wave, logging, os
 
sys.path.append(".")
 
from light9 import networking, showconfig
 
from light9 import showconfig
 
from light9.namespaces import L9
 
from light9.ascoltami.playlist import Playlist
 
logging.basicConfig(level=logging.INFO)
bin/musictime
Show inline comments
 
@@ -42,7 +42,7 @@ class MusicTimeTk(tk.Frame, MusicTime):
 
if __name__ == "__main__":
 
    from optparse import OptionParser
 
    parser = OptionParser()
 
    parser.add_option("-u", "--url", default=light9.networking.musicUrl())
 
    parser.add_option("-u", "--url", default=light9.networking.musicPlayer.url)
 
    options, args = parser.parse_args()
 
    
 
    root = tk.Tk()
bin/wavecurve
Show inline comments
 
#!/usr/bin/env python
 
import os, sys, optparse
 
import optparse
 
import run_local
 
from light9.wavepoints import simp
 

	
bin/webcontrol
Show inline comments
 
@@ -22,8 +22,8 @@ from light9.namespaces import L9
 
from urllib import urlencode
 

	
 
# move to web lib
 
def post(root, path, **args):
 
    return getPage(root.rstrip('/') + '/' + path.lstrip('/'),
 
def post(url, **args):
 
    return getPage(url,
 
                   method='POST',
 
                   postdata=urlencode(args))
 

	
 
@@ -31,7 +31,7 @@ def post(root, path, **args):
 
class Commands(object):
 
    @staticmethod
 
    def playSong(graph, songUri):
 
        s = xmlrpclib.ServerProxy(networking.musicUrl())
 
        s = xmlrpclib.ServerProxy(networking.musicPlayer.url)
 
        songPath = graph.value(URIRef(songUri), L9.showPath)
 
        if songPath is None:
 
            raise ValueError("unknown song %s" % songUri)
 
@@ -39,17 +39,17 @@ class Commands(object):
 

	
 
    @staticmethod
 
    def stopMusic(graph):
 
        s = xmlrpclib.ServerProxy(networking.musicUrl())
 
        s = xmlrpclib.ServerProxy(networking.musicPlayer.url)
 
        return s.stop()
 

	
 
    @staticmethod
 
    def worklightsOn(graph):
 
        return post(networking.keyboardComposerUrl(), 'fadesub',
 
        return post(networking.keyboardComposer.path('fadesub'),
 
                    subname='scoop', level=.5, secs=.5)
 

	
 
    @staticmethod
 
    def worklightsOff(graph):
 
        return post(networking.keyboardComposerUrl(), 'fadesub',
 
        return post(networking.keyboardComposer.path('fadesub'),
 
                    subname='scoop', level=0, secs=.5)
 

	
 
    @staticmethod
light9/dmxclient.py
Show inline comments
 
@@ -23,7 +23,7 @@ def outputlevels(levellist,twisted=0,cli
 
    global _dmx, _id
 

	
 
    if _dmx is None:
 
        url = networking.dmxServerUrl()
 
        url = networking.dmxServer.url
 
        if not twisted:
 
            _dmx = xmlrpclib.Server(url)
 
        else:
light9/networking.py
Show inline comments
 
import os
 
from ConfigParser import SafeConfigParser
 
# my intent was to pull these from a file in the LIGHT9_SHOW/ directory
 

	
 
from urlparse import urlparse
 
from urllib import splitport
 
from showconfig import getGraph, showUri
 
from namespaces import L9
 

	
 
def dmxServerUrl():
 
    #host = os.getenv('DMXHOST', 'localhost')
 
    #url = "http://%s:8030" % host
 
    return "http://plus:%s" % dmxServerPort()
 
class ServiceAddress(object):
 
    def __init__(self, service):
 
        self.service = service
 

	
 
    def _url(self):
 
        graph = getGraph()
 
        net = graph.value(showUri(), L9['networking'])
 
        return graph.value(net, self.service)
 

	
 
def dmxServerPort():
 
    return 8030
 
    
 
def musicUrl():
 
    # must have trailing slash!
 
    return "http://django:%s/" % musicPort()
 
    @property
 
    def port(self):
 
        _, netloc, _, _, _, _ = urlparse(self._url())
 
        host, port = splitport(netloc)
 
        return int(port)
 

	
 
def musicPort():
 
    return 8040
 
    @property
 
    def host(self):
 
        _, netloc, _, _, _, _ = urlparse(self._url())
 
        host, port = splitport(netloc)
 
        return host
 

	
 
def mpdServer():
 
    """servername, port"""
 
    return os.getenv('LIGHT9_MPD_SERVER', 'django'),6600
 
    @property
 
    def url(self):
 
        return self._url()
 

	
 
def kcPort():
 
    return 8050
 
    def path(self, more):
 
        return self.url + more
 

	
 
def kcServer():
 
    return 'plus'
 
dmxServer = ServiceAddress(L9['dmxServer'])
 
musicPlayer = ServiceAddress(L9['musicPlayer'])
 
keyboardComposer = ServiceAddress(L9['keyboardComposer'])
 

	
 
def keyboardComposerUrl():
 
    return "http://%s:%s" % (kcServer(), kcPort())
light9/vidref/main.py
Show inline comments
 
@@ -33,7 +33,7 @@ class MusicTime(object):
 
        end of a song)
 
        """
 
        self.period = period
 
        self.musicResource = restkit.Resource(networking.musicUrl())
 
        self.musicResource = restkit.Resource(networking.musicPlayer.url)
 
        t = Thread(target=self._timeUpdate)
 
        t.setDaemon(True)
 
        t.start()
0 comments (0 inline, 0 general)