TR界面设置里是提供下载完成执行脚本的,我前几天写了参考TR代码库,写了一个脚本,但是设置后没被调用,不知道怎么调试,你可以看看
#!/bin/bash
# 设置企业微信的Webhook
webhook="https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=123456"
# 获取命令行参数
message = ""
type="$1"
format="${3:-text}" # 如果未提供format参数,默认为"text"
if [ "$type" == "TR" ]; then
message="transmission下载完成通知 \n 种子名称: $TR_TORRENT_NAME \n 种子目录: $TR_TORRENT_DIR \n 当前时间: $TR_TIME_LOCALTIME \n TR版本号: $TR_APP_VERSION "
elif [ "$type" == "QB" ]; then
message="qBittorrent下载完成通知 \n 种子名称: %N \n 种子目录: %D \n 文件大小: %Z "
fi
# 发送消息
if [ "$format" == "text" ]; then
# 发送文本格式的消息
curl -s -H "Content-Type: application/json" -d "{"msgtype":"text","text":{"content":"$message"}}" "$webhook"
elif [ "$format" == "markdown" ]; then
# 发送Markdown格式的消息
curl -s -H "Content-Type: application/json" -d "{"msgtype":"markdown","markdown":{"content":"$message"}}" "$webhook"
else
echo "Invalid format. Please choose either 'text' or 'markdown'."
exit 1
fi
echo
|