case 'z':
tr_bencDictAddStr( &top, "method", "torrent-get" );
tr_bencDictAddInt( &top, "tag", TAG_PEERS );
+ addIdArg( args, id );
fields = tr_bencDictAddList( args, "fields", 1 );
tr_bencListAddStr( fields, "peers" );
break;
}
static void
-printPeerList( tr_benc * top )
+printPeersImpl( tr_benc * peers )
{
- tr_benc *args, *list;
+ int i, n;
+ printf( "%-20s %-12s %-6s %-6s %s\n",
+ "Address", "Flags", "Down", "Up", "Client" );
+ for( i = 0, n = tr_bencListSize( peers ); i < n; ++i )
+ {
+ const char * address, * client, * flagstr;
+ int64_t rateToClient, rateToPeer;
+ tr_benc * d = tr_bencListChild( peers, i );
+ if( tr_bencDictFindStr( d, "address", &address )
+ && tr_bencDictFindStr( d, "clientName", &client )
+ && tr_bencDictFindStr( d, "flagStr", &flagstr )
+ && tr_bencDictFindInt( d, "rateToClient", &rateToClient )
+ && tr_bencDictFindInt( d, "rateToPeer", &rateToPeer ) )
+ {
+ printf( "%-20s %-12s %6.1f %6.1f %s\n",
+ address, flagstr,
+ rateToClient / 1024.0,
+ rateToPeer / 1024.0,
+ client );
+ }
+ }
+}
- if( ( tr_bencDictFindDict( top, "arguments", &args ) )
- && ( tr_bencDictFindList( args, "peers", &list ) ) )
+static void
+printPeers( tr_benc * top )
+{
+ tr_benc *args, *torrents;
+
+ if( tr_bencDictFindDict( top, "arguments", &args )
+ && tr_bencDictFindList( args, "torrents", &torrents ) )
{
int i, n;
- printf( "%-20s %-12s %-5s %5s %s\n",
- "Address", "Flags", "Down", "Up", "Client" );
- for( i = 0, n = tr_bencListSize( list ); i < n; ++i )
+ for( i=0, n=tr_bencListSize( torrents ); i<n; ++i )
{
- const char * address, * client, * flagstr;
- int64_t rateToClient, rateToPeer;
- tr_benc * d = tr_bencListChild( list, i );
- if( tr_bencDictFindStr( d, "address", &address )
- && tr_bencDictFindStr( d, "client", &client )
- && tr_bencDictFindStr( d, "flagstr", &flagstr )
- && tr_bencDictFindInt( d, "rateToClient", &rateToClient )
- && tr_bencDictFindInt( d, "rateToPeer", &rateToPeer ) )
- {
- printf( "%-20s %-12s %5.1f %5.1f %s\n",
- address, flagstr,
- rateToClient * 1024.0,
- rateToPeer * 1024.0,
- client );
+ tr_benc * peers;
+ tr_benc * torrent = tr_bencListChild( torrents, i );
+ if( tr_bencDictFindList( torrent, "peers", &peers ) ) {
+ printPeersImpl( peers );
+ if( i+1<n )
+ printf( "\n" );
}
}
}
printTorrentList( &top ); break;
case TAG_PEERS:
- printPeerList( &top ); break;
+ printPeers( &top ); break;
default:
if( tr_bencDictFindStr( &top, "result", &str ) )
CURLcode res;
curl_easy_setopt( curl, CURLOPT_POSTFIELDS, reqs[i] );
if( debug )
- tr_ninf( MY_NAME, "posting [%s]\n", reqs[i] );
+ fprintf( stderr, "posting [%s]\n", reqs[i] );
if( ( res = curl_easy_perform( curl ) ) )
tr_nerr( MY_NAME, "(%s:%d) %s", host, port,
curl_easy_strerror( res ) );
.It Fl X Fl -no-pex
Disable peer exchange (PEX).
-.It Fl x Fl -peers
+.It Fl z Fl -peers
List the current torrent's connected peers.
In the `status' section of the list, the following shorthand is used:
.D1 D: Downloading from this peer
Get detailed information on the torrent whose ID is '1':
.Bd -literal -offset indent
-$ transmission-remote -t1 -i"
+$ transmission-remote -t1 -i
.Ed
Get a list of a torrent's files:
.Bd -literal -offset indent
-$ transmission-remote -t1 -l"
+$ transmission-remote -t1 -l
.Ed
Download only its second and fourth files:
.Bd -literal -offset indent
-$ transmission-remote -t1 -Gall -g2,4"
+$ transmission-remote -t1 -Gall -g2,4
.Ed
Set all torrents' first two files' priorities to high:
.Bd -literal -offset indent
-$ transmission-remote -tall -ph1,2"
+$ transmission-remote -tall -ph1,2
.Ed
Set all torrents' files' priorities to normal:
.Bd -literal -offset indent
-$ transmission-remote -tall -pnall"
+$ transmission-remote -tall -pnall
.Ed
.Sh AUTHORS