Changeset 7038
- Timestamp:
- Nov 4, 2008, 5:04:41 PM (12 years ago)
- Location:
- trunk/daemon
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/daemon/remote.c
r7006 r7038 443 443 tr_bencDictAddStr( &top, "method", "torrent-get" ); 444 444 tr_bencDictAddInt( &top, "tag", TAG_PEERS ); 445 addIdArg( args, id ); 445 446 fields = tr_bencDictAddList( args, "fields", 1 ); 446 447 tr_bencListAddStr( fields, "peers" ); … … 930 931 931 932 static void 932 printPeerList( tr_benc * top ) 933 { 934 tr_benc *args, *list; 935 936 if( ( tr_bencDictFindDict( top, "arguments", &args ) ) 937 && ( tr_bencDictFindList( args, "peers", &list ) ) ) 933 printPeersImpl( tr_benc * peers ) 934 { 935 int i, n; 936 printf( "%-20s %-12s %-6s %-6s %s\n", 937 "Address", "Flags", "Down", "Up", "Client" ); 938 for( i = 0, n = tr_bencListSize( peers ); i < n; ++i ) 939 { 940 const char * address, * client, * flagstr; 941 int64_t rateToClient, rateToPeer; 942 tr_benc * d = tr_bencListChild( peers, i ); 943 if( tr_bencDictFindStr( d, "address", &address ) 944 && tr_bencDictFindStr( d, "clientName", &client ) 945 && tr_bencDictFindStr( d, "flagStr", &flagstr ) 946 && tr_bencDictFindInt( d, "rateToClient", &rateToClient ) 947 && tr_bencDictFindInt( d, "rateToPeer", &rateToPeer ) ) 948 { 949 printf( "%-20s %-12s %6.1f %6.1f %s\n", 950 address, flagstr, 951 rateToClient / 1024.0, 952 rateToPeer / 1024.0, 953 client ); 954 } 955 } 956 } 957 958 static void 959 printPeers( tr_benc * top ) 960 { 961 tr_benc *args, *torrents; 962 963 if( tr_bencDictFindDict( top, "arguments", &args ) 964 && tr_bencDictFindList( args, "torrents", &torrents ) ) 938 965 { 939 966 int i, n; 940 printf( "%-20s %-12s %-5s %5s %s\n", 941 "Address", "Flags", "Down", "Up", "Client" ); 942 for( i = 0, n = tr_bencListSize( list ); i < n; ++i ) 943 { 944 const char * address, * client, * flagstr; 945 int64_t rateToClient, rateToPeer; 946 tr_benc * d = tr_bencListChild( list, i ); 947 if( tr_bencDictFindStr( d, "address", &address ) 948 && tr_bencDictFindStr( d, "client", &client ) 949 && tr_bencDictFindStr( d, "flagstr", &flagstr ) 950 && tr_bencDictFindInt( d, "rateToClient", &rateToClient ) 951 && tr_bencDictFindInt( d, "rateToPeer", &rateToPeer ) ) 952 { 953 printf( "%-20s %-12s %5.1f %5.1f %s\n", 954 address, flagstr, 955 rateToClient * 1024.0, 956 rateToPeer * 1024.0, 957 client ); 967 for( i=0, n=tr_bencListSize( torrents ); i<n; ++i ) 968 { 969 tr_benc * peers; 970 tr_benc * torrent = tr_bencListChild( torrents, i ); 971 if( tr_bencDictFindList( torrent, "peers", &peers ) ) { 972 printPeersImpl( peers ); 973 if( i+1<n ) 974 printf( "\n" ); 958 975 } 959 976 } … … 1047 1064 1048 1065 case TAG_PEERS: 1049 printPeer List( &top ); break;1066 printPeers( &top ); break; 1050 1067 1051 1068 default: … … 1092 1109 curl_easy_setopt( curl, CURLOPT_POSTFIELDS, reqs[i] ); 1093 1110 if( debug ) 1094 tr_ninf( MY_NAME, "posting [%s]\n", reqs[i] );1111 fprintf( stderr, "posting [%s]\n", reqs[i] ); 1095 1112 if( ( res = curl_easy_perform( curl ) ) ) 1096 1113 tr_nerr( MY_NAME, "(%s:%d) %s", host, port, -
trunk/daemon/transmission-remote.1
r6634 r7038 171 171 Disable peer exchange (PEX). 172 172 173 .It Fl xFl -peers173 .It Fl z Fl -peers 174 174 List the current torrent's connected peers. 175 175 In the `status' section of the list, the following shorthand is used: … … 221 221 Get detailed information on the torrent whose ID is '1': 222 222 .Bd -literal -offset indent 223 $ transmission-remote -t1 -i "223 $ transmission-remote -t1 -i 224 224 .Ed 225 225 226 226 Get a list of a torrent's files: 227 227 .Bd -literal -offset indent 228 $ transmission-remote -t1 -l "228 $ transmission-remote -t1 -l 229 229 .Ed 230 230 231 231 Download only its second and fourth files: 232 232 .Bd -literal -offset indent 233 $ transmission-remote -t1 -Gall -g2,4 "233 $ transmission-remote -t1 -Gall -g2,4 234 234 .Ed 235 235 236 236 Set all torrents' first two files' priorities to high: 237 237 .Bd -literal -offset indent 238 $ transmission-remote -tall -ph1,2 "238 $ transmission-remote -tall -ph1,2 239 239 .Ed 240 240 241 241 Set all torrents' files' priorities to normal: 242 242 .Bd -literal -offset indent 243 $ transmission-remote -tall -pnall "243 $ transmission-remote -tall -pnall 244 244 .Ed 245 245
Note: See TracChangeset
for help on using the changeset viewer.