mirror of
https://github.com/aljazceru/vibeline.git
synced 2026-01-20 15:04:19 +01:00
Show subprocess output in real-time & add consistent force flag behavior - Show output from process.sh, transcribe.sh, and extract.sh in real-time when running watch.py - Add force flag support to transcribe.sh to prevent overwriting existing transcripts - Update process.sh to propagate force flag to transcribe.sh - Now force flag behavior is consistent: without -f skips existing files, with -f overwrites files - Force flag propagates through entire chain: watch -> process -> transcribe/extract
This commit is contained in:
@@ -37,7 +37,7 @@ echo "----------------------------------------"
|
||||
|
||||
# Step 1: Transcribe
|
||||
echo "Step 1: Transcribing audio..."
|
||||
./transcribe.sh "$input_file"
|
||||
./transcribe.sh $force_flag "$input_file"
|
||||
|
||||
# Check if transcription was successful
|
||||
if [ ! -f "$transcript_file" ]; then
|
||||
|
||||
@@ -81,17 +81,17 @@ def process_voice_memo(file_path: Path, force: bool = False) -> None:
|
||||
cmd.append('-f')
|
||||
cmd.append(str(file_path))
|
||||
|
||||
# Run subprocess without capturing output to show it in real-time
|
||||
result = subprocess.run(
|
||||
cmd,
|
||||
check=True,
|
||||
capture_output=True,
|
||||
text=True
|
||||
)
|
||||
logger.debug(f"Process output: {result.stdout}")
|
||||
logger.info(f"Successfully processed: {file_path.name}")
|
||||
except subprocess.CalledProcessError as e:
|
||||
logger.error(f"Error processing {file_path.name}: {e}")
|
||||
logger.debug(f"Error output: {e.stderr}")
|
||||
if e.stderr:
|
||||
logger.error(f"Error output: {e.stderr}")
|
||||
except Exception as e:
|
||||
logger.error(f"Unexpected error processing {file_path.name}: {e}")
|
||||
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Parse arguments
|
||||
force_flag=""
|
||||
while getopts "f" opt; do
|
||||
case $opt in
|
||||
f) force_flag="--force" ;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
|
||||
# Check if a file argument was provided
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "Usage: $0 <audio_file>"
|
||||
echo "Usage: $0 [-f] <audio_file>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -26,6 +35,12 @@ mkdir -p "$TRANSCRIPT_DIR"
|
||||
filename=$(basename "$input_file" .m4a)
|
||||
transcript_file="$TRANSCRIPT_DIR/$filename.txt"
|
||||
|
||||
# Check if transcript already exists
|
||||
if [ -f "$transcript_file" ] && [ -z "$force_flag" ]; then
|
||||
echo "Transcript already exists: $transcript_file (use -f to overwrite)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Processing file: $input_file"
|
||||
echo "Transcribing audio..."
|
||||
|
||||
|
||||
Reference in New Issue
Block a user