blob: 8a78057ad661a404404f7ef5b6be49438523d3bf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#!/usr/bin/python
import sys, os
from subprocess import call, Popen
from simpleOSC import *
import socket
REAPER_ARGUMENTS_FILE = '_proj_config'
def setUpArgumentsFile():
previous_arguments = 0;
if os.path.exists(REAPER_ARGUMENTS_FILE): #load file contents into hash
f = open(REAPER_ARGUMENTS_FILE, 'r');
lines = f.readlines();
for line in lines:
parts = line.split("\t");
previous_arguments[parts[0]] = parts[1];
f.close(REAPER_ARGUMENTS_FILE);
return previous_arguments
def writeArgumentsFile(reaper_arguments):
f = open(REAPER_ARGUMENTS_FILE, 'w');
for i in reaper_arguments.keys():
f.write("%s\t%s" % (i, reaper_arguments[i]));
f.close();
def getCommandlineArgs():
reaper_args = {};
if len(sys.argv) == 1:
return
else:
midi_file_to_process = os.path.join(os.path.curdir, sys.argv[1]);
if not os.path.exists(midi_file_to_process):
print "please specify full path as argument"
reaper_args = {"midi_source" : midi_file_to_process};
writeArgumentsFile(reaper_args);
def main():
getCommandlineArgs(); #process commandline args
#make sure reaper is running
check = call([ 'pgrep', 'REAPER' ]);
if check:
Popen(['/Applications/REAPER64.app/Contents/MacOS/REAPER'])
ip_address = socket.gethostbyname(socket.gethostname())
#start the client
initOSCClient(ip_address, 8088)
#start the server to receive messages (not yet implemented)
initOSCServer(ip_address, 8808)
#run main.py
sendOSCMsg("/action/41061")
main();
|