(daemon) add support for listing recently-active torrents
This commit is contained in:
parent
08187ef984
commit
55551666b0
|
@ -554,25 +554,29 @@ getEncodedMetainfo (const char * filename)
|
|||
static void
|
||||
addIdArg (tr_variant * args, const char * id)
|
||||
{
|
||||
if (!*id)
|
||||
if (!*id)
|
||||
{
|
||||
fprintf (
|
||||
stderr,
|
||||
"No torrent specified! Please use the -t option first.\n");
|
||||
id = "-1"; /* no torrent will have this ID, so should be a no-op */
|
||||
fprintf (stderr, "No torrent specified! Please use the -t option first.\n");
|
||||
id = "-1"; /* no torrent will have this ID, so should be a no-op */
|
||||
}
|
||||
if (strcmp (id, "all"))
|
||||
else if (!tr_strcmp0 (id, "active"))
|
||||
{
|
||||
const char * pch;
|
||||
bool isList = strchr (id,',') || strchr (id,'-');
|
||||
bool isNum = true;
|
||||
for (pch=id; isNum && *pch; ++pch)
|
||||
if (!isdigit (*pch))
|
||||
isNum = false;
|
||||
if (isNum || isList)
|
||||
tr_rpc_parse_list_str (tr_variantDictAdd (args, TR_KEY_ids), id, strlen (id));
|
||||
else
|
||||
tr_variantDictAddStr (args, TR_KEY_ids, id); /* it's a torrent sha hash */
|
||||
tr_variantDictAddStr (args, TR_KEY_ids, "recently-active");
|
||||
}
|
||||
else if (strcmp (id, "all"))
|
||||
{
|
||||
const char * pch;
|
||||
bool isList = strchr (id,',') || strchr (id,'-');
|
||||
bool isNum = true;
|
||||
|
||||
for (pch=id; isNum && *pch; ++pch)
|
||||
if (!isdigit (*pch))
|
||||
isNum = false;
|
||||
|
||||
if (isNum || isList)
|
||||
tr_rpc_parse_list_str (tr_variantDictAdd (args, TR_KEY_ids), id, strlen (id));
|
||||
else
|
||||
tr_variantDictAddStr (args, TR_KEY_ids, id); /* it's a torrent sha hash */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1981,6 +1985,7 @@ processArgs (const char * rpcurl, int argc, const char ** argv)
|
|||
case 'l': tr_variantDictAddInt (top, TR_KEY_tag, TAG_LIST);
|
||||
n = TR_N_ELEMENTS (list_keys);
|
||||
for (i=0; i<n; ++i) tr_variantListAddQuark (fields, list_keys[i]);
|
||||
addIdArg (args, id);
|
||||
break;
|
||||
case 940: tr_variantDictAddInt (top, TR_KEY_tag, TAG_FILES);
|
||||
n = TR_N_ELEMENTS (files_keys);
|
||||
|
|
|
@ -57,7 +57,7 @@ and
|
|||
.Op Fl srd
|
||||
.Op Fl si
|
||||
.Op Fl st
|
||||
.Op Fl t Ar all | Ar id | Ar hash
|
||||
.Op Fl t Ar all | active | Ar id | Ar hash
|
||||
.Op Fl hl
|
||||
.Op Fl HL
|
||||
.Op Fl u Ar number | Fl U
|
||||
|
@ -256,10 +256,12 @@ Stop the current torrent(s) from downloading or seeding
|
|||
Start added torrents paused
|
||||
.It Fl -no-start-paused
|
||||
Start added torrents unpaused
|
||||
.It Fl t Fl -torrent Ar all | id | torrent-hash
|
||||
Set the current torrent(s) for use by subsequent options.
|
||||
.It Fl t Fl -torrent Ar all | active | id | torrent-hash
|
||||
Set the current torrent(s) for use by subsequent options. The literal
|
||||
.Ar all
|
||||
will apply following requests to all torrents, while specific torrents can be chosen by
|
||||
will apply following requests to all torrents; the literal
|
||||
.Ar active
|
||||
will apply following requests to recently-active torrents; and specific torrents can be chosen by
|
||||
.Ar id
|
||||
or
|
||||
.Ar hash .
|
||||
|
@ -318,6 +320,14 @@ In the `status' section of the list, the following shorthand is used:
|
|||
.D1 ?: We unchoked this peer, but they're not interested
|
||||
.El
|
||||
.Sh EXAMPLES
|
||||
List all torrents:
|
||||
.Bd -literal -offset indent
|
||||
$ transmission-remote \-l
|
||||
.Ed
|
||||
List all active torrents:
|
||||
.Bd -literal -offset indent
|
||||
$ transmission-remote \-tactive \-l
|
||||
.Ed
|
||||
Set download and upload limits to 400 kB/sec and 60 kB/sec:
|
||||
.Bd -literal -offset indent
|
||||
$ transmission-remote \-d400 \-u60
|
||||
|
|
Loading…
Reference in New Issue