]> granicus.if.org Git - transmission/commitdiff
(trunk daemon) #1704: --info and/or --files should show the download directory
authorCharles Kerr <charles@transmissionbt.com>
Sat, 17 Jan 2009 14:58:50 +0000 (14:58 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Sat, 17 Jan 2009 14:58:50 +0000 (14:58 +0000)
daemon/remote.c
doc/rpc-spec.txt
libtransmission/rpcimpl.c

index 1e4039970f2c10fa0cafbbe123caab5420e9eda1..9c4404519efa7a01fbea47d98fdcd86ee73ea616 100644 (file)
@@ -58,71 +58,38 @@ getUsage( void )
 
 static tr_option opts[] =
 {
-    { 'a', "add",                  "Add torrent files",
-      "a",  0, NULL                  },
-    { 'b', "debug",                "Print debugging information",
-      "b",  0, NULL                  },
-    { 'd', "downlimit",            "Set the maximum global download speed in KB/s",
-      "d",  1, "<speed>"             },
-    { 'D', "no-downlimit",         "Don't limit the global download speed",
-      "D",  0, NULL                  },
-    { 910, "encryption-required",  "Encrypt all peer connections",
-      "er", 0, NULL                  },
-    { 911, "encryption-preferred", "Prefer encrypted peer connections",
-      "ep", 0, NULL                  },
-    { 912, "encryption-tolerated", "Prefer unencrypted peer connections",
-      "et", 0, NULL                  },
-    { 'f', "files",                "List the current torrent's files",
-      "f",  0, NULL                  },
-    { 'g', "get",                  "Mark files for download",
-      "g",  1, "<files>"             },
-    { 'G', "no-get",               "Mark files for not downloading",
-      "G",  1, "<files>"             },
-    { 'i', "info",                 "Show details of the current torrent(s)",
-      "i",  0, NULL                  },
-    { 'l', "list",                 "List all torrents",
-      "l",  0, NULL                  },
-    { 'm', "portmap",              "Enable portmapping via NAT-PMP or UPnP",
-      "m",  0, NULL                  },
-    { 'M', "no-portmap",           "Disable portmapping",
-      "M",  0, NULL                  },
-    { 'n', "auth",                 "Set authentication info",
-      "n",  1, "<username:password>" },
-    { 'p', "port",
-      "Port for incoming peers (Default: " TR_DEFAULT_PEER_PORT_STR ")",
-      "p", 1, "<port>" },
-    { 900, "priority-high",        "Set the files' priorities as high",
-      "ph", 1, "<files>"             },
-    { 901, "priority-normal",      "Set the files' priorities as normal",
-      "pn", 1, "<files>"             },
-    { 902, "priority-low",         "Set the files' priorities as low",
-      "pl", 1, "<files>"             },
-    { 'r', "remove",               "Remove the current torrent(s)",
-      "r",  0, NULL                  },
-    { 'R', "remove-and-delete",    "Remove the current torrent(s) and delete local data",
-      NULL, 0, NULL                  },
-    { 's', "start",                "Start the current torrent(s)",
-      "s",  0, NULL                  },
-    { 'S', "stop",                 "Stop the current torrent(s)",
-      "S",  0, NULL                  },
-    { 't', "torrent",              "Set the current torrent(s)",
-      "t",  1, "<torrent>"           },
-    { 'u', "uplimit",              "Set the maximum global upload speed in KB/s",
-      "u",  1, "<speed>"             },
-    { 'U', "no-uplimit",           "Don't limit the global upload speed",
-      "U",  0, NULL                  },
-    { 'v', "verify",               "Verify the current torrent(s)",
-      "v",  0, NULL                  },
-    { 'w', "download-dir",         "Set the default download folder",
-      "w",  1, "<path>"              },
-    { 'x', "pex",                  "Enable peer exchange (PEX)",
-      "x",  0, NULL                  },
-    { 'X', "no-pex",               "Disable peer exchange (PEX)",
-      "X",  0, NULL                  },
-    { 'z', "peers",                "List the current torrent's peers",
-      "z",  0, NULL                  },
-    {   0, NULL,                   NULL,
-        NULL, 0, NULL                  }
+    { 'a', "add",                  "Add torrent files", "a",  0, NULL },
+    { 'b', "debug",                "Print debugging information", "b",  0, NULL },
+    { 'd', "downlimit",            "Set the maximum global download speed in KB/s", "d",  1, "<speed>" },
+    { 'D', "no-downlimit",         "Don't limit the global download speed", "D",  0, NULL },
+    { 910, "encryption-required",  "Encrypt all peer connections", "er", 0, NULL },
+    { 911, "encryption-preferred", "Prefer encrypted peer connections", "ep", 0, NULL },
+    { 912, "encryption-tolerated", "Prefer unencrypted peer connections", "et", 0, NULL },
+    { 'f', "files",                "List the current torrent's files", "f",  0, NULL },
+    { 'g', "get",                  "Mark files for download", "g",  1, "<files>" },
+    { 'G', "no-get",               "Mark files for not downloading", "G",  1, "<files>" },
+    { 'i', "info",                 "Show details of the current torrent(s)", "i",  0, NULL },
+    { 'l', "list",                 "List all torrents", "l",  0, NULL },
+    { 'm', "portmap",              "Enable portmapping via NAT-PMP or UPnP", "m",  0, NULL },
+    { 'M', "no-portmap",           "Disable portmapping", "M",  0, NULL },
+    { 'n', "auth",                 "Set authentication info", "n",  1, "<username:password>" },
+    { 'p', "port",                 "Port for incoming peers (Default: " TR_DEFAULT_PEER_PORT_STR ")", "p", 1, "<port>" },
+    { 900, "priority-high",        "Set the files' priorities as high", "ph", 1, "<files>" },
+    { 901, "priority-normal",      "Set the files' priorities as normal", "pn", 1, "<files>" },
+    { 902, "priority-low",         "Set the files' priorities as low", "pl", 1, "<files>" },
+    { 'r', "remove",               "Remove the current torrent(s)", "r",  0, NULL },
+    { 'R', "remove-and-delete",    "Remove the current torrent(s) and delete local data", NULL, 0, NULL },
+    { 's', "start",                "Start the current torrent(s)", "s",  0, NULL },
+    { 'S', "stop",                 "Stop the current torrent(s)", "S",  0, NULL },
+    { 't', "torrent",              "Set the current torrent(s)", "t",  1, "<torrent>" },
+    { 'u', "uplimit",              "Set the maximum global upload speed in KB/s", "u",  1, "<speed>" },
+    { 'U', "no-uplimit",           "Don't limit the global upload speed", "U",  0, NULL },
+    { 'v', "verify",               "Verify the current torrent(s)", "v",  0, NULL },
+    { 'w', "download-dir",         "Set the default download folder", "w",  1, "<path>" },
+    { 'x', "pex",                  "Enable peer exchange (PEX)", "x",  0, NULL },
+    { 'X', "no-pex",               "Disable peer exchange (PEX)", "X",  0, NULL },
+    { 'z', "peers",                "List the current torrent's peers", "z",  0, NULL },
+    {   0, NULL,                   NULL, NULL, 0, NULL }
 };
 
 static void
@@ -234,28 +201,56 @@ addFiles( tr_benc *    args,
 #define TR_N_ELEMENTS( ary ) ( sizeof( ary ) / sizeof( *ary ) )
 
 static const char * files_keys[] = {
-    "files", "name", "priorities", "wanted"
+    "files",
+    "name",
+    "priorities",
+    "wanted"
 };
 
 static const char * details_keys[] = {
-    "activityDate",     "addedDate",              "announceResponse",
+    "activityDate",
+    "addedDate",
+    "announceResponse",
     "announceURL",
-    "comment",        "corruptEver",        "creator",
-    "dateCreated",     "doneDate",
-    "downloadedEver", "errorString",        "eta",
-    "hashString",      "haveUnchecked",
-    "haveValid",      "id",                 "isPrivate",
-    "lastAnnounceTime", "lastScrapeTime",
-    "leechers",       "leftUntilDone",      "name",
-    "nextAnnounceTime", "nextScrapeTime",
-    "peersConnected", "peersGettingFromUs", "peersSendingToUs",
-    "pieceCount",     "pieceSize",          "rateDownload",
-    "rateUpload",      "recheckProgress",
-    "scrapeResponse", "seeders",
-    "sizeWhenDone",    "startDate",
-    "status",         "timesCompleted",     "totalSize",
+    "comment",
+    "corruptEver",
+    "creator",
+    "dateCreated",
+    "doneDate",
+    "downloadDir",
+    "downloadedEver",
+    "errorString",
+    "eta",
+    "hashString",
+    "haveUnchecked",
+    "haveValid",
+    "id",
+    "isPrivate",
+    "lastAnnounceTime",
+    "lastScrapeTime",
+    "leechers",
+    "leftUntilDone",
+    "name",
+    "nextAnnounceTime",
+    "nextScrapeTime",
+    "peersConnected",
+    "peersGettingFromUs",
+    "peersSendingToUs",
+    "pieceCount",
+    "pieceSize",
+    "rateDownload",
+    "rateUpload",
+    "recheckProgress",
+    "scrapeResponse",
+    "seeders",
+    "sizeWhenDone",
+    "startDate",
+    "status",
+    "timesCompleted",
+    "totalSize",
     "uploadedEver",
-    "webseeds",       "webseedsSendingToUs"
+    "webseeds",
+    "webseedsSendingToUs"
 };
 
 static const char * list_keys[] = {
@@ -753,6 +748,9 @@ printDetails( tr_benc * top )
             getStatusString( t, buf, sizeof( buf ) );
             printf( "  State: %s\n", buf );
 
+            if( tr_bencDictFindStr( t, "downloadDir", &str ) )
+                printf( "  Location: %s\n", str );
+
             if( tr_bencDictFindInt( t, "sizeWhenDone", &i )
               && tr_bencDictFindInt( t, "leftUntilDone", &j ) )
             {
index b35a13c3e3419c4655e6953478ac99de54e6d8fe..e02df64a2993dd5c4fa6d95cdf692ef77f5439e5 100644 (file)
    dateCreated            | number                               | tr_info
    desiredAvailable       | number                               | tr_stat
    doneDate               | number                               | tr_stat
+   downloadDir            | string                               | tr_torrent
    downloadedEver         | number                               | tr_stat
    downloaders            | number                               | tr_stat
    downloadLimitMode      | number                               | tr_torrent
    ------+---------+-----------+----------------+-------------------------------
    4     | 1.50    | yes       | session-get    | new arg "rpc-version"
          |         |           | session-get    | new arg "rpc-version-minimum"
+         |         |           | torrent-get    | new arg "downloadDir"
    ------+---------+-----------+----------------+-------------------------------
 
index db52e9f532785f0af636d507f03e94bdb16c78ed..e7fa50ac629154208d7f6d9f2e8af490c01afa8a 100644 (file)
@@ -293,6 +293,8 @@ addField( const tr_torrent * tor,
         tr_bencDictAddInt( d, key, st->desiredAvailable );
     else if( !strcmp( key, "doneDate" ) )
         tr_bencDictAddInt( d, key, st->doneDate );
+    else if( !strcmp( key, "downloadDir" ) )
+        tr_bencDictAddStr( d, key, tr_torrentGetDownloadDir( tor ) );
     else if( !strcmp( key, "downloadedEver" ) )
         tr_bencDictAddInt( d, key, st->downloadedEver );
     else if( !strcmp( key, "downloaders" ) )