mirror of
https://github.com/aljazceru/vibeline.git
synced 2026-01-28 02:44:27 +01:00
63 lines
1.4 KiB
Bash
Executable File
63 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Directory paths
|
|
VOICE_MEMO_DIR="VoiceMemos"
|
|
TRANSCRIPT_DIR="$VOICE_MEMO_DIR/transcripts"
|
|
|
|
# Print debug info about symlinks
|
|
echo "Directory information:"
|
|
echo "Voice memo dir: $(pwd)/$VOICE_MEMO_DIR"
|
|
echo "Is symlink: $([ -L "$VOICE_MEMO_DIR" ] && echo "yes" || echo "no")"
|
|
if [ -L "$VOICE_MEMO_DIR" ]; then
|
|
echo "Resolves to: $(readlink -f "$VOICE_MEMO_DIR")"
|
|
fi
|
|
|
|
# Check if directories exist
|
|
if [ ! -d "$VOICE_MEMO_DIR" ]; then
|
|
echo "Error: $VOICE_MEMO_DIR directory does not exist"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -d "$TRANSCRIPT_DIR" ]; then
|
|
echo "Error: $TRANSCRIPT_DIR directory does not exist"
|
|
exit 1
|
|
fi
|
|
|
|
# Function to process voice memos
|
|
process_voice_memo() {
|
|
echo "New voice memo detected!"
|
|
./process_voice_memos.sh
|
|
}
|
|
|
|
# Function to process transcripts
|
|
process_transcript() {
|
|
echo "New transcript detected!"
|
|
./summarize_transcripts.py
|
|
}
|
|
|
|
echo "Starting file watcher..."
|
|
echo "Watching for changes in:"
|
|
echo "- Voice memos: $VOICE_MEMO_DIR"
|
|
echo "- Transcripts: $TRANSCRIPT_DIR"
|
|
echo "Press Ctrl+C to stop..."
|
|
|
|
# Monitor both directories in parallel
|
|
# -L flag enables following symlinks
|
|
(
|
|
fswatch -L -o "$VOICE_MEMO_DIR" | while read -r f; do
|
|
if [[ "$f" =~ \.m4a$ ]]; then
|
|
process_voice_memo
|
|
fi
|
|
done
|
|
) &
|
|
|
|
(
|
|
fswatch -L -o "$TRANSCRIPT_DIR" | while read -r f; do
|
|
if [[ "$f" =~ \.txt$ ]]; then
|
|
process_transcript
|
|
fi
|
|
done
|
|
) &
|
|
|
|
# Wait for Ctrl+C
|
|
wait |