Changeset 10437


Ignore:
Timestamp:
Apr 2, 2010, 5:57:25 PM (11 years ago)
Author:
livings124
Message:

#1869 Move the finished state to libtransmission. This setting is now remembered between launches. This also causes torrents that hit the seed ratio to not have this setting changed to unlimited until start.

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/rpc-spec.txt

    r10391 r10437  
    154154   honorsSessionLimits         | boolean                     | tr_torrent
    155155   id                          | number                      | tr_torrent
     156   isFinished                  | boolean                     | tr_stat
    156157   isPrivate                   | boolean                     | tr_torrent
    157158   leftUntilDone               | number                      | tr_stat
     
    591592   9     | 2.00    | yes       | session-set    | new arg "start-added-torrents"
    592593         | 2.00    | yes       | session-set    | new arg "trash-original-torrent-files"
    593          | 2.00    | yes       | session-get    | new arg "start-added-torrents"
    594          | 2.00    | yes       | session-get    | new arg "trash-original-torrent-files"
     594         | 2.00    | yes       | torrent-get    | new arg "isFinished"
  • trunk/libtransmission/rpcimpl.c

    r10391 r10437  
    3030#include "version.h"
    3131#include "web.h"
     32
     33#define RPC_VERSION     9
     34#define RPC_VERSION_MIN 1
    3235
    3336#define RECENTLY_ACTIVE_SECONDS 60
     
    503506    else if( tr_streq( key, keylen, "id" ) )
    504507        tr_bencDictAddInt( d, key, st->id );
     508    else if( tr_streq( key, keylen, "isFinished" ) )
     509        tr_bencDictAddBool( d, key, st->finished );
    505510    else if( tr_streq( key, keylen, "isPrivate" ) )
    506511        tr_bencDictAddBool( d, key, tr_torrentIsPrivate( tor ) );
     
    13071312    tr_bencDictAddBool( d, TR_PREFS_KEY_PORT_FORWARDING, tr_sessionIsPortForwardingEnabled( s ) );
    13081313    tr_bencDictAddBool( d, TR_PREFS_KEY_RENAME_PARTIAL_FILES, tr_sessionIsIncompleteFileNamingEnabled( s ) );
    1309     tr_bencDictAddInt ( d, "rpc-version", 8 );
    1310     tr_bencDictAddInt ( d, "rpc-version-minimum", 1 );
     1314    tr_bencDictAddInt ( d, "rpc-version", RPC_VERSION );
     1315    tr_bencDictAddInt ( d, "rpc-version-minimum", RPC_VERSION_MIN );
    13111316    tr_bencDictAddReal( d, "seedRatioLimit", tr_sessionGetRatioLimit( s ) );
    13121317    tr_bencDictAddBool( d, "seedRatioLimited", tr_sessionIsRatioLimited( s ) );
  • trunk/libtransmission/torrent.c

    r10414 r10437  
    10531053    }
    10541054
     1055    s->finished = s->percentDone == 1.0 && checkSeedRatio && (s->ratio >= seedRatio || s->ratio == TR_RATIO_INF);
     1056
    10551057    if( !checkSeedRatio || s->ratio >= seedRatio || s->ratio == TR_RATIO_INF )
    10561058        s->percentRatio = 1.0;
     
    13761378    if( !tor->isRunning )
    13771379    {
     1380        /* allow finished torrents to be resumed */
     1381        if( tor->stats.finished )
     1382            tr_torrentSetRatioMode( tor, TR_RATIOLIMIT_UNLIMITED );
     1383
    13781384        tr_verifyRemove( tor );
    13791385
     
    26162622            tr_torrentStop( tor );
    26172623
    2618             /* set to no ratio limit to allow easy restarting */
    2619             tr_torrentSetRatioMode( tor, TR_RATIOLIMIT_UNLIMITED );
    2620 
    26212624            /* maybe notify the client */
    26222625            if( tor->ratio_limit_hit_func != NULL )
  • trunk/libtransmission/transmission.h

    r10391 r10437  
    18221822    /** The last time we uploaded or downloaded piece data on this torrent. */
    18231823    time_t    activityDate;
     1824   
     1825    /** A torrent is considered finished if it has met its seed ratio.
     1826        As a result, only paused torrent can be finished. */
     1827    tr_bool   finished;
    18241828}
    18251829tr_stat;
  • trunk/macosx/Torrent.h

    r10212 r10437  
    4848    NSDate * fPreviousFinishedIndexesDate;
    4949   
    50     BOOL fFinishedSeeding, fWaitToStart, fStalled;
     50    BOOL fWaitToStart, fStalled;
    5151   
    5252    NSInteger fGroupValue;
     
    162162- (BOOL) allDownloaded;
    163163- (BOOL) isComplete;
     164- (BOOL) isFinishedSeeding;
    164165- (BOOL) isError;
    165166- (BOOL) isAnyErrorOrWarning;
  • trunk/macosx/Torrent.m

    r10255 r10437  
    284284{
    285285    fWaitToStart = NO;
    286     fFinishedSeeding = NO;
    287286   
    288287    if (![self isActive] && [self alertForRemainingDiskSpace])
     
    822821}
    823822
     823- (BOOL) isFinishedSeeding
     824{
     825    return fStat->finished;
     826}
     827
    824828- (BOOL) isError
    825829{
     
    987991        {
    988992            case TR_STAT_LOCAL_ERROR: string = NSLocalizedString(@"Error", "Torrent -> status string"); break;
    989             case TR_STAT_TRACKER_ERROR: string = NSLocalizedString(@"Tracker returned an error", "Torrent -> status string"); break;
    990             case TR_STAT_TRACKER_WARNING: string = NSLocalizedString(@"Tracker returned a warning", "Torrent -> status string"); break;
     993            case TR_STAT_TRACKER_ERROR: string = NSLocalizedString(@"Tracker returned error", "Torrent -> status string"); break;
     994            case TR_STAT_TRACKER_WARNING: string = NSLocalizedString(@"Tracker returned warning", "Torrent -> status string"); break;
    991995            default: NSAssert(NO, @"unknown error state");
    992996        }
     
    10071011                            : [NSLocalizedString(@"Waiting to seed", "Torrent -> status string") stringByAppendingEllipsis];
    10081012                }
    1009                 else if (fFinishedSeeding)
     1013                else if ([self isFinishedSeeding])
    10101014                    string = NSLocalizedString(@"Seeding complete", "Torrent -> status string");
    10111015                else
     
    10861090                        : [NSLocalizedString(@"Waiting to seed", "Torrent -> status string") stringByAppendingEllipsis];
    10871091            }
    1088             else if (fFinishedSeeding)
     1092            else if ([self isFinishedSeeding])
    10891093                string = NSLocalizedString(@"Seeding complete", "Torrent -> status string");
    10901094            else
     
    15901594   
    15911595    fHashString = [[NSString alloc] initWithUTF8String: fInfo->hashString];
    1592        
    1593     fFinishedSeeding = NO;
    15941596   
    15951597    fWaitToStart = waitToStart && [waitToStart boolValue];
     
    17401742   
    17411743    [[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentStoppedForRatio" object: self];
    1742    
    1743     fFinishedSeeding = YES;
    17441744}
    17451745
  • trunk/macosx/TorrentCell.m

    r10432 r10437  
    652652    if ([NSApp isOnSnowLeopardOrBetter])
    653653        [bitmap drawInRect: barRect fromRect: NSZeroRect operation: NSCompositeSourceOver
    654             fraction: ([fDefaults boolForKey: @"SmallView"] ? 0.125 : 1.0) respectFlipped: YES hints: nil];
     654            fraction: ([fDefaults boolForKey: @"SmallView"] ? 0.2 : 1.0) respectFlipped: YES hints: nil];
    655655    else
    656656        [bitmap drawInRect: barRect];
  • trunk/web/javascript/torrent.js

    r10375 r10437  
    4343    'peersGettingFromUs', 'peersSendingToUs', 'rateDownload', 'rateUpload',
    4444    'recheckProgress', 'sizeWhenDone', 'status', 'trackerStats',
    45     'uploadedEver', 'uploadRatio', 'seedRatioLimit', 'seedRatioMode', 'downloadDir' ]
     45    'uploadedEver', 'uploadRatio', 'seedRatioLimit', 'seedRatioMode', 'downloadDir', 'isFinished' ]
    4646
    4747Torrent.prototype =
     
    244244                        case Torrent._StatusSeeding:        return 'Seeding';
    245245                        case Torrent._StatusDownloading:    return 'Downloading';
    246                         case Torrent._StatusPaused:         return 'Paused';
     246                        case Torrent._StatusPaused:         return this._isFinishedSeeding ? 'Seeding complete'
     247                                                                               : 'Paused';
    247248                        case Torrent._StatusChecking:       return 'Verifying local data';
    248249                        case Torrent._StatusWaitingToCheck: return 'Waiting to verify';
     
    392393                this._download_dir            = data.downloadDir;
    393394                this._metadataPercentComplete = data.metadataPercentComplete;
     395                this._isFinishedSeeding       = data.isFinished;
    394396
    395397                if (data.fileStats)
Note: See TracChangeset for help on using the changeset viewer.