qbittorrent / qBittorrent

qBittorrent BitTorrent client
https://www.qbittorrent.org
Other
27k stars 3.89k forks source link

Run external program when state changes #9177

Open realtebo opened 6 years ago

realtebo commented 6 years ago

In these days where all is in the cloud, could be usefull to have a webhook called on at least the completition event.

But could be usefull on others status chages

reddec commented 5 years ago

Hi everyone! If no one against, I will try do it.

reddec commented 5 years ago

I am bit confused. Looks like this functional is not really needed: already exists 'run external program on finish' (Preferences -> Downloads -> Run external program on completion)

For future readers (maybe to wiki?):

You can use any application to invoke after torrent finish. Like CURL for HTTP requests.

Real example for Telegram API (you should get your token, know your chat id and initialize conversation with bot):

curl -X POST -d chat_id=<CHATID> -d text="%N saved into %D (%Z bytes)" 'https://api.telegram.org/bot<TOKEN>/sendMessage'

It sends a notification over bot to your telegram when torrent is downloaded.

@Chocobo1 may I ask your opinion? Should I implement it as internal functional or better keep it separately (and close request and add to Wiki)?

Chocobo1 commented 5 years ago

@Chocobo1 may I ask your opinion? Should I implement it as internal functional or better keep it separately (and close request and add to Wiki)?

If only "on completion" is needed, I would opt to do less work (use "Run external program on completion"). However if OP is asking to fire notifications on status change, we don't have that yet and it might be non-trivial work to add it.

pdtdev commented 5 years ago

Was looking for this feature too: Options - Downloads: Run external program on torrent change

Wish list:

Other 'right-click' torrent options i.e. Pause, Delete, Rename... , Category etc.

Which maybe non-trivial to implement

zzz6839 commented 2 years ago

I am bit confused. Looks like this functional is not really needed: already exists 'run external program on finish' (Preferences -> Downloads -> Run external program on completion)

For future readers (maybe to wiki?):

You can use any application to invoke after torrent finish. Like CURL for HTTP requests.

Real example for Telegram API (you should get your token, know your chat id and initialize conversation with bot):

curl -X POST -d chat_id=<CHATID> -d text="%N saved into %D (%Z bytes)" 'https://api.telegram.org/bot<TOKEN>/sendMessage'

It sends a notification over bot to your telegram when torrent is downloaded.

@Chocobo1 may I ask your opinion? Should I implement it as internal functional or better keep it separately (and close request and add to Wiki)?

I've tried CURL on both Windows and docker version Qbittorent running external command but not working, is it a bug or something, could we have a GUI separate for discord/telegram notification? Thanks.

log: 2/17/2022 5:44 PM - Torrent: [VCB-Studio] Persona4, running external program, command: curl -X POST -d chat_id=my id -d text="[VCB-Studio] Persona4 download completed (65918065678 bytes)" 'https://api.telegram.org/mybot/sendMessage'

luzpaz commented 1 year ago

Related to #18457