show the dl speed of webseeds in the webseed table

This commit is contained in:
Mitchell Livingston 2008-06-10 01:49:09 +00:00
parent 61b41adf1a
commit aeb0a5704a
1 changed files with 20 additions and 2 deletions

View File

@ -1026,18 +1026,22 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
int webSeedCount = fInfo->webseedCount, i; int webSeedCount = fInfo->webseedCount, i;
NSMutableArray * webSeeds = [NSMutableArray arrayWithCapacity: webSeedCount]; NSMutableArray * webSeeds = [NSMutableArray arrayWithCapacity: webSeedCount];
float * dlSpeeds = tr_torrentWebSpeeds(fHandle);
for (i = 0; i < webSeedCount; i++) for (i = 0; i < webSeedCount; i++)
{ {
NSMutableDictionary * dict = [NSMutableDictionary dictionaryWithCapacity: 2]; NSMutableDictionary * dict = [NSMutableDictionary dictionaryWithCapacity: 2];
[dict setObject: [NSString stringWithUTF8String: fInfo->webseeds[i]] forKey: @"Address"]; [dict setObject: [NSString stringWithUTF8String: fInfo->webseeds[i]] forKey: @"Address"];
/*if (webSeeds->isDownloadingFrom) if (dlSpeeds[i] != -1)
[dict setObject: [NSNumber numberWithFloat: peer->downloadFromRate] forKey: @"DL From Rate"];*/ [dict setObject: [NSNumber numberWithFloat: dlSpeeds[i]] forKey: @"DL From Rate"];
[webSeeds addObject: dict]; [webSeeds addObject: dict];
} }
tr_free(dlSpeeds);
return webSeeds; return webSeeds;
} }
@ -1144,6 +1148,20 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
else else
string = [NSString stringWithFormat: NSLocalizedString(@"Downloading from %d of 1 peer", string = [NSString stringWithFormat: NSLocalizedString(@"Downloading from %d of 1 peer",
"Torrent -> status string"), [self peersSendingToUs]]; "Torrent -> status string"), [self peersSendingToUs]];
/*int webSeedCount = [self webSeedCount];
if (webSeedCount > 0)
{
NSString * webSeedString;
if (webSeedCount == 1)
webSeedString = NSLocalizedString(@"web seed", "Torrent -> status string");
else
webSeedString = [NSString stringWithFormat: NSLocalizedString(@"%d web seeds", "Torrent -> status string"),
webSeedCount];
string = [string stringByAppendingFormat: @" + %@", webSeedString];
}*/
break; break;
case TR_STATUS_SEED: case TR_STATUS_SEED: