I have this python script that works to record, and export files. But after I export the files, when I turn off my rpi and turn it back on and open Audacity, I get this error: “Project check of “audacity_audio_data” folder found 5 orphan block file(s). These files are unused by this project, but might belong to other projects. They are doing no harm and are small.” Is there a way to make this warning not show up?
My script is below.
from gpiozero import Button, LED
from signal import pause
from datetime import datetime
import os
import sys
import time
time.sleep(50) # Sleeps for 50 seconds
if sys.platform == 'win32':
print("pipe-test.py, running on windows")
TONAME = '\\\\.\\pipe\\ToSrvPipe'
FROMNAME = '\\\\.\\pipe\\FromSrvPipe'
EOL = '\r\n\0'
else:
print("pipe-test.py, running on linux or mac")
TONAME = '/tmp/audacity_script_pipe.to.' + str(os.getuid())
FROMNAME = '/tmp/audacity_script_pipe.from.' + str(os.getuid())
EOL = '\n'
print("Write to \"" + TONAME +"\"")
if not os.path.exists(TONAME):
print(" ..does not exist. Ensure Audacity is running with mod-script-pipe.")
sys.exit()
print("Read from \"" + FROMNAME +"\"")
if not os.path.exists(FROMNAME):
print(" ..does not exist. Ensure Audacity is running with mod-script-pipe.")
sys.exit()
print("-- Both pipes exist. This is a good thing.")
TOFILE = open(TONAME, 'w')
print("-- File to which to write has been opened")
FROMFILE = open(FROMNAME, 'rt')
print("-- File from which to read has now been opened also\r\n")
def send_command(command):
"""Send a single command."""
print("Send: >>> \n"+command)
TOFILE.write(command + EOL)
TOFILE.flush()
send_command("OpenProject2: Filename=/home/raspberrypi/Desktop/Audio_Files/audacity_audio.aup")
green = LED(10)
yellow = LED(9)
red = LED(11)
red.on()
time.sleep(0.3)
red.off()
yellow.on()
time.sleep(0.3)
yellow.off()
green.on()
time.sleep(0.3)
green.off()
yellow.on()
time.sleep(0.3)
yellow.off()
red.on()
time.sleep(0.3)
red.off()
green.on()
def get_date_string():
return datetime.now().strftime('%d-%m-%y~%H:%M:%S')
def record():
send_command("Record1stChoice")
red.on()
def stop():
send_command("Stop")
red.off()
def export():
send_command("SelectAll")
send_command(f"Export2: Filename=/home/raspberrypi/Desktop/Audio_Files/{get_date_string()}.mp3")
send_command("SelectAll")
send_command("Delete")
send_command("SaveProject2: Filename=/home/henrikkoehler/Desktop/Audio_Files/audacity_audio.aup")
yellow.on()
time.sleep(1)
yellow.off()
button = Button(27)
button2 = Button(17)
button.when_pressed = record
button.when_released = stop
button2.when_pressed = export
pause()