# HG changeset patch # User Drew Perttula # Date 2014-06-13 05:25:02 # Node ID a38955ba6f40eeca9353e1b0111f747a9d8f3b3d # Parent 780e91cc21cc79b8976833d2142a150d0bd01723 rdfdb port is now in the config Ignore-this: 62a97aed9e0fe42604b8b59009b3d0e6 diff --git a/bin/clientdemo b/bin/clientdemo --- a/bin/clientdemo +++ b/bin/clientdemo @@ -5,6 +5,7 @@ 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 @@ -12,7 +13,7 @@ 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")) diff --git a/bin/curvecalc b/bin/curvecalc --- a/bin/curvecalc +++ b/bin/curvecalc @@ -502,7 +502,7 @@ def main(): 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)) diff --git a/bin/effecteval b/bin/effecteval --- a/bin/effecteval +++ b/bin/effecteval @@ -181,9 +181,10 @@ class SongEffectsEval(PrettyErrorHandler # 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('/', diff --git a/bin/gtk_dnd_demo.py b/bin/gtk_dnd_demo.py --- a/bin/gtk_dnd_demo.py +++ b/bin/gtk_dnd_demo.py @@ -4,13 +4,14 @@ 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) diff --git a/bin/inputdemo b/bin/inputdemo --- a/bin/inputdemo +++ b/bin/inputdemo @@ -26,7 +26,7 @@ class App(object): 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()) diff --git a/bin/keyboardcomposer b/bin/keyboardcomposer --- a/bin/keyboardcomposer +++ b/bin/keyboardcomposer @@ -603,7 +603,7 @@ if __name__ == "__main__": 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 diff --git a/bin/listsongs b/bin/listsongs --- a/bin/listsongs +++ b/bin/listsongs @@ -11,10 +11,11 @@ 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): diff --git a/bin/subcomposer b/bin/subcomposer --- a/bin/subcomposer +++ b/bin/subcomposer @@ -273,7 +273,7 @@ if __name__ == "__main__": 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)) diff --git a/bin/subserver b/bin/subserver --- a/bin/subserver +++ b/bin/subserver @@ -115,7 +115,7 @@ if __name__ == "__main__": log.setLevel(logging.DEBUG if options.verbose else logging.INFO) - graph = SyncedGraph("subserver") + graph = SyncedGraph(networking.rdfdb.url, "subserver") d = {} def updateSubs(): diff --git a/bin/vidref b/bin/vidref --- a/bin/vidref +++ b/bin/vidref @@ -50,7 +50,7 @@ class Snapshot(cyclone.web.RequestHandle class SnapshotPic(cyclone.web.StaticFileHandler): pass -graph = SyncedGraph("vidref") +graph = SyncedGraph(networking.rdfdb.url, "vidref") gui = Gui(graph) diff --git a/bin/vidrefsetup b/bin/vidrefsetup --- a/bin/vidrefsetup +++ b/bin/vidrefsetup @@ -52,7 +52,7 @@ def main(): (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 diff --git a/light9/networking.py b/light9/networking.py --- a/light9/networking.py +++ b/light9/networking.py @@ -42,3 +42,4 @@ curveCalc = ServiceAddress(L9['curveCalc vidref = ServiceAddress(L9['vidref']) effectEval = ServiceAddress(L9['effectEval']) picamserve = ServiceAddress(L9['picamserve']) +rdfdb = ServiceAddress(L9['rdfdb']) diff --git a/light9/rdfdb/syncedgraph.py b/light9/rdfdb/syncedgraph.py --- a/light9/rdfdb/syncedgraph.py +++ b/light9/rdfdb/syncedgraph.py @@ -51,17 +51,18 @@ class SyncedGraph(CurrentStateGraphApi, 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 @@ -84,7 +85,7 @@ class SyncedGraph(CurrentStateGraphApi, 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) diff --git a/show/dance2014/networking.n3 b/show/dance2014/networking.n3 --- a/show/dance2014/networking.n3 +++ b/show/dance2014/networking.n3 @@ -3,7 +3,8 @@ @prefix sh: . show:dance2014 :networking sh:netHome . -sh:netHome +sh:netHome + :rdfdb ; :effectEval ; :musicPlayer ; :dmxServer ;