From adcf1e0dac8be0fea4bfe72d046df1e062c01740 Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Sat, 21 Mar 2020 16:26:10 +0800 Subject: [PATCH] transmission: add notification when download finished --- configs/workhorse/transmission.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/configs/workhorse/transmission.nix b/configs/workhorse/transmission.nix index 674d691..e89e251 100644 --- a/configs/workhorse/transmission.nix +++ b/configs/workhorse/transmission.nix @@ -95,6 +95,18 @@ in { # Start torrents as soon as they are added start-added-torrents = true; + script-torrent-done-enabled = true; + script-torrent-done-filename = + (pkgs.writers.writeBash "torrent-finished" '' + JSON_STRING=$( ${pkgs.jq}/bin/jq -n --arg torrent_name "$TR_TORRENT_NAME" \ + '{text: ":tada: \($torrent_name)", channel: "torrent"}' ) + ${pkgs.curl}/bin/curl \ + --include \ + --request POST \ + --data-urlencode \ + "payload=$JSON_STRING" \ + ${lib.fileContents } + ''); }; };