Changeset 1132


Ignore:
Timestamp:
Nov 25, 2006, 6:56:15 AM (14 years ago)
Author:
livings124
Message:

show total amount downloaded, and have a minimum wait of a minute for scraping

Location:
branches/scrape
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/scrape/libtransmission/tracker.c

    r1131 r1132  
    4040    int            leechers;
    4141    int            hasManyPeers;
     42    int            downloaded;
    4243
    4344    uint64_t       dateTry;
     
    7778    tc->seeders  = -1;
    7879    tc->leechers = -1;
     80    tc->downloaded  = -1;
    7981
    8082    tc->lastAttempt = TC_ATTEMPT_NOREACH;
     
    151153
    152154    uint64_t now = tr_date();
    153     uint64_t interval = 1000 * tc->scrapeInterval;
     155    uint64_t interval = 1000 * MAX(tc->scrapeInterval, 60);
    154156   
    155157    // scrape half as often if there is no need to
     
    653655        return;
    654656    }
     657   
    655658    val2 = tr_bencDictFind( val1, "complete" );
    656659    if( !val2 )
     
    660663    }
    661664    tc->seeders = val2->val.i;
     665   
    662666    val2 = tr_bencDictFind( val1, "incomplete" );
    663667    if( !val2 )
     
    668672    tc->leechers = val2->val.i;
    669673   
     674    val2 = tr_bencDictFind( val1, "downloaded" );
     675    if( !val2 )
     676    {
     677        tr_bencFree( &scrape );
     678        return;
     679    }
     680    tc->downloaded = val2->val.i;
     681   
    670682    val2 = tr_bencDictFind( val1, "flags" );
    671683    if (val2)
     
    700712    return tc->leechers;
    701713}
     714
     715int tr_trackerDownloaded( tr_tracker_t * tc )
     716{
     717    if( !tc )
     718    {
     719        return -1;
     720    }
     721    return tc->downloaded;
     722}
  • branches/scrape/libtransmission/tracker.h

    r1127 r1132  
    3838 * tr_trackerSeeders
    3939 ***********************************************************************
    40  * Looks for the seeders/leechers as returned by the tracker.
     40 * Looks for the seeders as returned by the tracker.
    4141 **********************************************************************/
    42 int                        tr_trackerSeeders  ( tr_tracker_t * );
     42int tr_trackerSeeders  ( tr_tracker_t * );
    4343
    4444/***********************************************************************
    4545 * tr_trackerLeechers
    4646 ***********************************************************************
    47  * Looks for the seeders/leechers as returned by the tracker.
     47 * Looks for the leechers as returned by the tracker.
    4848 **********************************************************************/
    49 int                         tr_trackerLeechers ( tr_tracker_t * );
     49int tr_trackerLeechers ( tr_tracker_t * );
     50
     51/***********************************************************************
     52 * tr_trackerDownloaded
     53 ***********************************************************************
     54 * Looks for number of completed trackers as returned by the tracker
     55 * (from scrape).
     56 **********************************************************************/
     57int tr_trackerDownloaded( tr_tracker_t * tc );
    5058
    5159#endif
  • branches/scrape/libtransmission/transmission.c

    r1130 r1132  
    366366}
    367367
    368 /***********************************************************************
    369  * tr_torrentScrape
    370  **********************************************************************/
    371 /*int tr_torrentScrape( tr_torrent_t * tor, int * s, int * l )
    372 {
    373     return tr_trackerScrape( tor, s, l );
    374 }*/
    375 
    376368void tr_torrentSetFolder( tr_torrent_t * tor, const char * path )
    377369{
     
    540532    s->seeders  = tr_trackerSeeders(tor->tracker);
    541533    s->leechers = tr_trackerLeechers(tor->tracker);
     534    s->completedFromTracker = tr_trackerDownloaded(tor->tracker);
    542535
    543536    s->swarmspeed = tr_rcRate( tor->swarmspeed );
  • branches/scrape/libtransmission/transmission.h

    r1127 r1132  
    203203
    204204/***********************************************************************
    205  * tr_torrentScrape
    206  ***********************************************************************
    207  * Asks the tracker for the count of seeders and leechers. Returns 0
    208  * and fills 's' and 'l' if successful. Otherwise returns 1 if the
    209  * tracker doesn't support the scrape protocol, is unreachable or
    210  * replied with some error. tr_torrentScrape may block up to 20 seconds
    211  * before returning.
    212  **********************************************************************/
    213 //int tr_torrentScrape( tr_torrent_t *, int * s, int * l );
    214 
    215 /***********************************************************************
    216205 * tr_torrentStart
    217206 ***********************************************************************
     
    369358    int                 seeders;
    370359    int                 leechers;
     360    int                 completedFromTracker;
    371361
    372362    uint64_t            downloaded;
  • branches/scrape/macosx/English.lproj/InfoWindow.nib/classes.nib

    r1124 r1132  
    2020            OUTLETS = {
    2121                fCommentView = NSTextView;
     22                fCompletedFromTrackerField = NSTextField;
    2223                fConnectedPeersField = NSTextField;
    2324                fCreatorField = NSTextField;
  • branches/scrape/macosx/InfoWindowController.h

    r1124 r1132  
    5050    IBOutlet NSTableView * fPeerTable;
    5151    IBOutlet NSTextField * fSeedersField, * fLeechersField, * fConnectedPeersField,
    52                         * fDownloadingFromField, * fUploadingToField;
     52                        * fDownloadingFromField, * fUploadingToField, * fCompletedFromTrackerField;
    5353   
    5454    IBOutlet NSTableView * fFileTable;
  • branches/scrape/macosx/InfoWindowController.m

    r1125 r1132  
    182182        [fSeedersField setStringValue: @""];
    183183        [fLeechersField setStringValue: @""];
     184        [fCompletedFromTrackerField setStringValue: @""];
    184185        [fConnectedPeersField setStringValue: @""];
    185186        [fDownloadingFromField setStringValue: @""];
     
    327328    Torrent * torrent = [fTorrents objectAtIndex: 0];
    328329   
    329     int seeders = [torrent seeders], leechers = [torrent leechers];
     330    int seeders = [torrent seeders], leechers = [torrent leechers], downloaded = [torrent completedFromTracker];
    330331    [fSeedersField setStringValue: seeders < 0 ? @"" : [NSString stringWithInt: seeders]];
    331332    [fLeechersField setStringValue: leechers < 0 ? @"" : [NSString stringWithInt: leechers]];
     333    [fCompletedFromTrackerField setStringValue: downloaded < 0 ? @"" : [NSString stringWithInt: downloaded]];
    332334   
    333335    BOOL active = [torrent isActive];
  • branches/scrape/macosx/Torrent.h

    r1119 r1132  
    143143- (int) seeders;
    144144- (int) leechers;
     145- (int) completedFromTracker;
    145146- (int) totalPeers;
    146147- (int) totalPeersIncoming;
  • branches/scrape/macosx/Torrent.m

    r1119 r1132  
    884884}
    885885
     886- (int) completedFromTracker
     887{
     888    return fStat->completedFromTracker;
     889}
     890
    886891- (int) totalPeers
    887892{
Note: See TracChangeset for help on using the changeset viewer.