mirror of
https://github.com/transmission/transmission
synced 2024-12-24 08:43:27 +00:00
(trunk daemon) #1704: --info and/or --files should show the download directory
This commit is contained in:
parent
f1f7533d40
commit
f5ace9a71c
3 changed files with 84 additions and 82 deletions
162
daemon/remote.c
162
daemon/remote.c
|
@ -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 ) )
|
||||
{
|
||||
|
|
|
@ -131,6 +131,7 @@
|
|||
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
|
||||
|
@ -381,5 +382,6 @@
|
|||
------+---------+-----------+----------------+-------------------------------
|
||||
4 | 1.50 | yes | session-get | new arg "rpc-version"
|
||||
| | | session-get | new arg "rpc-version-minimum"
|
||||
| | | torrent-get | new arg "downloadDir"
|
||||
------+---------+-----------+----------------+-------------------------------
|
||||
|
||||
|
|
|
@ -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" ) )
|
||||
|
|
Loading…
Reference in a new issue