diff options
Diffstat (limited to 'cgi-bin/record.py')
-rwxr-xr-x | cgi-bin/record.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/cgi-bin/record.py b/cgi-bin/record.py new file mode 100755 index 0000000..6d43e71 --- /dev/null +++ b/cgi-bin/record.py @@ -0,0 +1,30 @@ +#!/usr/bin/python +import os, sys, subprocess +import cgi, cgitb +from path import path +cgitb.enable(display=True) +AUDIOPATH = '/tmp/audio.wav' + +# Start Recording +def record(filename): + if not filename : + #we are recording, stop and save clip + subprocess.call("killall -q arecord", shell=True) + #convert to ogg file + #initialize convert pipeline + pipeline = "filesrc location=" + AUDIOPATH + " ! wavparse " + pipeline += "! audioconvert ! vorbisenc ! oggmux " + pipeline += "! filesink location=" + pipeline += filename + subprocess.call("gst-launch-0.10 " + pipeline, shell=True) + #reset mic boost + subprocess.call("amixer cset numid=11 off", shell = True)() + else: + #turn on mic boost (xo) + subprocess.call("amixer cset numid=11 on", shell=True) + pid=subprocess.Popen("arecord -f cd " + AUDIOPATH, shell=True) + +print 'Content-Type:text/html\n\n' +form = cgi.FieldStorage() +f = form.getfirst('filename') +record(f) |