(daemon) in remote's "info" feature, separate "progress" into "recheck progress" and "download progress".

This commit is contained in:
Charles Kerr 2008-07-10 17:19:43 +00:00
parent e7d0da55c4
commit ba80e4c2d0
1 changed files with 22 additions and 6 deletions

View File

@ -369,6 +369,13 @@ torrentStatusToString( int i )
} }
} }
static int
isVerifying( int status )
{
return ( ( status == TR_STATUS_CHECK_WAIT ) ||
( status == TR_STATUS_CHECK ) );
}
static void static void
printDetails( tr_benc * top ) printDetails( tr_benc * top )
{ {
@ -397,7 +404,21 @@ printDetails( tr_benc * top )
printf( "TRANSFER\n" ); printf( "TRANSFER\n" );
if( tr_bencDictFindInt( t, "status", &i ) ) if( tr_bencDictFindInt( t, "status", &i ) )
{
printf( " State: %s\n", torrentStatusToString( i ) ); printf( " State: %s\n", torrentStatusToString( i ) );
if( isVerifying( i ) &&
tr_bencDictFindStr( t, "recheckProgress", &str ) )
printf( " Verified Progress: %.2f%%\n", atof(str) );
}
if( tr_bencDictFindInt( t, "sizeWhenDone", &i ) &&
tr_bencDictFindInt( t, "leftUntilDone", &j ) )
{
strlratio( buf, (i-j), i, sizeof( buf ) );
printf( " Download Progress: %s%%\n", buf );
}
if( tr_bencDictFindInt( t, "eta", &i ) ) { if( tr_bencDictFindInt( t, "eta", &i ) ) {
etaToString( buf, sizeof( buf ), i ); etaToString( buf, sizeof( buf ), i );
printf( " ETA: %s\n", buf ); printf( " ETA: %s\n", buf );
@ -413,12 +434,7 @@ printDetails( tr_benc * top )
strlsize( buf2, j, sizeof( buf2 ) ); strlsize( buf2, j, sizeof( buf2 ) );
printf( " Have: %s (%s verified)\n", buf, buf2 ); printf( " Have: %s (%s verified)\n", buf, buf2 );
} }
if( tr_bencDictFindInt( t, "sizeWhenDone", &i ) &&
tr_bencDictFindInt( t, "leftUntilDone", &j ) )
{
strlratio( buf, (i-j), i, sizeof( buf ) );
printf( " Progress: %s%%\n", buf );
}
if( tr_bencDictFindInt( t, "sizeWhenDone", &i ) && if( tr_bencDictFindInt( t, "sizeWhenDone", &i ) &&
tr_bencDictFindInt( t, "totalSize", &j ) ) tr_bencDictFindInt( t, "totalSize", &j ) )
{ {