diff --git a/daemon/remote.c b/daemon/remote.c index 389e28920..9957ef893 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -267,6 +267,7 @@ static const char * details_keys[] = { "timesCompleted", "totalSize", "uploadedEver", + "pieces", "webseeds", "webseedsSendingToUs" }; @@ -847,6 +848,8 @@ printDetails( tr_benc * top ) { tr_benc * t = tr_bencListChild( torrents, ti ); tr_benc * l; + const uint8_t * raw; + size_t rawlen; const char * str; char buf[512]; char buf2[512]; @@ -1006,6 +1009,23 @@ printDetails( tr_benc * top ) printf( " Piece Count: %" PRId64 "\n", i ); if( tr_bencDictFindInt( t, "pieceSize", &i ) ) printf( " Piece Size: %" PRId64 "\n", i ); + printf( "\n" ); + + printf("PIECES\n "); + if( tr_bencDictFindRaw( t, "pieces", &raw, &rawlen ) && tr_bencDictFindInt( t, "pieceCount", &j ) ) { + int len; + char * str = tr_base64_decode( raw, rawlen, &len ); + for( i=k=0; kpeersKnown ); else if( !strcmp( key, "peersSendingToUs" ) ) tr_bencDictAddInt( d, key, st->peersSendingToUs ); + else if( !strcmp( key, "pieces" ) ) { + const tr_bitfield * pieces = tr_cpPieceBitfield( &tor->completion ); + char * str = tr_base64_encode( pieces->bits, pieces->byteCount, NULL ); + tr_bencDictAddStr( d, key, str ); + tr_free( str ); + } else if( !strcmp( key, "pieceCount" ) ) tr_bencDictAddInt( d, key, inf->pieceCount ); else if( !strcmp( key, "pieceSize" ) )