forked from ErlichLiu/Whisper-Input
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.command
More file actions
executable file
·43 lines (35 loc) · 1.13 KB
/
start.command
File metadata and controls
executable file
·43 lines (35 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/zsh
cd "$(dirname "$0")"
echo "正在加载 zsh 配置..."
source ~/.zshrc
# 检查是否需要 conda 环境
if [ -f ".env" ]; then
# 使用 export 导出环境变量
while IFS='=' read -r key value || [ -n "$key" ]; do
# 跳过注释和空行
if [[ ! "$key" =~ ^[[:space:]]*# && -n "$key" ]]; then
# 去除前后空格和引号
key=$(echo "$key" | xargs)
value=$(echo "$value" | xargs | tr -d '"' | tr -d "'")
# 导出环境变量
export "${key}=${value}"
fi
done < .env
fi
# 激活 conda 环境(无论是否使用 groq)
echo "正在激活 Whisper 环境..."
conda activate Whisper
# 确保所需包已安装
echo "检查必要的 Python 包..."
$CONDA_PREFIX/bin/pip install -q rumps python-dotenv
# 在后台运行程序,并将输出重定向到日志文件
echo "正在运行 statusbar.py..."
LOG_FILE="$(dirname "$0")/whisper.log"
nohup $CONDA_PREFIX/bin/python statusbar.py > "$LOG_FILE" 2>&1 &
# 等待一会确保程序启动
sleep 1
# 显示最近的日志
echo "最近的日志输出:"
tail -n 5 "$LOG_FILE"
# 退出终端
exit