diff options
| author | pepper <pepper@chimecrisis.com> | 2014-04-25 07:48:24 -0400 |
|---|---|---|
| committer | pepper <pepper@chimecrisis.com> | 2014-04-25 07:48:24 -0400 |
| commit | da989f0c4b522eeb45fd52099d430bcb20c929ac (patch) | |
| tree | a2b08490757236aa828ea5398ab45b841b2f8320 /reapify | |
| parent | 6e114d199038b63d52db492b7c3c683064ed3fef (diff) | |
Diffstat (limited to 'reapify')
| -rwxr-xr-x | reapify | 60 |
1 files changed, 49 insertions, 11 deletions
@@ -1,22 +1,60 @@ #!/usr/bin/python +import sys, os from subprocess import call, Popen from simpleOSC import * import socket -#make sure reaper is running -check = call([ 'pgrep', 'REAPER' ]); -if check: - Popen(['/Applications/REAPER64.app/Contents/MacOS/REAPER']) +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 + -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) +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(); -#run main.py -sendOSCMsg("/action/41061") +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(); |
