Changeset 13736


Ignore:
Timestamp:
Jan 3, 2013, 5:10:47 AM (8 years ago)
Author:
jordan
Message:

(daemon) add support for listing recently-active torrents

Location:
trunk/daemon
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/daemon/remote.c

    r13683 r13736  
    555555addIdArg (tr_variant * args, const char * id)
    556556{
    557     if (!*id)
    558     {
    559         fprintf (
    560             stderr,
    561             "No torrent specified!  Please use the -t option first.\n");
    562         id = "-1"; /* no torrent will have this ID, so should be a no-op */
    563     }
    564     if (strcmp (id, "all"))
    565     {
    566         const char * pch;
    567         bool isList = strchr (id,',') || strchr (id,'-');
    568         bool isNum = true;
    569         for (pch=id; isNum && *pch; ++pch)
    570             if (!isdigit (*pch))
    571                 isNum = false;
    572         if (isNum || isList)
    573             tr_rpc_parse_list_str (tr_variantDictAdd (args, TR_KEY_ids), id, strlen (id));
    574         else
    575             tr_variantDictAddStr (args, TR_KEY_ids, id); /* it's a torrent sha hash */
     557  if (!*id)
     558    {
     559      fprintf (stderr, "No torrent specified!  Please use the -t option first.\n");
     560      id = "-1"; /* no torrent will have this ID, so should be a no-op */
     561    }
     562  else if (!tr_strcmp0 (id, "active"))
     563    {
     564      tr_variantDictAddStr (args, TR_KEY_ids, "recently-active");
     565    }
     566  else if (strcmp (id, "all"))
     567    {
     568      const char * pch;
     569      bool isList = strchr (id,',') || strchr (id,'-');
     570      bool isNum = true;
     571
     572      for (pch=id; isNum && *pch; ++pch)
     573        if (!isdigit (*pch))
     574          isNum = false;
     575
     576      if (isNum || isList)
     577        tr_rpc_parse_list_str (tr_variantDictAdd (args, TR_KEY_ids), id, strlen (id));
     578      else
     579        tr_variantDictAddStr (args, TR_KEY_ids, id); /* it's a torrent sha hash */
    576580    }
    577581}
     
    19821986                          n = TR_N_ELEMENTS (list_keys);
    19831987                          for (i=0; i<n; ++i) tr_variantListAddQuark (fields, list_keys[i]);
     1988                          addIdArg (args, id);
    19841989                          break;
    19851990                case 940: tr_variantDictAddInt (top, TR_KEY_tag, TAG_FILES);
  • trunk/daemon/transmission-remote.1

    r13691 r13736  
    5858.Op Fl si
    5959.Op Fl st
    60 .Op Fl t Ar all | Ar id | Ar hash
     60.Op Fl t Ar all | active | Ar id | Ar hash
    6161.Op Fl hl
    6262.Op Fl HL
     
    257257.It Fl -no-start-paused
    258258Start added torrents unpaused
    259 .It Fl t Fl -torrent Ar all | id | torrent-hash
    260 Set the current torrent(s) for use by subsequent options.
     259.It Fl t Fl -torrent Ar all | active | id | torrent-hash
     260Set the current torrent(s) for use by subsequent options. The literal
    261261.Ar all
    262 will apply following requests to all torrents, while specific torrents can be chosen by
     262will apply following requests to all torrents; the literal
     263.Ar active
     264will apply following requests to recently-active torrents; and specific torrents can be chosen by
    263265.Ar id
    264266or
     
    319321.El
    320322.Sh EXAMPLES
     323List all torrents:
     324.Bd -literal -offset indent
     325$ transmission-remote \-l
     326.Ed
     327List all active torrents:
     328.Bd -literal -offset indent
     329$ transmission-remote \-tactive \-l
     330.Ed
    321331Set download and upload limits to 400 kB/sec and 60 kB/sec:
    322332.Bd -literal -offset indent
Note: See TracChangeset for help on using the changeset viewer.