initial commit
[scannr.git] / scannr.py
































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
import snd
import time
from datetime import date
import threading
 
filename = ""
def worker(filename):
    """thread worker function
    http://www.doughellmann.com/PyMOTW/threading/
 
    https://github.com/uskr/pynma"""
    print 'Worker for '+filename
    return
 
def filenameMaker():
    global filename
    while True:
        filename = date.today().isoformat()+'-'+str(time.time())+'-demo.wav'
        time.sleep(5)
 
 
 
threads = []
fm = threading.Thread(target=filenameMaker)
fm.daemon = True
fm.start()
print "Scannr started..."
while True:
    print "ready to record"
    snd.record_to_file(filename)
    t = threading.Thread(target=worker,args=(filename,))
    t.start()