(trunk) remove tr_stats fields: downloaders, leechers, seeders, timesCompleted as per discussion with livings

This commit is contained in:
Charles Kerr 2009-09-26 06:20:33 +00:00
parent 34bfc1424c
commit 4a09a1de13
15 changed files with 7 additions and 202 deletions

View File

@ -321,7 +321,6 @@ static const char * details_keys[] = {
"haveValid",
"id",
"isPrivate",
"leechers",
"leftUntilDone",
"name",
"peersConnected",
@ -332,11 +331,9 @@ static const char * details_keys[] = {
"rateDownload",
"rateUpload",
"recheckProgress",
"seeders",
"sizeWhenDone",
"startDate",
"status",
"timesCompleted",
"totalSize",
"trackerStats",
"uploadedEver",

View File

@ -141,7 +141,6 @@
doneDate | number | tr_stat
downloadDir | string | tr_torrent
downloadedEver | number | tr_stat
downloaders | number | tr_stat
downloadLimit | number | tr_torrent
downloadLimited | boolean | tr_torrent
error | number | tr_stat
@ -155,7 +154,6 @@
honorsSessionLimits | boolean | tr_torrent
id | number | tr_torrent
isPrivate | boolean | tr_torrent
leechers | number | tr_stat
leftUntilDone | number | tr_stat
manualAnnounceTime | number | tr_stat
maxConnectedPeers | number | tr_torrent
@ -175,14 +173,12 @@
rateDownload (B/s) | number | tr_stat
rateUpload (B/s) | number | tr_stat
recheckProgress | double | tr_stat
seeders | number | tr_stat
seedRatioLimit | double | tr_torrent
seedRatioMode | number | tr_ratiolimit
sizeWhenDone | number | tr_stat
startDate | number | tr_stat
status | number | tr_stat
swarmSpeed (K/s) | number | tr_stat
timesCompleted | number | tr_stat
trackers | array (see below) | n/a
trackerStats | array (see below) | n/a
totalSize | number | tr_info
@ -555,12 +551,16 @@
------+---------+-----------+----------------+-------------------------------
7 | 1.80 | NO | torrent-get | removed arg "announceResponse"
| | NO | torrent-get | removed arg "announceURL"
| | NO | torrent-get | removed arg "downloaders"
| | NO | torrent-get | removed arg "lastAnnounceTime"
| | NO | torrent-get | removed arg "lastScrapeTime"
| | NO | torrent-get | removed arg "leechers"
| | NO | torrent-get | removed arg "nextAnnounceTime"
| | NO | torrent-get | removed arg "nextScrapeTime"
| | NO | torrent-get | removed arg "scrapeResponse"
| | NO | torrent-get | removed arg "scrapeURL"
| | NO | torrent-get | removed arg "seeders"
| | NO | torrent-get | removed arg "timesCompleted"
| | yes NO | torrent-get | new arg "trackerStats"

View File

@ -82,9 +82,6 @@ struct DetailsImpl
GHashTable * webseed_hash;
GtkListStore * peer_store;
GtkListStore * webseed_store;
GtkWidget * seeders_lb;
GtkWidget * leechers_lb;
GtkWidget * completed_lb;
GtkWidget * webseed_view;
GtkListStore * trackers;
@ -1341,35 +1338,6 @@ refreshWebseedList( struct DetailsImpl * di, tr_torrent ** torrents, int n )
static void
refreshPeers( struct DetailsImpl * di, tr_torrent ** torrents, int n )
{
int i;
char buf[512];
const char * none = _( "None" );
/* seeders_lb */
/* leechers_lb */
/* completed_lb */
if( n<=0 ) {
gtk_label_set_text( GTK_LABEL( di->seeders_lb ), none );
gtk_label_set_text( GTK_LABEL( di->leechers_lb ), none );
gtk_label_set_text( GTK_LABEL( di->completed_lb ), none );
} else {
int seeders = 0;
int leechers = 0;
int completed = 0;
for( i=0; i<n; ++i ) {
const tr_stat * s = tr_torrentStat( torrents[i] );
seeders = s->seeders;
leechers = s->leechers;
completed += s->timesCompleted;
}
g_snprintf( buf, sizeof( buf ), "%'d", seeders );
gtk_label_set_text( GTK_LABEL( di->seeders_lb ), buf );
g_snprintf( buf, sizeof( buf ), "%'d", leechers );
gtk_label_set_text( GTK_LABEL( di->leechers_lb ), buf );
g_snprintf( buf, sizeof( buf ), "%'d", completed );
gtk_label_set_text( GTK_LABEL( di->completed_lb ), buf );
}
refreshPeerList( di, torrents, n );
refreshWebseedList( di, torrents, n );
}
@ -1433,7 +1401,7 @@ peer_page_new( struct DetailsImpl * di )
guint i;
const char * str;
GtkListStore *store;
GtkWidget *v, *w, *ret, *sw, *l, *vbox, *hbox;
GtkWidget *v, *w, *ret, *sw, *vbox;
GtkWidget *webtree = NULL;
GtkTreeModel * m;
GtkTreeViewColumn * c;
@ -1596,28 +1564,6 @@ peer_page_new( struct DetailsImpl * di )
gtk_paned_pack2( GTK_PANED( v ), sw, TRUE, TRUE );
gtk_box_pack_start( GTK_BOX( vbox ), v, TRUE, TRUE, 0 );
hbox = gtk_hbox_new( FALSE, GUI_PAD );
l = gtk_label_new( NULL );
gtk_label_set_markup( GTK_LABEL( l ), _( "<b>Seeders:</b>" ) );
gtk_box_pack_start( GTK_BOX( hbox ), l, FALSE, FALSE, 0 );
l = di->seeders_lb = gtk_label_new( NULL );
gtk_box_pack_start( GTK_BOX( hbox ), l, FALSE, FALSE, 0 );
w = gtk_alignment_new( 0.0f, 0.0f, 0.0f, 0.0f );
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
l = gtk_label_new( NULL );
gtk_label_set_markup( GTK_LABEL( l ), _( "<b>Leechers:</b>" ) );
gtk_box_pack_start( GTK_BOX( hbox ), l, FALSE, FALSE, 0 );
l = di->leechers_lb = gtk_label_new( NULL );
gtk_box_pack_start( GTK_BOX( hbox ), l, FALSE, FALSE, 0 );
w = gtk_alignment_new( 0.0f, 0.0f, 0.0f, 0.0f );
gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 );
l = gtk_label_new( NULL );
gtk_label_set_markup( GTK_LABEL( l ), _( "<b>Times Completed:</b>" ) );
gtk_box_pack_start( GTK_BOX( hbox ), l, FALSE, FALSE, 0 );
l = di->completed_lb = gtk_label_new( NULL );
gtk_box_pack_start( GTK_BOX( hbox ), l, FALSE, FALSE, 0 );
gtk_box_pack_start( GTK_BOX( vbox ), hbox, FALSE, FALSE, 0 );
/* ip-to-GtkTreeRowReference */
di->peer_hash = g_hash_table_new_full( g_str_hash,
g_str_equal,

View File

@ -1574,40 +1574,6 @@ onUpkeepTimer( int foo UNUSED, short bar UNUSED, void * vannouncer )
****
***/
void
tr_announcerGetCounts( tr_torrent * torrent,
int * setme_completedCount,
int * setme_leecherCount,
int * setme_seederCount,
int * setme_downloaderCount )
{
int i;
int n;
int completed = 0;
int leechers = 0;
int seeders = 0;
int downloaders = 0;
/* count the trackers... */
for( i=0, n=tr_ptrArraySize( &torrent->tiers->tiers ); i<n; ++i )
{
const tr_tier * tier = tr_ptrArrayNth( &torrent->tiers->tiers, i );
if( tier->currentTracker )
{
seeders += tier->currentTracker->seederCount;
leechers += tier->currentTracker->leecherCount;
completed += tier->currentTracker->downloadCount;
downloaders += tier->currentTracker->downloaderCount;
}
}
if( setme_completedCount ) *setme_completedCount = completed;
if( setme_leecherCount ) *setme_leecherCount = leechers;
if( setme_seederCount ) *setme_seederCount = seeders;
if( setme_downloaderCount ) *setme_downloaderCount = downloaders;
}
tr_tracker_stat *
tr_announcerStats( const tr_torrent * torrent,
int * setmeTrackerCount )

View File

@ -88,12 +88,6 @@ void tr_announcerTorrentCompleted( tr_torrent * );
time_t tr_announcerNextManualAnnounce( const tr_torrent * );
void tr_announcerGetCounts( tr_torrent *,
int * setme_completedCount,
int * setme_leecherCount,
int * setme_seederCount,
int * setme_downloaderCount );
tr_tracker_stat * tr_announcerStats( const tr_torrent * torrent,
int * setmeTrackerCount );

View File

@ -470,8 +470,6 @@ addField( const tr_torrent * tor, tr_benc * d, const char * key )
tr_bencDictAddStr( d, key, tr_torrentGetDownloadDir( tor ) );
else if( tr_streq( key, keylen, "downloadedEver" ) )
tr_bencDictAddInt( d, key, st->downloadedEver );
else if( tr_streq( key, keylen, "downloaders" ) )
tr_bencDictAddInt( d, key, st->downloaders );
else if( tr_streq( key, keylen, "downloadLimit" ) )
tr_bencDictAddInt( d, key, tr_torrentGetSpeedLimit( tor, TR_DOWN ) );
else if( tr_streq( key, keylen, "downloadLimited" ) )
@ -498,8 +496,6 @@ addField( const tr_torrent * tor, tr_benc * d, const char * key )
tr_bencDictAddInt( d, key, st->id );
else if( tr_streq( key, keylen, "isPrivate" ) )
tr_bencDictAddBool( d, key, tr_torrentIsPrivate( tor ) );
else if( tr_streq( key, keylen, "leechers" ) )
tr_bencDictAddInt( d, key, st->leechers );
else if( tr_streq( key, keylen, "leftUntilDone" ) )
tr_bencDictAddInt( d, key, st->leftUntilDone );
else if( tr_streq( key, keylen, "manualAnnounceTime" ) )
@ -554,8 +550,6 @@ addField( const tr_torrent * tor, tr_benc * d, const char * key )
tr_bencDictAddInt( d, key, (int)( st->pieceUploadSpeed * 1024 ) );
else if( tr_streq( key, keylen, "recheckProgress" ) )
tr_bencDictAddReal( d, key, st->recheckProgress );
else if( tr_streq( key, keylen, "seeders" ) )
tr_bencDictAddInt( d, key, st->seeders );
else if( tr_streq( key, keylen, "seedRatioLimit" ) )
tr_bencDictAddReal( d, key, tr_torrentGetRatioLimit( tor ) );
else if( tr_streq( key, keylen, "seedRatioMode" ) )
@ -568,8 +562,6 @@ addField( const tr_torrent * tor, tr_benc * d, const char * key )
tr_bencDictAddInt( d, key, st->activity );
else if( tr_streq( key, keylen, "swarmSpeed" ) )
tr_bencDictAddInt( d, key, (int)( st->swarmSpeed * 1024 ) );
else if( tr_streq( key, keylen, "timesCompleted" ) )
tr_bencDictAddInt( d, key, st->timesCompleted );
else if( tr_streq( key, keylen, "trackers" ) )
addTrackers( inf, tr_bencDictAddList( d, key, inf->trackerCount ) );
else if( tr_streq( key, keylen, "trackerStats" ) ) {

View File

@ -890,11 +890,6 @@ tr_torrentStat( tr_torrent * tor )
s->manualAnnounceTime = tr_announcerNextManualAnnounce( tor );
tr_announcerGetCounts( tor, &s->timesCompleted,
&s->leechers,
&s->seeders,
&s->downloaders );
tr_peerMgrTorrentStats( tor,
&s->peersKnown,
&s->peersConnected,

View File

@ -1570,20 +1570,6 @@ typedef struct tr_stat
/** Number of webseeds that are sending data to us. */
int webseedsSendingToUs;
/** Number of seeders that the tracker says this torrent has */
int seeders;
/** Number of leechers that the tracker says this torrent has */
int leechers;
/** Number of downloaders that the tracker says this torrent has.
This is a new key introduced in BEP 21 and may not be supported by some trackers.
If the tracker doesn't support this key, the value here will be -1. */
int downloaders;
/** Number of finished downloads that the tracker says torrent has */
int timesCompleted;
/** Byte count of all the piece data we'll have downloaded when we're done,
whether or not we have it yet. This may be less than tr_info.totalSize
if only some of the torrent's files are wanted.

View File

@ -211,7 +211,6 @@ Details :: onTorrentChanged( )
void
Details :: refresh( )
{
int i;
QLocale locale;
const int n = myIds.size( );
const bool single = n == 1;
@ -678,18 +677,6 @@ Details :: refresh( )
/// Peers tab
///
i = 0;
foreach( const Torrent * t, torrents ) i += t->seeders( );
mySeedersLabel->setText( locale.toString( i ) );
i = 0;
foreach( const Torrent * t, torrents ) i += t->leechers( );
myLeechersLabel->setText( locale.toString( i ) );
i = 0;
foreach( const Torrent * t, torrents ) i += t->timesCompleted( );
myTimesCompletedLabel->setText( locale.toString( i ) );
QMap<QString,QTreeWidgetItem*> peers2;
QList<QTreeWidgetItem*> newItems;
foreach( const Torrent * t, torrents )
@ -1050,30 +1037,6 @@ Details :: createPeersTab( )
myPeerTree->setColumnWidth( COL_CLIENT, size.width( ) );
myPeerTree->setAlternatingRowColors( true );
QHBoxLayout * h = new QHBoxLayout;
h->setSpacing( HIG :: PAD );
v->addLayout( h );
QLabel * l = new QLabel( "Seeders:" );
l->setStyleSheet( "font: bold" );
h->addWidget( l );
l = mySeedersLabel = new QLabel( "a" );
h->addWidget( l );
h->addStretch( 1 );
l = new QLabel( "Leechers:" );
l->setStyleSheet( "font: bold" );
h->addWidget( l );
l = myLeechersLabel = new QLabel( "b" );
h->addWidget( l );
h->addStretch( 1 );
l = new QLabel( "Times Completed:" );
l->setStyleSheet( "font: bold" );
h->addWidget( l );
l = myTimesCompletedLabel = new QLabel( "c" );
h->addWidget( l );
return top;
}

View File

@ -106,9 +106,6 @@ class Details: public QDialog
QLabel * myAnnounceResponseLabel;
QLabel * myAnnounceManualLabel;
QLabel * mySeedersLabel;
QLabel * myLeechersLabel;
QLabel * myTimesCompletedLabel;
QTreeWidget * myPeerTree;
QMap<QString,QTreeWidgetItem*> myPeers;
QWidgetList myWidgets;

View File

@ -105,9 +105,6 @@ Torrent :: myProperties[] =
{ SCRAPE_RESPONSE, "scrapeResponse", QVariant::String, STAT_EXTRA },
{ ANNOUNCE_RESPONSE, "announceResponse", QVariant::String, STAT_EXTRA },
{ ANNOUNCE_URL, "announceURL", QVariant::String, STAT_EXTRA },
{ SEEDERS, "seeders", QVariant::Int, STAT_EXTRA },
{ LEECHERS, "leechers", QVariant::Int, STAT_EXTRA },
{ TIMES_COMPLETED, "timesCompleted", QVariant::Int, STAT_EXTRA },
{ PEERS, "peers", TrTypes::PeerList, STAT_EXTRA },
{ TORRENT_FILE, "torrentFile", QVariant::String, STAT_EXTRA },
{ BANDWIDTH_PRIORITY, "bandwidthPriority", QVariant::Int, STAT_EXTRA }

View File

@ -135,9 +135,6 @@ class Torrent: public QObject
SCRAPE_RESPONSE,
ANNOUNCE_RESPONSE,
ANNOUNCE_URL,
SEEDERS,
LEECHERS,
TIMES_COMPLETED,
PEERS,
TORRENT_FILE,
BANDWIDTH_PRIORITY,
@ -266,9 +263,6 @@ class Torrent: public QObject
int peerLimit( ) const { return getInt( PEER_LIMIT ); }
double seedRatioLimit( ) const { return getDouble( SEED_RATIO_LIMIT ); }
tr_ratiolimit seedRatioMode( ) const { return (tr_ratiolimit) getInt( SEED_RATIO_MODE ); }
int seeders() const { return getInt( SEEDERS ); }
int leechers() const { return getInt( LEECHERS ); }
int timesCompleted() const { return getInt( TIMES_COMPLETED ); }
PeerList peers( ) const{ return myValues[PEERS].value<PeerList>(); }
const FileList& files( ) const { return myFiles; }

View File

@ -174,14 +174,6 @@
<div class="inspector_label">DL From:</div>
<div id="torrent_inspector_download_from">N/A</div>
</div>
<div class="inspector_row">
<div class="inspector_label">Total Seeders:</div>
<div id="torrent_inspector_total_seeders">N/A</div>
</div>
<div class="inspector_row">
<div class="inspector_label">Total Leechers:</div>
<div id="torrent_inspector_total_leechers">N/A</div>
</div>
</div><!-- class="inspector_group"-->
</div><!-- id="inspector_tab_activity_container" -->

View File

@ -30,9 +30,9 @@ Torrent._ErrLocalError = 3;
Torrent._StaticFields = [ 'addedDate', 'announceURL', 'comment', 'creator',
'dateCreated', 'hashString', 'id', 'isPrivate', 'name', 'totalSize' ]
Torrent._DynamicFields = [ 'downloadedEver', 'error', 'errorString', 'eta',
'haveUnchecked', 'haveValid', 'leechers', 'leftUntilDone', 'peersConnected',
'haveUnchecked', 'haveValid', 'leftUntilDone', 'peersConnected',
'peersGettingFromUs', 'peersSendingToUs', 'rateDownload', 'rateUpload',
'recheckProgress', 'seeders', 'sizeWhenDone', 'status', 'swarmSpeed',
'recheckProgress', 'sizeWhenDone', 'status', 'swarmSpeed',
'uploadedEver', 'uploadRatio', 'seedRatioLimit', 'seedRatioMode', 'downloadDir' ]
Torrent.prototype =
@ -206,8 +206,6 @@ Torrent.prototype =
}
},
swarmSpeed: function() { return this._swarm_speed; },
totalLeechers: function() { return this._total_leechers; },
totalSeeders: function() { return this._total_seeders; },
uploadSpeed: function() { return this._upload_speed; },
uploadTotal: function() { return this._upload_total; },
showFileList: function() {
@ -332,8 +330,6 @@ Torrent.prototype =
this._error_string = data.errorString;
this._eta = data.eta;
this._swarm_speed = data.swarmSpeed;
this._total_leechers = Math.max( 0, data.leechers );
this._total_seeders = Math.max( 0, data.seeders );
this._state = data.status;
this._download_dir = data.downloadDir;

View File

@ -98,8 +98,6 @@ Transmission.prototype =
this._inspector._info_tab.size = $(ti+'size')[0];
this._inspector._info_tab.state = $(ti+'state')[0];
this._inspector._info_tab.swarm_speed = $(ti+'swarm_speed')[0];
this._inspector._info_tab.total_leechers = $(ti+'total_leechers')[0];
this._inspector._info_tab.total_seeders = $(ti+'total_seeders')[0];
this._inspector._info_tab.tracker = $(ti+'tracker')[0];
this._inspector._info_tab.uploaded = $(ti+'uploaded')[0];
this._inspector._info_tab.upload_speed = $(ti+'upload_speed')[0];
@ -936,9 +934,7 @@ Transmission.prototype =
var total_download_peers = 0;
var total_download_speed = 0;
var total_have = 0;
var total_leechers = 0;
var total_size = 0;
var total_seeders = 0;
var total_state = null;
var total_swarm_speed = 0;
var total_tracker = null;
@ -963,8 +959,6 @@ Transmission.prototype =
setInnerHTML( tab.uploaded, na );
setInnerHTML( tab.downloaded, na );
setInnerHTML( tab.ratio, na );
setInnerHTML( tab.total_seeders, na );
setInnerHTML( tab.total_leechers, na );
setInnerHTML( tab.swarm_speed, na );
setInnerHTML( tab.have, na );
setInnerHTML( tab.upload_to, na );
@ -1011,8 +1005,6 @@ Transmission.prototype =
total_download += t.downloadTotal();
total_upload_speed += t.uploadSpeed();
total_download_speed += t.downloadSpeed();
total_seeders += t.totalSeeders();
total_leechers += t.totalLeechers();
total_upload_peers += t.peersGettingFromUs();
total_download_peers += t.peersSendingToUs();
total_swarm_speed += t.swarmSpeed();
@ -1046,8 +1038,6 @@ Transmission.prototype =
setInnerHTML( tab.uploaded, torrents.length ? Math.formatBytes( total_upload ) : na );
setInnerHTML( tab.downloaded, torrents.length ? Math.formatBytes( total_download ) : na );
setInnerHTML( tab.ratio, torrents.length ? Math.ratio( total_upload, total_download ) : na );
setInnerHTML( tab.total_seeders, torrents.length ? total_seeders : na );
setInnerHTML( tab.total_leechers, torrents.length ? total_leechers : na );
setInnerHTML( tab.swarm_speed, torrents.length ? Math.formatBytes(total_swarm_speed) + '/s' : na );
setInnerHTML( tab.have, torrents.length ? Math.formatBytes(total_completed) + ' (' + Math.formatBytes(total_verified) + ' verified)' : na );
setInnerHTML( tab.upload_to, torrents.length ? total_upload_peers : na );