transmission: add notification when download finished

This commit is contained in:
Ingolf Wagner 2020-03-21 16:26:10 +08:00
parent 6110b5b024
commit adcf1e0dac
Signed by: palo
GPG key ID: 76BF5F1928B9618B

View file

@ -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 <common_secrets/mattermost_sink_url>}
'');
};
};