Changeset - a38955ba6f40
[Not reviewed]
default
0 14 0
Drew Perttula - 11 years ago 2014-06-13 05:25:02
drewp@bigasterisk.com
rdfdb port is now in the config
Ignore-this: 62a97aed9e0fe42604b8b59009b3d0e6
14 files changed with 23 insertions and 16 deletions:
0 comments (0 inline, 0 general)
bin/clientdemo
Show inline comments
 
@@ -2,20 +2,21 @@
 

	
 
import os, sys
 
sys.path.append(".")
 
from twisted.internet import reactor
 
import cyclone.web, cyclone.httpclient, logging
 
from rdflib import Namespace, Literal, URIRef
 
from light9 import networking
 
from light9.rdfdb.patch import Patch
 
from light9.rdfdb.syncedgraph import SyncedGraph
 

	
 
if __name__ == "__main__":
 
    logging.basicConfig(level=logging.DEBUG)
 
    log = logging.getLogger()
 

	
 
    g = SyncedGraph("clientdemo")
 
    g = SyncedGraph(networking.rdfdb.url, "clientdemo")
 

	
 
    from light9.Submaster import PersistentSubmaster
 
    sub = PersistentSubmaster(graph=g, uri=URIRef("http://light9.bigasterisk.com/sub/bcools"))
 

	
 
    #get sub to show its updating name, then push that all the way into KC gui so we can see just names refresh in there
 

	
bin/curvecalc
Show inline comments
 
@@ -499,13 +499,13 @@ def main():
 
    log.debug("startup: music %s", time.time() - startTime)
 

	
 

	
 
    session = clientsession.getUri('curvecalc', opts)
 

	
 
    music = Music()
 
    graph = SyncedGraph("curvecalc")
 
    graph = SyncedGraph(networking.rdfdb.url, "curvecalc")
 

	
 
    graph.initiallySynced.addCallback(
 
        lambda _: launch(args, graph, session, opts, startTime, music))
 
    from light9 import prof
 
    prof.run(reactor.run, profile=opts.profile)
 

	
bin/effecteval
Show inline comments
 
@@ -178,15 +178,16 @@ class SongEffectsEval(PrettyErrorHandler
 
        effects = effectsForSong(self.settings.graph, song)
 
        raise NotImplementedError
 
        self.write(maxDict(effectDmxDict(e) for e in effects))
 
        # return dmx dict for all effects in the song, already combined
 

	
 
class App(object):
 
    def __init__(self, show):
 
    def __init__(self, show, outputWhere):
 
        self.show = show
 
        self.graph = SyncedGraph("effectEval")
 
        self.outputWhere = outputWhere
 
        self.graph = SyncedGraph(networking.rdfdb.url, "effectEval")
 
        self.graph.initiallySynced.addCallback(self.launch)
 

	
 
        self.stats = scales.collection('/',
 
                                       scales.PmfStat('sendLevels'),
 
                                       scales.PmfStat('getMusic'),
 
                                       scales.PmfStat('writeDmx'),
bin/gtk_dnd_demo.py
Show inline comments
 
#!bin/python
 
import run_local
 
import gtk
 
import sys
 
sys.path.append(".")
 
from rdflib import URIRef
 
from light9 import networking
 
from light9.editchoicegtk import EditChoice, Local
 
from light9.observable import Observable
 
from light9.rdfdb.syncedgraph import SyncedGraph
 

	
 
win = gtk.Window()
 

	
 
graph = SyncedGraph("gtkdnddemo")
 
graph = SyncedGraph(networking.rdfdb.url, "gtkdnddemo")
 

	
 
r1 = URIRef("http://example.com/interestingThing")
 
v = Observable(r1)
 
win.add(EditChoice(graph, v))
 
win.show_all()
 
gtk.main()
bin/inputdemo
Show inline comments
 
@@ -23,13 +23,13 @@ class App(object):
 
        clientsession.add_option(parser)
 
        opts, args = parser.parse_args()
 

	
 
        log.setLevel(logging.DEBUG if opts.debug else logging.INFO)
 

	
 
        self.session = clientsession.getUri('inputdemo', opts)
 
        self.graph = SyncedGraph("inputdemo")
 
        self.graph = SyncedGraph(networking.rdfdb.url, "inputdemo")
 

	
 
        self.graph.initiallySynced.addCallback(lambda _: self.launch())
 

	
 
        self.curve = args[0] if args else URIRef('http://light9.bigasterisk.com/show/dance2014/song1/curve/c-1401259747.675542')
 
        print "sending points on curve %s" % self.curve
 
        
bin/keyboardcomposer
Show inline comments
 
@@ -600,13 +600,13 @@ if __name__ == "__main__":
 
    clientsession.add_option(parser)
 
    parser.add_option('-v', action='store_true', help="log info level")
 
    opts, args = parser.parse_args()
 

	
 
    log.setLevel(logging.INFO if opts.v else logging.WARN)
 

	
 
    graph = SyncedGraph("keyboardcomposer")
 
    graph = SyncedGraph(networking.rdfdb.url, "keyboardcomposer")
 

	
 
    # i think this also needs delayed start (like subcomposer has), to have a valid graph
 
    # before setting any stuff from the ui
 
    
 
    root = Tk()
 
    initTkdnd(root.tk, 'tkdnd/trunk/')
bin/listsongs
Show inline comments
 
@@ -8,16 +8,17 @@ function _songs { local expl;  _descript
 
compdef _songs curvecalc
 
"""
 

	
 
from run_local import log
 
from twisted.internet import reactor
 
from rdflib import RDF
 
from light9 import networking
 
from light9.namespaces import L9
 
from light9.rdfdb.syncedgraph import SyncedGraph
 

	
 
graph = SyncedGraph("listsongs")
 
graph = SyncedGraph(networking.rdfdb.url, "listsongs")
 

	
 
@graph.initiallySynced.addCallback
 
def printSongs(result):
 
    with graph.currentState() as current:
 
        for song in current.subjects(RDF.type, L9['Song']):
 
            print song
bin/subcomposer
Show inline comments
 
@@ -270,13 +270,13 @@ if __name__ == "__main__":
 
    root=tk.Tk()
 
    root.config(bg='black')
 
    root.tk_setPalette("#004633")
 

	
 
    initTkdnd(root.tk, 'tkdnd/trunk/')
 

	
 
    graph = SyncedGraph("subcomposer")
 
    graph = SyncedGraph(networking.rdfdb.url, "subcomposer")
 
    session = clientsession.getUri('subcomposer', opts)
 

	
 
    graph.initiallySynced.addCallback(lambda _: launch(opts, args, root, graph, session))
 

	
 
    root.protocol('WM_DELETE_WINDOW', reactor.stop)
 
    tksupport.install(root,ms=10)
bin/subserver
Show inline comments
 
@@ -112,13 +112,13 @@ if __name__ == "__main__":
 
    parser.add_option("-v", "--verbose", action="store_true",
 
                      help="logging.DEBUG")
 
    (options, args) = parser.parse_args()
 

	
 
    log.setLevel(logging.DEBUG if options.verbose else logging.INFO)
 

	
 
    graph = SyncedGraph("subserver")
 
    graph = SyncedGraph(networking.rdfdb.url, "subserver")
 

	
 
    d = {}
 
    def updateSubs():
 
        subs = []
 
        for sub in sorted(graph.subjects(RDF.type, L9['Submaster'])):
 
            rec = {'uri' : sub}
bin/vidref
Show inline comments
 
@@ -47,13 +47,13 @@ class Snapshot(cyclone.web.RequestHandle
 
            traceback.print_exc()
 
            raise
 

	
 
class SnapshotPic(cyclone.web.StaticFileHandler):
 
    pass
 

	
 
graph = SyncedGraph("vidref")
 
graph = SyncedGraph(networking.rdfdb.url, "vidref")
 

	
 
gui = Gui(graph)
 

	
 
port = networking.vidref.port
 
reactor.listenTCP(port, cyclone.web.Application(handlers=[
 
    (r'/()', cyclone.web.StaticFileHandler,
bin/vidrefsetup
Show inline comments
 
@@ -49,13 +49,13 @@ def main():
 
    parser = optparse.OptionParser()
 
    parser.add_option("-v", "--verbose", action="store_true",
 
                      help="logging.DEBUG")
 
    (options, args) = parser.parse_args()
 

	
 
    log.setLevel(logging.DEBUG if options.verbose else logging.INFO)
 
    graph = SyncedGraph("vidrefsetup")
 
    graph = SyncedGraph(networking.rdfdb.url, "vidrefsetup")
 

	
 
    # deliberately conflict with vidref since they can't talk at once to cam
 
    port = networking.vidref.port 
 

	
 
    reactor.listenTCP(port, cyclone.web.Application(handlers=[
 
        (r'/pic', RedirToCamera),
light9/networking.py
Show inline comments
 
@@ -39,6 +39,7 @@ oscDmxServer = ServiceAddress(L9['oscDmx
 
musicPlayer = ServiceAddress(L9['musicPlayer'])
 
keyboardComposer = ServiceAddress(L9['keyboardComposer'])
 
curveCalc = ServiceAddress(L9['curveCalc'])
 
vidref = ServiceAddress(L9['vidref'])
 
effectEval = ServiceAddress(L9['effectEval'])
 
picamserve = ServiceAddress(L9['picamserve'])
 
rdfdb = ServiceAddress(L9['rdfdb'])
light9/rdfdb/syncedgraph.py
Show inline comments
 
@@ -48,23 +48,24 @@ class SyncedGraph(CurrentStateGraphApi, 
 
    statements unless we have the correct graph.
 

	
 
    If we get out of sync, we abandon our local graph (even any
 
    pending local changes) and get the data again from the
 
    server.
 
    """
 
    def __init__(self, label):
 
    def __init__(self, rdfdbRoot, label):
 
        """
 
        label is a string that the server will display in association
 
        with your connection
 
        """
 
        self.rdfdbRoot = rdfdbRoot
 
        self.initiallySynced = defer.Deferred()
 
        self._graph = ConjunctiveGraph()
 

	
 
        self._receiver = PatchReceiver(label, self._onPatch)
 
        
 
        self._sender = PatchSender('http://localhost:8051/patches',
 
        self._sender = PatchSender(self.rdfdbRoot + 'patches',
 
                                   self._receiver.updateResource)
 
        AutoDepGraphApi.__init__(self)
 
        # this needs more state to track if we're doing a resync (and
 
        # everything has to error or wait) or if we're live
 
        
 
    def resync(self):
 
@@ -81,13 +82,13 @@ class SyncedGraph(CurrentStateGraphApi, 
 
        should just fail them. There should be a notification back to
 
        UIs who want to show that we're doing a resync.
 
        """
 
        self._sender.cancelAll()
 
        # this should be locked so only one resync goes on at once
 
        return cyclone.httpclient.fetch(
 
            url="http://localhost:8051/graph",
 
            url=self.rdfdbRoot + "graph",
 
            method="GET",
 
            headers={'Accept':['x-trig']},
 
            ).addCallback(self._resyncGraph)
 

	
 
    def _resyncGraph(self, response):
 
        log.warn("new graph in")
show/dance2014/networking.n3
Show inline comments
 
@prefix : <http://light9.bigasterisk.com/> .
 
@prefix show: <http://light9.bigasterisk.com/show/> .
 
@prefix sh: <http://light9.bigasterisk.com/show/dance2014/> .
 

	
 
show:dance2014 :networking sh:netHome .
 
sh:netHome  
 
sh:netHome
 
  :rdfdb            <http://localhost:8051/>;
 
  :effectEval       <http://dash:8070/>;
 
  :musicPlayer      <http://dash:8040/>;
 
  :dmxServer        <http://dash:8030/>;
 
  :oscDmxServer     <udp://dash:9050/>;
 
  :curveCalc        <http://dash:8060/>;
 
  :keyboardComposer <http://dash:8050/>;
0 comments (0 inline, 0 general)