mirror of
https://github.com/transmission/transmission
synced 2024-12-21 23:32:35 +00:00
Add start_paused to settings file and daemon (#6728)
* Add daemon-startPaused to settings file * code review: naming * "Predefined quarks must be sorted by their string value" * code review: replacing paused_ with tr_variantDictAddBool/tr_variantDictFindBool * code review: doc * Update docs/Editing-Configuration-Files.md Co-authored-by: Yat Ho <lagoho7@gmail.com> --------- Co-authored-by: Eugen Beck <beck@cs.rwth-aachen.de> Co-authored-by: Yat Ho <lagoho7@gmail.com>
This commit is contained in:
parent
6384abeb2b
commit
460ce7c302
5 changed files with 11 additions and 9 deletions
|
@ -370,6 +370,7 @@ tr_variant load_settings(char const* config_dir)
|
|||
tr_variantDictAddBool(&app_defaults, TR_KEY_watch_dir_enabled, false);
|
||||
tr_variantDictAddBool(&app_defaults, TR_KEY_watch_dir_force_generic, false);
|
||||
tr_variantDictAddBool(&app_defaults, TR_KEY_rpc_enabled, true);
|
||||
tr_variantDictAddBool(&app_defaults, TR_KEY_start_paused, false);
|
||||
return tr_sessionLoadSettings(&app_defaults, config_dir, MyName);
|
||||
}
|
||||
|
||||
|
@ -428,7 +429,6 @@ bool tr_daemon::parse_args(int argc, char const* const* argv, bool* dump_setting
|
|||
int c;
|
||||
char const* optstr;
|
||||
|
||||
paused_ = false;
|
||||
*dump_settings = false;
|
||||
*foreground = false;
|
||||
|
||||
|
@ -562,7 +562,7 @@ bool tr_daemon::parse_args(int argc, char const* const* argv, bool* dump_setting
|
|||
break;
|
||||
|
||||
case 800:
|
||||
paused_ = true;
|
||||
tr_variantDictAddBool(&settings_, TR_KEY_start_paused, true);
|
||||
break;
|
||||
|
||||
case 910:
|
||||
|
@ -768,7 +768,7 @@ int tr_daemon::start([[maybe_unused]] bool foreground)
|
|||
auto watchdir = std::unique_ptr<Watchdir>{};
|
||||
if (auto tmp_bool = false; tr_variantDictFindBool(&settings_, TR_KEY_watch_dir_enabled, &tmp_bool) && tmp_bool)
|
||||
{
|
||||
auto force_generic = bool{ false };
|
||||
auto force_generic = false;
|
||||
(void)tr_variantDictFindBool(&settings_, TR_KEY_watch_dir_force_generic, &force_generic);
|
||||
|
||||
auto dir = std::string_view{};
|
||||
|
@ -792,7 +792,7 @@ int tr_daemon::start([[maybe_unused]] bool foreground)
|
|||
{
|
||||
tr_ctor* ctor = tr_ctorNew(my_session_);
|
||||
|
||||
if (paused_)
|
||||
if (auto paused = false; tr_variantDictFindBool(&settings_, TR_KEY_start_paused, &paused) && paused)
|
||||
{
|
||||
tr_ctorSetPaused(ctor, TR_FORCE, true);
|
||||
}
|
||||
|
|
|
@ -46,7 +46,6 @@ private:
|
|||
#ifdef HAVE_SYS_SIGNALFD_H
|
||||
int sigfd_ = -1;
|
||||
#endif /* signalfd API */
|
||||
bool paused_ = false;
|
||||
bool seen_hup_ = false;
|
||||
std::string config_dir_;
|
||||
tr_variant settings_ = {};
|
||||
|
|
|
@ -79,14 +79,15 @@ Here is a sample of the three basic types: respectively Boolean, Number and Stri
|
|||
* **lpd-enabled:** Boolean (default = false) Enable [Local Peer Discovery (LPD)](https://en.wikipedia.org/wiki/Local_Peer_Discovery).
|
||||
* **message-level:** Number (0 = None, 1 = Critical, 2 = Error, 3 = Warn, 4 = Info, 5 = Debug, 6 = Trace; default = 2) Set verbosity of Transmission's log messages.
|
||||
* **pex-enabled:** Boolean (default = true) Enable [Peer Exchange (PEX)](https://en.wikipedia.org/wiki/Peer_exchange).
|
||||
* **pidfile:** String Path to file in which daemon PID will be stored (transmission-daemon only)
|
||||
* **pidfile:** String Path to file in which daemon PID will be stored (_transmission-daemon only_)
|
||||
* **scrape-paused-torrents-enabled:** Boolean (default = true)
|
||||
* **script-torrent-added-enabled:** Boolean (default = false) Run a script when a torrent is added to Transmission. Environmental variables are passed in as detailed on the [Scripts](./Scripts.md) page
|
||||
* **script-torrent-added-enabled:** Boolean (default = false) Run a script when a torrent is added to Transmission. Environmental variables are passed in as detailed on the [Scripts](./Scripts.md) page.
|
||||
* **script-torrent-added-filename:** String (default = "") Path to script.
|
||||
* **script-torrent-done-enabled:** Boolean (default = false) Run a script when a torrent is done downloading. Environmental variables are passed in as detailed on the [Scripts](./Scripts.md) page
|
||||
* **script-torrent-done-enabled:** Boolean (default = false) Run a script when a torrent is done downloading. Environmental variables are passed in as detailed on the [Scripts](./Scripts.md) page.
|
||||
* **script-torrent-done-filename:** String (default = "") Path to script.
|
||||
* **script-torrent-done-seeding-enabled:** Boolean (default = false) Run a script when a torrent is done seeding. Environmental variables are passed in as detailed on the [Scripts](./Scripts.md) page
|
||||
* **script-torrent-done-seeding-enabled:** Boolean (default = false) Run a script when a torrent is done seeding. Environmental variables are passed in as detailed on the [Scripts](./Scripts.md) page.
|
||||
* **script-torrent-done-seeding-filename:** String (default = "") Path to script.
|
||||
* **start_paused**: Boolean (default = false) Pause the torrents when daemon starts. _Note: transmission-daemon only._
|
||||
* **tcp-enabled:** Boolean (default = true) Optionally disable TCP connection to other peers. Never disable TCP when you also disable µTP, because then your client would not be able to communicate. Disabling TCP might also break webseeds. Unless you have a good reason, you should not set this to false.
|
||||
* **torrent-added-verify-mode:** String ("fast", "full", default: "fast") Whether newly-added torrents' local data should be fully verified when added, or wait and verify them on-demand later. See [#2626](https://github.com/transmission/transmission/pull/2626) for more discussion.
|
||||
* **utp-enabled:** Boolean (default = true) Enable [Micro Transport Protocol (µTP)](https://en.wikipedia.org/wiki/Micro_Transport_Protocol)
|
||||
|
|
|
@ -367,6 +367,7 @@ auto constexpr MyStatic = std::array<std::string_view, TR_N_KEYS>{
|
|||
"start-added-torrents"sv,
|
||||
"start-minimized"sv,
|
||||
"startDate"sv,
|
||||
"start_paused"sv,
|
||||
"status"sv,
|
||||
"statusbar-stats"sv,
|
||||
"tag"sv,
|
||||
|
|
|
@ -368,6 +368,7 @@ enum
|
|||
TR_KEY_start_added_torrents,
|
||||
TR_KEY_start_minimized,
|
||||
TR_KEY_startDate,
|
||||
TR_KEY_start_paused,
|
||||
TR_KEY_status,
|
||||
TR_KEY_statusbar_stats,
|
||||
TR_KEY_tag,
|
||||
|
|
Loading…
Reference in a new issue