mirror of
https://github.com/transmission/transmission
synced 2025-01-03 05:25:52 +00:00
feat: add torrent priority to completion script env vars (#6629)
This commit is contained in:
parent
2548dd478f
commit
86498a71e5
2 changed files with 3 additions and 0 deletions
|
@ -27,6 +27,7 @@ Transmission can be set to invoke a script when downloads complete. The environm
|
|||
* `TR_TORRENT_ID`
|
||||
* `TR_TORRENT_LABELS` - A comma-delimited list of the torrent's labels
|
||||
* `TR_TORRENT_NAME` - Name of torrent (not filename)
|
||||
* `TR_TORRENT_PRIORITY` - The priority of the torrent (Low is "-1", Normal is "0", High is "1")
|
||||
* `TR_TORRENT_TRACKERS` - A comma-delimited list of the torrent's trackers' announce URLs
|
||||
|
||||
[Here is an example script](https://trac.transmissionbt.com/browser/trunk/extras/send-email-when-torrent-done.sh) that sends an email when a torrent finishes.
|
||||
|
|
|
@ -384,6 +384,7 @@ void torrentCallScript(tr_torrent const* tor, std::string const& script)
|
|||
auto const trackers_str = buildTrackersString(tor);
|
||||
auto const bytes_downloaded_str = std::to_string(tor->bytes_downloaded_.ever());
|
||||
auto const localtime_str = fmt::format("{:%a %b %d %T %Y%n}", fmt::localtime(tr_time()));
|
||||
auto const priority_str = std::to_string(tor->get_priority());
|
||||
|
||||
auto const env = std::map<std::string_view, std::string_view>{
|
||||
{ "TR_APP_VERSION"sv, SHORT_VERSION_STRING },
|
||||
|
@ -394,6 +395,7 @@ void torrentCallScript(tr_torrent const* tor, std::string const& script)
|
|||
{ "TR_TORRENT_ID"sv, id_str },
|
||||
{ "TR_TORRENT_LABELS"sv, labels_str },
|
||||
{ "TR_TORRENT_NAME"sv, tor->name() },
|
||||
{ "TR_TORRENT_PRIORITY"sv, priority_str },
|
||||
{ "TR_TORRENT_TRACKERS"sv, trackers_str },
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue