mirror of
https://github.com/transmission/transmission
synced 2025-02-02 20:43:51 +00:00
(trunk daemon) #1819: indicate torrent error in transmission-remote -l
This commit is contained in:
parent
f404fcb4f9
commit
dfa9f075a4
1 changed files with 24 additions and 17 deletions
|
@ -272,6 +272,7 @@ static const char * details_keys[] = {
|
|||
};
|
||||
|
||||
static const char * list_keys[] = {
|
||||
"errorString",
|
||||
"eta",
|
||||
"id",
|
||||
"leftUntilDone",
|
||||
|
@ -749,23 +750,29 @@ getStatusString( tr_benc * t, char * buf, size_t buflen )
|
|||
|
||||
case TR_STATUS_DOWNLOAD:
|
||||
case TR_STATUS_SEED: {
|
||||
int64_t fromUs = 0;
|
||||
int64_t toUs = 0;
|
||||
tr_bencDictFindInt( t, "peersGettingFromUs", &fromUs );
|
||||
tr_bencDictFindInt( t, "peersSendingToUs", &toUs );
|
||||
if( fromUs && toUs )
|
||||
tr_strlcpy( buf, "Up & Down", buflen );
|
||||
else if( toUs )
|
||||
tr_strlcpy( buf, "Downloading", buflen );
|
||||
else if( fromUs ) {
|
||||
int64_t leftUntilDone = 0;
|
||||
tr_bencDictFindInt( t, "leftUntilDone", &leftUntilDone );
|
||||
if( leftUntilDone > 0 )
|
||||
tr_strlcpy( buf, "Uploading", buflen );
|
||||
else
|
||||
tr_strlcpy( buf, "Seeding", buflen );
|
||||
} else
|
||||
tr_strlcpy( buf, "Idle", buflen );
|
||||
const char * err = NULL;
|
||||
if( tr_bencDictFindStr( t, "errorString", &err ) )
|
||||
tr_strlcpy( buf, err, buflen );
|
||||
else {
|
||||
int64_t fromUs = 0;
|
||||
int64_t toUs = 0;
|
||||
tr_bencDictFindInt( t, "peersGettingFromUs", &fromUs );
|
||||
tr_bencDictFindInt( t, "peersSendingToUs", &toUs );
|
||||
if( !fromUs && !toUs )
|
||||
tr_strlcpy( buf, "Idle", buflen );
|
||||
else if( fromUs && toUs )
|
||||
tr_strlcpy( buf, "Up & Down", buflen );
|
||||
else if( toUs )
|
||||
tr_strlcpy( buf, "Downloading", buflen );
|
||||
else if( fromUs ) {
|
||||
int64_t leftUntilDone = 0;
|
||||
tr_bencDictFindInt( t, "leftUntilDone", &leftUntilDone );
|
||||
if( leftUntilDone > 0 )
|
||||
tr_strlcpy( buf, "Uploading", buflen );
|
||||
else
|
||||
tr_strlcpy( buf, "Seeding", buflen );
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue