原理简述
- qBittorrent下载完成,调用wget访问node-red http in节点
- 通过参数传递,告知node-red下载完成的类别,及下载文件大小
qBittorrent设置
设置内容:
wget http://node-red用户:node-red密码@192.168.2.200:1880/download_complete?category=%L\&size=%Z -O temp.tmp &&rm temp.tmp
其中category为类型分类,
noed-red流程图
[{"id":"8fd23ccf.191ea","type":"http in","z":"bdf6fb07.64fd48","name":"下载完成","url":"/download_complete","method":"get","upload":false,"swaggerDoc":"","x":420,"y":660,"wires":[["7c9c77b8.e0db68"]]},{"id":"7c9c77b8.e0db68","type":"function","z":"bdf6fb07.64fd48","name":"推送内容","func":"var name_dict = {\"Movie\":\"电影\",\"TV\":\"电视剧\",\"Adult\":\"未知\",\"video\":\"视频\"};\nvar size = (msg.payload.size/1.0e9).toFixed(2);\nvar message = `${name_dict[msg.payload.category]}下载完成,本次共计下载${size}GB`;\nmsg.payload = {};\nmsg.payload.data = {\"message\":message,\"miai_num\":\"0\"};\nreturn msg;","outputs":1,"noerr":0,"x":600,"y":660,"wires":[["a7849c4.3a47b6"]]},{"id":"a7849c4.3a47b6","type":"api-call-service","z":"bdf6fb07.64fd48","name":"小爱TTS","server":"94f0c0a9.629b6","service_domain":"hello_miai","service":"add2msgqueue","data":"","render_data":false,"mergecontext":"","x":820,"y":660,"wires":[["912d7816.1fb118"]]},{"id":"8cc8e400.6300f","type":"http response","z":"bdf6fb07.64fd48","name":"返回操作状态","statusCode":"200","headers":{},"x":1180,"y":660,"wires":[]},{"id":"912d7816.1fb118","type":"template","z":"bdf6fb07.64fd48","name":"HTML","field":"payload","fieldType":"msg","format":"json","syntax":"plain","template":"{\"msg\":\"ok\"}","output":"str","x":990,"y":660,"wires":[["8cc8e400.6300f"]]},{"id":"94f0c0a9.629b6","type":"server","z":"","name":"Home Assistant","legacy":true,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open"}]
设置下载分类对应的中文名称