1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-24 00:34:04 +00:00

modify the torrent-list response as per Gimp_'s request

This commit is contained in:
Charles Kerr 2008-06-04 07:06:47 +00:00
parent bb2fbf088f
commit 3a3397ca84
2 changed files with 31 additions and 11 deletions

View file

@ -83,16 +83,27 @@
Request arguments: none. Request arguments: none.
Response arguments: "list", an array of objects that contain seven keys: Response arguments: "list", an array of objects that contain these keys:
key | value type key | value type
--------------------+------------------------------------------------- ----------------------+-------------------------------------------------
"downloadedEver" | number
"eta" | number
"hashString" | string "hashString" | string
"id" | number "id" | number
"name" | string "name" | string
"peersConnected" | number
"peersSendingToUs" | number
"peersGettingFromUs" | number
"percentDone" | double
"rateDownload" | double "rateDownload" | double
"rateUpload" | double "rateUpload" | double
"ratio" | double "ratio" | double
"sizeWhenDone" | number
"status" | number
"uploadedEver" | number
3.3. Torrent Info Requests 3.3. Torrent Info Requests

View file

@ -296,17 +296,26 @@ torrentList( tr_handle * handle, tr_benc * args_in, tr_benc * args_out )
tr_torrent ** torrents = getTorrents( handle, args_in, &torrentCount ); tr_torrent ** torrents = getTorrents( handle, args_in, &torrentCount );
tr_benc * list = tr_bencDictAddList( args_out, "list", torrentCount ); tr_benc * list = tr_bencDictAddList( args_out, "list", torrentCount );
for( i=0; i<torrentCount; ++i ) { for( i=0; i<torrentCount; ++i )
{
tr_torrent * tor = torrents[i]; tr_torrent * tor = torrents[i];
const tr_stat * st = tr_torrentStat( tor ); const tr_stat * st = tr_torrentStat( tor );
tr_benc * d = tr_bencListAddDict( list, 7 ); tr_benc * d = tr_bencListAddDict( list, 15 );
tr_bencDictAddInt( d, "downloadedEver", st->downloadedEver );
tr_bencDictAddInt( d, "eta", st->eta );
tr_bencDictAddStr( d, "hashString", tor->info.hashString ); tr_bencDictAddStr( d, "hashString", tor->info.hashString );
tr_bencDictAddInt( d, "id", tr_torrentId( tor ) ); tr_bencDictAddInt( d, "id", tr_torrentId( tor ) );
tr_bencDictAddStr( d, "name", tor->info.name ); 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_bencDictAddDouble( d, "percentDone", st->percentDone );
tr_bencDictAddDouble( d, "rateDownload", st->rateDownload ); tr_bencDictAddDouble( d, "rateDownload", st->rateDownload );
tr_bencDictAddDouble( d, "rateUpload", st->rateUpload ); tr_bencDictAddDouble( d, "rateUpload", st->rateUpload );
tr_bencDictAddDouble( d, "ratio", st->ratio ); tr_bencDictAddDouble( d, "ratio", st->ratio );
tr_bencDictAddInt( d, "sizeWhenDone", st->sizeWhenDone );
tr_bencDictAddInt( d, "status", st->status ); tr_bencDictAddInt( d, "status", st->status );
tr_bencDictAddInt( d, "uploadedEver", st->uploadedEver );
} }
tr_free( torrents ); tr_free( torrents );