summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-05-22 03:30:42 +0000
committerDavid Robillard <d@drobilla.net>2012-05-22 03:30:42 +0000
commitb1d4027b58465d9cc31d6cb1be05a7ff4f202711 (patch)
treeb1b7e9d1379fc16c5f451fda7afff0d2bc071e18 /scripts
parente3b0886bfbd12f65450d4b302371f07f511458c3 (diff)
downloadingen-b1d4027b58465d9cc31d6cb1be05a7ff4f202711.tar.gz
ingen-b1d4027b58465d9cc31d6cb1be05a7ff4f202711.tar.bz2
ingen-b1d4027b58465d9cc31d6cb1be05a7ff4f202711.zip
More work on test suite.
Clean up, simplify, and shrink event code. Support disconnect_all via Atom protocol. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4432 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/ingenish27
1 files changed, 17 insertions, 10 deletions
diff --git a/scripts/ingenish b/scripts/ingenish
index 6e73915a..41b26850 100755
--- a/scripts/ingenish
+++ b/scripts/ingenish
@@ -28,6 +28,7 @@ except:
class Client:
def __init__(self, uri='unix:///tmp/ingen.sock'):
print 'Connecting to server %s' % uri
+ self.msg_id = 1
if uri.startswith('unix://'):
self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
self.sock.connect(uri[len('unix://'):])
@@ -46,8 +47,14 @@ class Client:
else:
return msg
+ def msg_subject(self):
+ #self.msg_id += 1
+ #return '_:msg%d' % self.msg_id
+ return '[]'
+
def send(self, msg):
self.sock.send(self.msgencode(msg))
+ return True
#response = self.sock.recv(1024)
# if response != self.msgencode('OK'):
# print('Error: %s' % response)
@@ -57,27 +64,27 @@ class Client:
def put(self, path, body):
return self.send('''
-[]
+%s
a patch:Put ;
patch:subject <%s> ;
patch:body [
%s
] .
-''' % (path, body))
+''' % (self.msg_subject(), path, body))
def set(self, path, body):
return self.send('''
-[]
+%s
a patch:Set ;
patch:subject <%s> ;
patch:body [
%s
] .
-''' % (path, body))
+''' % (self.msg_subject(), path, body))
def connect(self, tail, head):
return self.send('''
-[]
+%s
a patch:Put ;
patch:subject <%s> ;
patch:body [
@@ -85,25 +92,25 @@ class Client:
ingen:tail <%s> ;
ingen:head <%s> ;
] .
-''' % (os.path.commonprefix([tail, head]), tail, head))
+''' % (self.msg_subject(), os.path.commonprefix([tail, head]), tail, head))
def disconnect(self, tail, head):
return self.send('''
-[]
+%s
a patch:Delete ;
patch:body [
a ingen:Edge ;
ingen:tail <%s> ;
ingen:head <%s> ;
] .
-''' % (tail, head))
+''' % (self.msg_subject(), tail, head))
def delete(self, path):
return self.send('''
-[]
+%s
a patch:Delete ;
patch:subject <%s> .
-''' % (path))
+''' % (self.msg_subject(), path))
def print_usage():
print('''Usage: ingenish [OPTION]... [COMMAND [ARGUMENT]...]