packages = ["numpy", "scipy", "matplotlib"]
[files]
"../SJPlot.py" = "./SJPlot.py"
import sys
from js import console, window
# Import SJPlot module
import SJPlot
def process_audio_if_ready():
try:
# Check if file data is available
if not hasattr(window, 'js_file0_data') or window.js_file0_data is None:
console.error("File 0 data is missing. Cannot process audio.")
window.updateUIWithError("No file data available")
return
# Call the main function from SJPlot module
SJPlot.main()
except Exception as e:
console.error(f"Error processing audio: {e}")
import traceback
error_details = traceback.format_exc()
console.error(error_details)
# Update UI using existing function
error_msg = str(e) if str(e) else "An unknown error occurred"
window.updateUIWithError(error_msg, error_details)
# Attach the function to the window object for manual invocation
window.pyProcessAudio = process_audio_if_ready