Fixed bug with checking screen status. And set the filename to be the date of recording.

This commit is contained in:
Jacob Stevens 2022-08-13 21:54:07 -05:00
parent 8b0c6f5020
commit 696e41dd24
1 changed files with 5 additions and 2 deletions

View File

@ -20,7 +20,7 @@ def check_usb():
def check_record_status():
stream = os.popen('screen -list | grep -c "Pi-ARecord" || true')
output = stream.read()
if (output.find("1")):
if (output.find("1") != -1):
return True
else:
return False
@ -31,7 +31,10 @@ def record():
btn_record_var.set('Start Recording')
else:
if (check_usb()):
os.system('screen -S record -d -m arecord -D plughw:2,0 -f dat -vv /mnt/USB/test_input.wav')
record_time = datetime.now().strftime("%m-%d-%Y - %H:%M")
file_name = '/mnt/USB/' + record_time + ".wav"
command = 'screen -S record -d -m arecord -D plughw:2,0 -f dat -vv /mnt/USB/' + record_time + '.wav'
os.system(command)
btn_record_var.set('Stop Recording')
else:
btn_record_var.set('PreSonus N/A')