--- a/utils/pianoroll-client.py Tue Oct 28 11:32:45 2014 +0100
+++ b/utils/pianoroll-client.py Tue Oct 28 11:33:52 2014 +0100
@@ -5,6 +5,7 @@
This example is in the public domain.
"""
+import argparse
import csv
import sys
import time
@@ -46,8 +47,14 @@
if __name__ == "__main__":
- with open(sys.argv[1], 'rU') as datafile:
+ parser = argparse.ArgumentParser(description='Simulate an (osc) pianoroll client.')
+ parser.add_argument('datafile', metavar='DATAFILE', help='The file containing the pianoroll data (CSV).')
+ parser.add_argument('-e', '--event', dest='event', metavar='EVENT', required=True, help='the event code.')
+
+ args = parser.parse_args()
+
+ with open(args.datafile, 'rU') as datafile:
reader = csv.reader(datafile, delimiter=' ')
- app = UDPSenderApplication(9090, "127.0.0.1", '/pianoroll/mons_samedi25/', list(reader))
+ app = UDPSenderApplication(9090, "127.0.0.1", "/pianoroll/%s/" % args.event, list(reader))
reactor.run()