Skip to content

Commit

Permalink
Added optional env variable: SCRIPT_TORRENT_DONE_FILENAME
Browse files Browse the repository at this point in the history
* Optional env variable that sets script-torrent-done-filename and enables script-torrent-done-enabled
* Updated readme-vars
  • Loading branch information
Jan Fredrik Sundblom committed Jul 13, 2023
1 parent a23c29e commit 3757bca
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions readme-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ opt_param_env_vars:
- { env_var: "WHITELIST", env_value: "", desc: "Specify an optional list of comma separated ip whitelist. Fills rpc-whitelist setting."}
- { env_var: "PEERPORT", env_value: "", desc: "Specify an optional port for torrent TCP/UDP connections. Fills peer-port setting."}
- { env_var: "HOST_WHITELIST", env_value: "", desc: "Specify an optional list of comma separated dns name whitelist. Fills rpc-host-whitelist setting."}
- { env_var: "SCRIPT_TORRENT_DONE_FILENAME", env_value: "", desc: "Specify the path to a script to run when torrent download is complete. Fills script-torrent-done-filename setting." }
opt_param_usage_include_vols: false
opt_param_usage_include_ports: false
opt_param_device_map: false
Expand Down Expand Up @@ -78,8 +79,13 @@ app_setup_block: |
Use `PEERPORT` to specify the port(s) Transmission should listen on. This disables random port selection. This should be the same as the port mapped in your docker configuration.
## Using script torrent done filename
Use `SCRIPT_TORRENT_DONE_FILENAME` to specify a path to a script to run when a dowload completes. This enables `script-torrent-done-enabled`. When `SCRIPT_TORRENT_DONE_FILENAME` is empty, `script-torrent-done-enabled` is disabled.
# changelog
changelogs:
- { date: "13.07.23:", desc: "Add optional script_torrent_done_filename environment variable." }
- { date: "10.06.23:", desc: "Bump unrar to 6.2.8, install transmission-extra." }
- { date: "25.05.23:", desc: "Deprecate armhf." }
- { date: "14.05.23:", desc: "Explicitly install transmission-remote." }
Expand Down
8 changes: 8 additions & 0 deletions root/etc/s6-overlay/s6-rc.d/init-transmission-config/run
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ else
sed -i "/\"rpc-whitelist\"/c\ \"rpc-whitelist\": \"$WHITELIST\"," /config/settings.json
fi

if [[ -n "$SCRIPT_TORRENT_DONE_FILENAME" ]]; then
sed -i '/script-torrent-done-enabled/c\ "script-torrent-done-enabled": true,' /config/settings.json
sed -i "/\"script-torrent-done-filename\"/c\ \"script-torrent-done-filename\": \"$SCRIPT_TORRENT_DONE_FILENAME\"," /config/settings.json
else
sed -i '/script-torrent-done-enabled/c\ "script-torrent-done-enabled": false,' /config/settings.json
sed -i "/\"script-torrent-done-filename\"/c\ \"script-torrent-done-filename\": \"$SCRIPT_TORRENT_DONE_FILENAME\"," /config/settings.json
fi

if [[ -n "$HOST_WHITELIST" ]]; then
sed -i '/rpc-host-whitelist-enabled/c\ "rpc-host-whitelist-enabled": true,' /config/settings.json
sed -i "/\"rpc-host-whitelist\"/c\ \"rpc-host-whitelist\": \"$HOST_WHITELIST\"," /config/settings.json
Expand Down

0 comments on commit 3757bca

Please sign in to comment.