Response arguments: none
-3.2. Torrent List
-
- An overview list of torrents.
-
- Method name: "torrent-list".
-
- Request arguments: none.
-
- Response arguments: "list", an array of objects that contain these keys:
-
- key | value type
- ----------------------+-------------------------------------------------
- "downloadedEver" | number
- "eta" | number
- "hashString" | string
- "id" | number
- "name" | string
- "peersConnected" | number
- "peersSendingToUs" | number
- "peersGettingFromUs" | number
- "percentDone" | double
- "rateDownload" | double
- "rateUpload" | double
- "ratio" | double
- "sizeWhenDone" | number
- "status" | number
- "uploadedEver" | number
-
-
-
-3.3. Torrent Info Requests
+3.2. Torrent Information Requests
Method name: "torrent-info".
- Request arguments: 3.1's optional "ids" argument.
-
- Response arguments: "torrent-info", an array of objects based on
- libtransmission's tr_info struct but different in the following ways:
- (1) the torrent's "id" field is added.
- (2) tr_info's "hash" field is omitted.
- (3) tr_info's "pieces" field is omitted.
- (4) tr_file's only included pieces are "name" and "length".
-
- Note that this is a fairly high-bandwidth request and that its results
- don't change. You should try to cache its results instead of re-calling it.
-
- Example Request:
+ The request takes two arguments: "ids", as described in section 3.1, and
+ "fields", a bitwise-or'ed number which specifies which torrent information
+ is being requested. (See libtransmission/rpc.h's enumeration)
+ The response arguments are "fields" (identical to the request argument)
+ and "torrent-info", a list of objects that each contain the pairs
+ shown here:
+
+ field and | response | response | source
+ numeric value | type | name |
+ -------------------+----------+------------------------+-------------
+ activity, 1 | number | desiredAvailable | tr_stat
+ | number | eta | tr_stat
+ | number | peersConnected | tr_stat
+ | number | peersGettingFromUs | tr_stat
+ | number | peersSendingToUs | tr_stat
+ | number | rateDownload | tr_stat
+ | number | rateUpload | tr_stat
+ | number | recheckProgress | tr_stat
+ | number | status | tr_stat
+ | number | swarmSpeed | tr_stat
+ | number | webseedsSendingToUs | tr_stat
+ -------------------+----------+------------------------+-------------
+ announce, 2 | string | announceResponse | tr_stat
+ | string | announceURL | tr_stat
+ | string | lastAnnounceTime | tr_stat
+ | string | manualAnnounceTime | tr_stat
+ | string | nextAnnounceTime | tr_stat
+ -------------------+----------+------------------------+-------------
+ error, 4 | number | error | tr_stat
+ | number | errorString | tr_Stat
+ -------------------+----------+------------------------+-------------
+ files, 8 | array | files
+ +----------+--------------------------------------
+ | files is an array of objects that contain:
+ +----------+------------------------+-------------
+ | number | length | tr_info
+ | string | name | tr_info
+ -------------------+----------+------------------------+-------------
+ history, 16 | number | activityDate | tr_stat
+ | number | addedDate | tr_stat
+ | number | corruptEver | tr_stat
+ | number | doneDate | tr_stat
+ | number | downloadedEver | tr_stat
+ | number | startDate | tr_stat
+ | number | uploadedEver | tr_stat
+ -------------------+----------+------------------------+-------------
+ id, 32 | number | uniqueId | tr_torrent
+ | string | hashString | tr_info
+ | string | name | tr_info
+ -------------------+----------+------------------------+-------------
+ info, 64 | string | comment | tr_info
+ | string | creator | tr_info
+ | number | dateCreated | tr_info
+ | number | pieceCount | tr_info
+ | number | pieceSize | tr_info
+ -------------------+----------+------------------------+-------------
+ limits, 128 | number | downloadLimit | tr_torrent
+ | number | downloadLimitMode | tr_torrent
+ | number | maxConnectedPeers | tr_torrent
+ | number | uploadLimit | tr_torrent
+ | number | uploadLimitMode | tr_torrent
+ -------------------+----------+------------------------+-------------
+ peers, 256 | object | peersFrom | tr_stat
+ +----------+------------------------+-------------
+ | peersFrom contains:
+ +----------+------------------------+-------------
+ | number | cache | tr_stat
+ | number | incoming | tr_stat
+ | number | pex | tr_stat
+ | number | tracker | tr_stat
+ -------------------+----------+------------------------+-------------
+ scrape, 512 | number | lastScrapeTime | tr_stat
+ | number | nextScrapeTime | tr_stat
+ | string | scrapeResponse | tr_stat
+ | string | scrapeURL | tr_stat
+ -------------------+----------+------------------------+-------------
+ size, 1024 | number | haveUnchecked | tr_stat
+ | number | haveValid | tr_stat
+ | number | leftUntilDone | tr_stat
+ | 'double' | percentComplete | tr_stat
+ | 'double' | percentDone | tr_stat
+ | 'double' | ratio | tr_stat
+ | number | sizeWhenDone | tr_stat
+ | number | totalSize | tr_stat
+ -------------------+----------+------------------------+-------------
+ tracker stats, | number | leechers | tr_stat
+ 2048 | number | peersKnown | tr_stat
+ | number | seeders | tr_stat
+ | number | timesCompleted | tr_stat
+ -------------------+----------+--------------------------------------
+ trackers, 4096 | array | trackers
+ +----------+--------------------------------------
+ | trackers is an array of objects that contain:
+ +----------+------------------------+-------------
+ | string | announce | tr_info
+ | string | scrape | tr_info
+ | number | tier | tr_info
+ -------------------+----------+------------------------+-------------
+ webseeds, 8192 | object | webseeds
+ +----------+--------------------------------------
+ | webseeds contains:
+ | an array of weseed url strings
+ -------------------+----------+------------------------+-------------
+
+
+ Example:
+
+ Say we want to get the ratio and name of torrents 7 and 10.
+ name is in the "id" section (32) and ratio is in "size" (1024),
+ so the "fields" argument will be 32 + 1024 == 1056.
+
+ Request:
{
- "arguments": { "ids": [ 7, 10 ] }
+ "arguments": {
+ "fields": 1056,
+ "ids": [ 7, 10 ],
+ }
"method": "torrent-info",
"tag": 39693
}
- Example Response:
+
+ Response:
{
"tag": 39693
"result": "success",
"arguments": {
+ "fields": 1056,
"torrent-info": [
- {
- "id": 7,
- "name": "Ubuntu x86_64 DVD",
- "pieceCount": 1209233,
- "pieceSize": 4096,
- "totalSize": 9803930483,
- ...
+ {
+ "hashString": "asdasiofjosejfoasjfiosj",
+ "haveUnchecked", 0,
+ "haveValid", 9923890123,
+ "leftUntilDone", 0,
+ "name": "Ubundu x86_64 DVD",
+ "percentComplete", "1.0000",
+ "percentDone", "1.0000",
+ "ratio", "2.23222",
+ "sizeWhenDone", 9923890123,
+ "totalSize", 9923890123,
+ "uniqueId": 7,
},
{
- "id": 10,
- "name": "Ubuntu i386 DVD",
- "pieceCount": 83943,
- "pieceSize": 12345,
- "totalSize": 2398480394,
- ...
+ "hashString": "sijioejisoefjiosejfioi",
+ "haveUnchecked", 23023,
+ "haveValid", 27986795145,
+ "leftUntilDone", 0,
+ "name": "Fedora x86_64 DVD",
+ "percentComplete", "1.0000",
+ "percentDone", "0.8010",
+ "ratio", "0.604034",
+ "sizeWhenDone", 34983493932,
+ "totalSize", 34983493932,
+ "uniqueId": 10,
}
]
}
}
-3.4. Torrent Status Requests
-
- Method name: "torrent-status"
-
- Request arguments: 3.1's optional "ids" argument.
-
- Response arguments: "torrent-status", an array of objects
- based on libtransmission's tr_stat struct but different
- in the following ways:
- (1) tr_info's "hashString" field is added.
-
-3.5. Adding a Torrent
+3.3. Adding a Torrent
Method name: "torrent-add"
Request arguments:
- string | value type & description
+ key | value type & description
-------------------+-------------------------------------------------
"download-dir" | string path to download the torrent to
"filename" | string location of the .torrent file
All other arguments are optional.
Response arguments: on success, a "torrent-added" object in the
- form of one of 3.3's tr_info objects.
+ form of one of 3.3's tr_info objects with the
+ fields for id, name, and hashString.
-3.6. Other Torrent Settings
+3.4. Other Torrent Settings
Common arguments:
"speed-limit-up" | int maximum upload speed (in KiB/s)
"speed-limit-up-enabled" | boolean true if the upload speed is limited
-3.6.1. Mutators
+3.4.1. Mutators
Method name: "torrent-set"
Request arguments: 3.1's "ids", plus one or more of 3.6's arguments
Response arguments: none
-
-3.6.2. Accessors
-
- Method name: "torrent-get"
- Request arguments: none
- Response arguments: A "torrents" list of objects containing all
- of 3.6's arguments plus the torrent's "id" field.
-3.7 File Priorities
+3.5 File Priorities
Common arguments:
"priority-low" | array indices of one or more low-priority files
"priority-normal" | array indices of one or more normal-priority files
-3.7.1. Mutators
+3.5.1. Mutators
Method name: "torrent-set-priorities"
Request arguments: 3.1's "ids", plus one or more of 3.7's arguments
Response arguments: none
-3.7.2. Accessors
+3.5.2. Accessors
Method name: "torrent-get-priorities"
Request arguments: none
#include "transmission.h"
#include "bencode.h"
+#include "ratecontrol.h"
#include "rpc.h"
#include "json.h"
#include "session.h"
****
***/
-static const char*
-torrentStatus( tr_handle * handle, tr_benc * args_in, tr_benc * args_out )
-{
- int i, torrentCount;
- tr_torrent ** torrents = getTorrents( handle, args_in, &torrentCount );
- tr_benc * list = tr_bencDictAddList( args_out, "torrent-status", torrentCount );
-
- for( i=0; i<torrentCount; ++i )
- {
- tr_torrent * tor = torrents[i];
- const tr_stat * st = tr_torrentStat( tor );
- const int * f = st->peersFrom;
- tr_benc * d = tr_bencListAddDict( list, 41 );
- tr_benc * t;
-
- tr_bencDictAddInt( d, "activityDate", st->activityDate );
- tr_bencDictAddStr( d, "announceResponse", st->announceResponse );
- tr_bencDictAddStr( d, "announceURL", st->announceURL );
- tr_bencDictAddInt( d, "completedFromTracker", st->completedFromTracker );
- tr_bencDictAddInt( d, "corruptEver", st->corruptEver );
- tr_bencDictAddInt( d, "desiredAvailable", st->desiredAvailable );
- tr_bencDictAddInt( d, "downloadedEver", st->downloadedEver );
- tr_bencDictAddInt( d, "error", st->error );
- tr_bencDictAddStr( d, "errorString", st->errorString );
- tr_bencDictAddInt( d, "eta", st->eta );
- tr_bencDictAddStr( d, "hashString", tor->info.hashString );
- tr_bencDictAddInt( d, "haveUnchecked", st->haveUnchecked );
- tr_bencDictAddInt( d, "haveValid", st->haveValid );
- tr_bencDictAddInt( d, "id", st->id );
- tr_bencDictAddInt( d, "lastAnnounceTime", st->lastAnnounceTime );
- tr_bencDictAddInt( d, "lastScrapeTime", st->lastScrapeTime );
- tr_bencDictAddInt( d, "leechers", st->leechers );
- tr_bencDictAddInt( d, "leftUntilDone", st->leftUntilDone );
- tr_bencDictAddInt( d, "manualAnnounceTime", st->manualAnnounceTime );
- tr_bencDictAddInt( d, "nextAnnounceTime", st->nextAnnounceTime );
- tr_bencDictAddInt( d, "nextScrapeTime", st->nextScrapeTime );
- tr_bencDictAddInt( d, "peersConnected", st->peersConnected );
- t = tr_bencDictAddDict( d, "peersFrom", 4 );
- tr_bencDictAddInt( t, "cache", f[TR_PEER_FROM_CACHE] );
- tr_bencDictAddInt( t, "incoming", f[TR_PEER_FROM_INCOMING] );
- tr_bencDictAddInt( t, "pex", f[TR_PEER_FROM_PEX] );
- tr_bencDictAddInt( t, "tracker", f[TR_PEER_FROM_TRACKER] );
- tr_bencDictAddInt( d, "peersGettingFromUs", st->peersGettingFromUs );
- tr_bencDictAddInt( d, "peersKnown", st->peersKnown );
- tr_bencDictAddInt( d, "peersSendingToUs", st->peersSendingToUs );
- tr_bencDictAddDouble( d, "percentComplete", st->percentComplete );
- tr_bencDictAddDouble( d, "percentDone", st->percentDone );
- tr_bencDictAddDouble( d, "rateDownload", st->rateDownload );
- tr_bencDictAddDouble( d, "rateUpload", st->rateUpload );
- tr_bencDictAddDouble( d, "ratio", st->ratio );
- tr_bencDictAddDouble( d, "recheckProgress", st->recheckProgress );
- tr_bencDictAddStr( d, "scrapeResponse", st->scrapeResponse );
- tr_bencDictAddStr( d, "scrapeURL", st->scrapeURL );
- tr_bencDictAddInt( d, "seeders", st->seeders );
- tr_bencDictAddInt( d, "sizeWhenDone", st->sizeWhenDone );
- tr_bencDictAddInt( d, "startDate", st->startDate );
- tr_bencDictAddInt( d, "status", st->status );
- tr_bencDictAddDouble( d, "swarmSpeed", st->swarmSpeed );
- tr_bencDictAddInt( d, "uploadedEver", st->uploadedEver );
- }
-
- tr_free( torrents );
- return NULL;
-}
-
-/**
-***
-**/
-
static void
addFiles( const tr_info * info, tr_benc * files )
{
}
}
+static void
+addWebseeds( const tr_info * info, tr_benc * webseeds )
+{
+ int i;
+ for( i=0; i<info->webseedCount; ++i )
+ tr_bencListAddStr( webseeds, info->webseeds[i] );
+}
+
static void
addTrackers( const tr_info * info, tr_benc * trackers )
{
}
static void
-addInfo( const tr_torrent * tor, tr_benc * d )
+addInfo( const tr_torrent * tor, tr_benc * d, uint64_t fields )
{
const tr_info * inf = tr_torrentInfo( tor );
- tr_bencInitDict( d, 14 );
- tr_bencDictAddStr( d, "comment", inf->comment ? inf->comment : "" );
- tr_bencDictAddStr( d, "creator", inf->creator ? inf->creator : "" );
- tr_bencDictAddInt( d, "dateCreated", inf->dateCreated );
- addFiles( inf, tr_bencDictAddList( d, "files", inf->fileCount ) );
- tr_bencDictAddStr( d, "hashString", inf->hashString );
- tr_bencDictAddInt( d, "id", tr_torrentId( tor ) );
- tr_bencDictAddInt( d, "isMultifile", inf->isMultifile );
- tr_bencDictAddInt( d, "isPrivate", inf->isPrivate );
- tr_bencDictAddStr( d, "name", inf->name );
- tr_bencDictAddInt( d, "pieceCount", inf->pieceCount );
- tr_bencDictAddInt( d, "pieceSize", inf->pieceSize );
- tr_bencDictAddStr( d, "torrent", inf->torrent );
- tr_bencDictAddInt( d, "totalSize", inf->totalSize );
- addTrackers( inf, tr_bencDictAddList( d, "trackers", inf->trackerCount ) );
-}
+ const tr_stat * st = tr_torrentStat( (tr_torrent*)tor );
-static const char*
-torrentInfo( tr_handle * handle, tr_benc * args_in, tr_benc * args_out )
-{
- int i, torrentCount;
- tr_torrent ** torrents = getTorrents( handle, args_in, &torrentCount );
- tr_benc * list = tr_bencDictAddList( args_out, "torrent-info", torrentCount );
+ tr_bencInitDict( d, 64 );
- for( i=0; i<torrentCount; ++i )
- addInfo( torrents[i], tr_bencListAdd( list ) );
+ if( fields & TR_RPC_TORRENT_FIELD_ACTIVITY ) {
+ tr_bencDictAddInt( d, "desiredAvailable", st->desiredAvailable );
+ tr_bencDictAddInt( d, "eta", st->eta );
+ tr_bencDictAddInt( d, "peersConnected", st->peersConnected );
+ tr_bencDictAddInt( d, "peersGettingFromUs", st->peersGettingFromUs );
+ tr_bencDictAddInt( d, "peersSendingToUs", st->peersSendingToUs );
+ tr_bencDictAddDouble( d, "rateDownload", st->rateDownload );
+ tr_bencDictAddDouble( d, "rateUpload", st->rateUpload );
+ tr_bencDictAddDouble( d, "recheckProgress", st->recheckProgress );
+ tr_bencDictAddInt( d, "status", st->status );
+ tr_bencDictAddDouble( d, "swarmSpeed", st->swarmSpeed );
+ tr_bencDictAddInt( d, "webseedsSendingToUs", st->webseedsSendingToUs );
+ }
- tr_free( torrents );
- return NULL;
-}
+ if( fields & TR_RPC_TORRENT_FIELD_ANNOUNCE ) {
+ tr_bencDictAddStr( d, "announceResponse", st->announceResponse );
+ tr_bencDictAddStr( d, "announceURL", st->announceURL );
+ tr_bencDictAddInt( d, "lastAnnounceTime", st->lastAnnounceTime );
+ tr_bencDictAddInt( d, "manualAnnounceTime", st->manualAnnounceTime );
+ tr_bencDictAddInt( d, "nextAnnounceTime", st->nextAnnounceTime );
+ }
-/**
-***
-**/
+ if( fields & TR_RPC_TORRENT_FIELD_ERROR ) {
+ tr_bencDictAddInt( d, "error", st->error );
+ tr_bencDictAddStr( d, "errorString", st->errorString );
+ }
-static const char*
-torrentList( tr_handle * handle, tr_benc * args_in, tr_benc * args_out )
-{
- int i, torrentCount;
- tr_torrent ** torrents = getTorrents( handle, args_in, &torrentCount );
- tr_benc * list = tr_bencDictAddList( args_out, "list", torrentCount );
+ if( fields & TR_RPC_TORRENT_FIELD_FILES )
+ addFiles( inf, tr_bencDictAddList( d, "files", inf->fileCount ) );
- for( i=0; i<torrentCount; ++i )
- {
- tr_torrent * tor = torrents[i];
- const tr_stat * st = tr_torrentStat( tor );
- tr_benc * d = tr_bencListAddDict( list, 15 );
+ if( fields & TR_RPC_TORRENT_FIELD_HISTORY ) {
+ tr_bencDictAddInt( d, "activityDate", st->activityDate );
+ tr_bencDictAddInt( d, "addedDate", st->addedDate );
+ tr_bencDictAddInt( d, "corruptEver", st->corruptEver );
+ tr_bencDictAddInt( d, "doneDate", st->doneDate );
tr_bencDictAddInt( d, "downloadedEver", st->downloadedEver );
- tr_bencDictAddInt( d, "eta", st->eta );
+ tr_bencDictAddInt( d, "startDate", st->startDate );
+ tr_bencDictAddInt( d, "uploadedEver", st->uploadedEver );
+ }
+
+ if( fields & TR_RPC_TORRENT_FIELD_ID ) {
+ tr_bencDictAddInt( d, "id", st->id );
tr_bencDictAddStr( d, "hashString", tor->info.hashString );
- tr_bencDictAddInt( d, "id", tr_torrentId( tor ) );
- tr_bencDictAddStr( d, "name", tor->info.name );
- tr_bencDictAddInt( d, "peersConnected", st->peersConnected );
- tr_bencDictAddInt( d, "peersGettingFromUs", st->peersGettingFromUs );
- tr_bencDictAddInt( d, "peersSendingToUs", st->peersSendingToUs );
+ tr_bencDictAddStr( d, "name", inf->name );
+ }
+
+ if( fields & TR_RPC_TORRENT_FIELD_INFO ) {
+ tr_bencDictAddStr( d, "comment", inf->comment ? inf->comment : "" );
+ tr_bencDictAddStr( d, "creator", inf->creator ? inf->creator : "" );
+ tr_bencDictAddInt( d, "dateCreated", inf->dateCreated );
+ tr_bencDictAddInt( d, "pieceCount", inf->pieceCount );
+ tr_bencDictAddInt( d, "pieceSize", inf->pieceSize );
+ }
+
+ if( fields & TR_RPC_TORRENT_FIELD_LIMITS ) {
+ tr_bencDictAddInt( d, "downloadLimit", tr_torrentGetSpeedLimit( tor, TR_DOWN ) );
+ tr_bencDictAddInt( d, "downloadLimitMode", tr_torrentGetSpeedMode( tor, TR_DOWN ) );
+ tr_bencDictAddInt( d, "maxConnectedPeers", tr_torrentGetPeerLimit( tor ) );
+ tr_bencDictAddInt( d, "uploadLimit", tr_torrentGetSpeedLimit( tor, TR_UP ) );
+ tr_bencDictAddInt( d, "uploadLimitMode", tr_torrentGetSpeedMode( tor, TR_UP ) );
+ }
+
+ if( fields & TR_RPC_TORRENT_FIELD_PEERS ) {
+ const int * from = st->peersFrom;
+ tr_benc * f;
+ f = tr_bencDictAddDict( d, "peersFrom", 4 );
+ tr_bencDictAddInt( f, "cache", from[TR_PEER_FROM_CACHE] );
+ tr_bencDictAddInt( f, "incoming", from[TR_PEER_FROM_INCOMING] );
+ tr_bencDictAddInt( f, "pex", from[TR_PEER_FROM_PEX] );
+ tr_bencDictAddInt( f, "tracker", from[TR_PEER_FROM_TRACKER] );
+ }
+
+ if( fields & TR_RPC_TORRENT_FIELD_SCRAPE ) {
+ tr_bencDictAddInt( d, "lastScrapeTime", st->lastScrapeTime );
+ tr_bencDictAddInt( d, "nextScrapeTime", st->nextScrapeTime );
+ tr_bencDictAddStr( d, "scrapeResponse", st->scrapeResponse );
+ tr_bencDictAddStr( d, "scrapeURL", st->scrapeURL );
+ }
+
+ if( fields & TR_RPC_TORRENT_FIELD_SIZE ) {
+ tr_bencDictAddInt( d, "haveUnchecked", st->haveUnchecked );
+ tr_bencDictAddInt( d, "haveValid", st->haveValid );
+ tr_bencDictAddInt( d, "leftUntilDone", st->leftUntilDone );
+ tr_bencDictAddDouble( d, "percentComplete", st->percentComplete );
tr_bencDictAddDouble( d, "percentDone", st->percentDone );
- tr_bencDictAddDouble( d, "rateDownload", st->rateDownload );
- tr_bencDictAddDouble( d, "rateUpload", st->rateUpload );
tr_bencDictAddDouble( d, "ratio", st->ratio );
tr_bencDictAddInt( d, "sizeWhenDone", st->sizeWhenDone );
- tr_bencDictAddInt( d, "status", st->status );
- tr_bencDictAddInt( d, "uploadedEver", st->uploadedEver );
+ tr_bencDictAddInt( d, "totalSize", inf->totalSize );
}
- tr_free( torrents );
- return NULL;
-}
+ if( fields & TR_RPC_TORRENT_FIELD_TRACKER_STATS ) {
+ tr_bencDictAddInt( d, "leechers", st->leechers );
+ tr_bencDictAddInt( d, "peersKnown", st->peersKnown );
+ tr_bencDictAddInt( d, "seeders", st->seeders );
+ tr_bencDictAddDouble( d, "timesCompleted", st->timesCompleted );
+ }
-/**
-***
-**/
+ if( fields & TR_RPC_TORRENT_FIELD_TRACKERS )
+ addTrackers( inf, tr_bencDictAddList( d, "trackers", inf->trackerCount ) );
+
+ if( fields & TR_RPC_TORRENT_FIELD_WEBSEEDS )
+ addWebseeds( inf, tr_bencDictAddList( d, "webseeds", inf->trackerCount ) );
+}
static const char*
-torrentGet( tr_handle * handle, tr_benc * args_in, tr_benc * args_out )
+torrentInfo( tr_handle * handle, tr_benc * args_in, tr_benc * args_out )
{
int i, torrentCount;
tr_torrent ** torrents = getTorrents( handle, args_in, &torrentCount );
- tr_benc * list = tr_bencDictAddList( args_out, "torrents", torrentCount );
+ tr_benc * list = tr_bencDictAddList( args_out, "torrent-info", torrentCount );
+ int64_t fields = 0;
+
+ if( !tr_bencDictFindInt( args_in, "fields", &fields ) )
+ fields = ~(int64_t)0;
+ tr_bencDictAddInt( args_out, "fields", fields );
for( i=0; i<torrentCount; ++i )
- {
- tr_torrent * tor = torrents[i];
- tr_benc * d = tr_bencListAddDict( list, 6 );
- tr_bencDictAddInt( d, "id", tr_torrentId( tor ) );
- tr_bencDictAddInt( d, "peer-limit",
- tr_torrentGetPeerLimit( tor ) );
- tr_bencDictAddInt( d, "speed-limit-down",
- tr_torrentGetSpeedLimit( tor, TR_DOWN ) );
- tr_bencDictAddInt( d, "speed-limit-down-enabled",
- tr_torrentGetSpeedMode( tor, TR_DOWN )
- == TR_SPEEDLIMIT_SINGLE );
- tr_bencDictAddInt( d, "speed-limit-up",
- tr_torrentGetSpeedLimit( tor, TR_UP ) );
- tr_bencDictAddInt( d, "speed-limit-up-enabled",
- tr_torrentGetSpeedMode( tor, TR_UP )
- == TR_SPEEDLIMIT_SINGLE );
- }
+ addInfo( torrents[i], tr_bencListAdd( list ), fields );
tr_free( torrents );
return NULL;
}
+/***
+****
+***/
+
static const char*
torrentSet( tr_handle * h, tr_benc * args_in, tr_benc * args_out UNUSED )
{
tr_ctorFree( ctor );
if( tor ) {
- addInfo( tor, tr_bencDictAdd( args_out, "torrent-added" ) );
+ addInfo( tor, tr_bencDictAdd( args_out, "torrent-added" ), TR_RPC_TORRENT_FIELD_ID );
notify( h, TR_RPC_TORRENT_ADDED, tor );
} else if( err == TR_EDUPLICATE ) {
return "duplicate torrent";
{ "session-set", sessionSet },
{ "torrent-add", torrentAdd },
{ "torrent-get-priorities", torrentGetPriorities },
- { "torrent-get", torrentGet },
{ "torrent-info", torrentInfo },
- { "torrent-list", torrentList },
{ "torrent-remove", torrentRemove },
{ "torrent-set-priorities", torrentSetPriorities },
{ "torrent-set", torrentSet },
{ "torrent-start", torrentStart },
- { "torrent-status", torrentStatus },
{ "torrent-stop", torrentStop },
{ "torrent-verify", torrentVerify }
};