Files
momentry_core/test_integrated_player.sh
Warren b54c2def30 feat: add migrations, test scripts, and utility tools
- Add database migrations (006-028) for face recognition, identity, file_uuid
- Add test scripts for ASR, face, search, processing
- Add portal frontend (Tauri)
- Add config, benchmark, and monitoring utilities
- Add model checkpoints and pretrained model references
2026-04-30 15:11:53 +08:00

150 lines
3.8 KiB
Bash
Executable File

#!/bin/bash
# 測試整合播放器
set -e
echo "🎬 Integrated Player 測試腳本"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
# 檢查編譯
if [ ! -f ./target/debug/integrated_player ]; then
echo "⏳ 編譯整合播放器..."
cargo build --bin integrated_player
fi
echo "✓ 播放器已編譯"
echo
# 測試 1: 查看幫助
echo "📋 測試 1: 查看幫助信息"
echo "───────────────────────────────────────"
./target/debug/integrated_player --help
echo
# 測試 2: 使用 Charade 數據
echo "🎬 測試 2: Charade 數據測試"
echo "───────────────────────────────────────"
VIDEO=/tmp/charade_audio.wav
ASRX=/tmp/asrx_charade_optimized.json
FACE=/tmp/face_long.json
if [ -f "$VIDEO" ] && [ -f "$ASRX" ]; then
echo "✓ 找到測試數據: Charade (1963)"
echo
# 測試 2.1: 列出說話人
echo "📊 測試 2.1: 列出說話人統計"
echo "───────────────────────────────────────"
echo "提示: 進入交互模式後輸入 'l' 列出說話人"
echo
# 創建測試輸入
cat >/tmp/test_commands.txt <<'EOF'
l
q
EOF
./target/debug/integrated_player \
--video "$VIDEO" \
--asrx "$ASRX" \
</tmp/test_commands.txt || true
echo
# 測試 2.2: 播放 SPEAKER_1 的片段
if [ "$1" = "--play" ]; then
echo "🎬 測試 2.2: 播放 SPEAKER_1 (Audrey Hepburn) 的片段"
echo "───────────────────────────────────────"
cat >/tmp/test_play.txt <<'EOF'
p SPEAKER_1
q
EOF
./target/debug/integrated_player \
--video "$VIDEO" \
--asrx "$ASRX" \
</tmp/test_play.txt || true
fi
echo
echo "✅ Charade 測試完成"
else
echo "⚠️ 未找到 Charade 測試數據"
echo " 請先運行:"
echo " python3 scripts/asrx_self/test_long_movie.py"
fi
echo
# 測試 3: 使用輸出目錄的數據
echo "📂 測試 3: 檢查 momentry/output 數據"
echo "───────────────────────────────────────"
OUTPUT_DIR=/Users/accusys/momentry/output
if [ -d "$OUTPUT_DIR" ]; then
# 找一個有 ASR 和 Face 數據的視頻
ASR_FILE=$(find "$OUTPUT_DIR" -name "*_asr_*.json" | head -1)
FACE_FILE=$(find "$OUTPUT_DIR" -name "*_face_*.json" | head -1)
ASRX_FILE=$(find "$OUTPUT_DIR" -name "*_asrx_*.json" | head -1)
if [ -n "$ASR_FILE" ]; then
echo "✓ 找到 ASR 文件: $ASR_FILE"
fi
if [ -n "$FACE_FILE" ]; then
echo "✓ 找到 Face 文件: $FACE_FILE"
fi
if [ -n "$ASRX_FILE" ]; then
echo "✓ 找到 ASRX 文件: $ASRX_FILE"
fi
if [ -n "$ASR_FILE" ] && [ -n "$FACE_FILE" ]; then
echo
echo "💡 可以使用以下命令測試:"
echo " ./target/debug/integrated_player \\"
echo " --video /path/to/video.mp4 \\"
echo " --asr $ASR_FILE \\"
echo " --face $FACE_FILE"
fi
else
echo "⚠️ 未找到 momentry/output 目錄"
fi
echo
# 測試 4: 顯示使用範例
echo "📖 使用範例"
echo "───────────────────────────────────────"
cat <<'EXAMPLE'
# 基本使用
./target/debug/integrated_player \
--video video.mp4 \
--asr asr.json \
--face face.json \
--asrx asrx.json
# 自動播放特定說話人
./target/debug/integrated_player \
--video video.mp4 \
--asrx asrx.json \
--auto-play-speaker \
--speaker-name SPEAKER_0
# 交互命令
# l - 列出說話人
# s - 顯示當前片段
# p SPEAKER_1 - 播放 SPEAKER_1 的片段
# q - 退出
EXAMPLE
echo
echo "✅ 測試完成!"
echo
echo "📚 更多信息請查看: docs/INTEGRATED_PLAYER_GUIDE.md"