73 lines
No EOL
2 KiB
Bash
73 lines
No EOL
2 KiB
Bash
#!/bin/bash
|
|
# generate_report.sh — Full pipeline for generating meeting report (without diagrams)
|
|
# Usage: ./generate_report.sh /absolute/path/to/meeting_folder
|
|
# Example: ./generate_report.sh /app/hermes_data/meetings/2026-04-15
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
|
|
# Load .env if exists (for hotwords etc.)
|
|
if [ -f "$SCRIPT_DIR/.env" ]; then
|
|
set -a
|
|
source "$SCRIPT_DIR/.env"
|
|
set +a
|
|
fi
|
|
|
|
if [ $# -lt 1 ]; then
|
|
echo "Usage: $0 <absolute_path_to_meeting_folder>"
|
|
echo "Example: $0 /app/hermes_data/meetings/2026-04-15"
|
|
exit 1
|
|
fi
|
|
|
|
MEETING_DIR="$1"
|
|
|
|
# If relative path provided, convert to absolute
|
|
if [[ "$MEETING_DIR" != /* ]]; then
|
|
MEETING_DIR="$SCRIPT_DIR/$MEETING_DIR"
|
|
fi
|
|
|
|
# Resolve absolute path
|
|
MEETING_DIR="$(realpath "$MEETING_DIR")"
|
|
|
|
if [ ! -d "$MEETING_DIR" ]; then
|
|
echo "Error: Meeting directory not found: $MEETING_DIR"
|
|
exit 1
|
|
fi
|
|
|
|
# ============================================================
|
|
# Step 1: Transcription (skip if already done)
|
|
# ============================================================
|
|
if [ -d "$MEETING_DIR/transcription" ] && [ -f "$MEETING_DIR/transcription/plain_text.txt" ]; then
|
|
echo "[1/2] Transcription already exists, skipping."
|
|
else
|
|
echo "[1/2] Running transcription..."
|
|
bash "$SCRIPT_DIR/transcribe.sh" "$MEETING_DIR"
|
|
fi
|
|
|
|
# ============================================================
|
|
# Step 2: Generate PDF from markdown
|
|
# ============================================================
|
|
echo "[2/2] Generating PDF..."
|
|
REPORT_MD="$MEETING_DIR/report.md"
|
|
REPORT_PDF="$MEETING_DIR/report.pdf"
|
|
|
|
if [ ! -f "$REPORT_MD" ]; then
|
|
echo " Error: report.md not found at $REPORT_MD"
|
|
exit 1
|
|
fi
|
|
|
|
cd "$MEETING_DIR"
|
|
pandoc report.md -o report.pdf \
|
|
--pdf-engine=xelatex \
|
|
-V mainfont="DejaVu Serif" \
|
|
-V sansfont="DejaVu Sans" \
|
|
-V monofont="DejaVu Sans Mono" \
|
|
-V geometry:margin=2cm \
|
|
-V fontsize=11pt \
|
|
-V lang=ru \
|
|
--highlight-style=tango
|
|
|
|
PDF_SIZE=$(du -h "$REPORT_PDF" | cut -f1)
|
|
echo ""
|
|
echo "Done! Report: $REPORT_PDF ($PDF_SIZE)" |