summaryrefslogtreecommitdiffstats
path: root/scripts
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
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')
-rw-r--r--scripts/ingen.py67
-rwxr-xr-xscripts/ingenish42
2 files changed, 64 insertions, 45 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)
diff --git a/scripts/ingenish b/scripts/ingenish
index bc7d821a..a1ff3a56 100755
--- a/scripts/ingenish
+++ b/scripts/ingenish
@@ -38,28 +38,30 @@ Options:
an address like tcp:///my-ingen-server-host:16180
Commands:
- put PATH TURTLE_FRAGMENT
- set PATH TURTLE_FRAGMENT
- connect TAIL_PATH HEAD_PATH
- disconnect TAIL_PATH HEAD_PATH
- delete PATH
+ put SUBJECT BODY
+ set SUBJECT BODY
+ connect TAIL HEAD
+ disconnect TAIL HEAD
+ patch SUBJECT REMOVE ADD
+ delete SUBJECT
help
exit
-Paths are UNIX-style paths with strict LV2 symbol components, e.g. /foo/bar_2.
-Turtle fragments are used verbatim as the body of blank nodes, the syntax is
-identical to the descriptions in Ingen patch files.
+Subjects are specified by URI, relative to the engine. The top level audio
+graph has the path /graph, so for example, a port on a block might have the
+(relative) URI /graph/osc/freq.
-Example:
- ingenish put /left_in 'a lv2:InputPort ; a lv2:AudioPort'
- ingenish put /left_out 'a lv2:OutputPort ; a lv2:AudioPort'
+Bodies are specified in fragments of Turtle, just as written in Ingen graph files.
- ingenish put /tone 'a ingen:Block ; lv2:prototype <http://drobilla.net/plugins/mda/Shepard>'
- ingenish put /combo 'a ingen:Block ; lv2:prototype <http://drobilla.net/plugins/mda/Combo>'
- ingenish connect /left_in /tone/left_in
- ingenish connect /tone/left_out /combo/left_in
- ingenish connect /combo/left_out /left_out
- ingenish set /tone/output 'ingen:value 0.7'
+Example:
+ put /graph/left_in 'a lv2:InputPort ; a lv2:AudioPort'
+ put /graph/left_out 'a lv2:OutputPort ; a lv2:AudioPort'
+ put /graph/tone 'a ingen:Block ; lv2:prototype <http://drobilla.net/plugins/mda/Shepard>'
+ put /graph/combo 'a ingen:Block ; lv2:prototype <http://drobilla.net/plugins/mda/Combo>'
+ connect /graph/left_in /graph/tone/left_in
+ connect /graph/tone/left_out /graph/combo/left_in
+ connect /graph/combo/left_out /graph/left_out
+ set /graph/tone/output ingen:value 0.7
''')
def run(cmd):
@@ -71,8 +73,10 @@ def run(cmd):
print(ingen.get(cmd[1]).serialize(format='n3'))
elif cmd[0] == 'put' and len(cmd) == 3:
return ingen.put(cmd[1], cmd[2])
- elif cmd[0] == 'set' and len(cmd) == 3:
- return ingen.set(cmd[1], cmd[2])
+ elif cmd[0] == 'patch' and len(cmd) == 4:
+ return ingen.patch(cmd[1], cmd[2], cmd[3])
+ elif cmd[0] == 'set' and len(cmd) == 4:
+ return ingen.set(cmd[1], cmd[2], cmd[3])
elif cmd[0] == 'connect' and len(cmd) == 3:
return ingen.connect(cmd[1], cmd[2])
elif cmd[0] == 'disconnect' and len(cmd) == 3: