summaryrefslogtreecommitdiffstats
path: root/scripts/ingen.py
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-10-30 00:32:55 +0000
committerDavid Robillard <d@drobilla.net>2015-10-30 00:32:55 +0000
commit6db2bea5bef36fd97746e3b02612b075b442ea74 (patch)
tree635f85c8820a3ed7dd008afa9066ecd1335a5497 /scripts/ingen.py
parente203132d8439033be91d2cc9c4ec71d6632eab10 (diff)
downloadingen-6db2bea5bef36fd97746e3b02612b075b442ea74.tar.gz
ingen-6db2bea5bef36fd97746e3b02612b075b442ea74.tar.bz2
ingen-6db2bea5bef36fd97746e3b02612b075b442ea74.zip
Make ingen.py and ingenish able to control anything
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5805 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'scripts/ingen.py')
-rw-r--r--scripts/ingen.py67
1 files changed, 41 insertions, 26 deletions
diff --git a/scripts/ingen.py b/scripts/ingen.py
index de1c8ec2..4af037ba 100644
--- a/scripts/ingen.py
+++ b/scripts/ingen.py
@@ -37,13 +37,16 @@ class NS:
class Interface:
'The core Ingen interface'
- def put(self, path, body):
+ def put(self, subject, body):
pass
- def get(self, path):
+ def patch(self, subject, remove, add):
pass
- def set(self, path, body):
+ def get(self, subject):
+ pass
+
+ def set(self, subject, key, value):
pass
def connect(self, tail, head):
@@ -52,7 +55,7 @@ class Interface:
def disconnect(self, tail, head):
pass
- def delete(self, path):
+ def delete(self, subject):
pass
class Error(Exception):
@@ -216,42 +219,54 @@ class Remote(Interface):
# Update model with remaining information, e.g. patch:Put updates
return self.update_model(response_model)
- def get(self, path):
+ def get(self, subject):
return self.send('''
[]
- a patch:Get ;
- patch:subject <ingen:/graph%s> .
-''' % path)
+ a patch:Get ;
+ patch:subject <%s> .
+''' % subject)
- def put(self, path, body):
+ def put(self, subject, body):
return self.send('''
[]
- a patch:Put ;
- patch:subject <ingen:/graph%s> ;
- patch:body [
+ a patch:Put ;
+ patch:subject <%s> ;
+ patch:body [
%s
] .
-''' % (path, body))
+''' % (subject, body))
- def set(self, path, body):
+ def patch(self, subject, remove, add):
return self.send('''
[]
- a patch:Set ;
- patch:subject <ingen:/graph%s> ;
- patch:body [
+ a patch:Patch ;
+ patch:subject <%s> ;
+ patch:remove [
+%s
+ ] ;
+ patch:add [
%s
] .
-''' % (path, body))
+''' % (subject, remove, add))
+
+ def set(self, subject, key, value):
+ return self.send('''
+[]
+ a patch:Set ;
+ patch:subject <%s> ;
+ patch:property <%s> ;
+ patch:value %s .
+''' % (subject, key, value))
def connect(self, tail, head):
return self.send('''
[]
a patch:Put ;
- patch:subject <ingen:/graph%s> ;
+ patch:subject <%s> ;
patch:body [
a ingen:Arc ;
- ingen:tail <ingen:/graph%s> ;
- ingen:head <ingen:/graph%s> ;
+ ingen:tail <%s> ;
+ ingen:head <%s> ;
] .
''' % (os.path.commonprefix([tail, head]), tail, head))
@@ -261,14 +276,14 @@ class Remote(Interface):
a patch:Delete ;
patch:body [
a ingen:Arc ;
- ingen:tail <ingen:/graph%s> ;
- ingen:head <ingen:/graph%s> ;
+ ingen:tail <%s> ;
+ ingen:head <%s> ;
] .
''' % (tail, head))
- def delete(self, path):
+ def delete(self, subject):
return self.send('''
[]
a patch:Delete ;
- patch:subject <ingen:/graph%s> .
-''' % path)
+ patch:subject <%s> .
+''' % subject)