Changeset 1048 for trunk/macosx


Ignore:
Timestamp:
Oct 31, 2006, 9:21:47 PM (15 years ago)
Author:
livings124
Message:

only create temporary torrent if import failed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r1047 r1048  
    510510    NSString * torrentPath;
    511511    Torrent * torrent;
     512   
     513    //determine next file that can be opened
    512514    do
    513515    {
     
    15701572        if ([[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame)
    15711573        {
    1572             int error;
    1573             tr_torrent_t * tempTor = tr_torrentInit(fLib, [[path stringByAppendingPathComponent: file] UTF8String],
    1574                                                         0, & error);
     1574            int count = [fTorrents count];
     1575            [self openFiles: [NSArray arrayWithObject: [path stringByAppendingPathComponent: file]]];
    15751576           
    1576             if (tempTor)
     1577            //check if torrent was opened
     1578            if ([fTorrents count] > count)
    15771579            {
    1578                 tr_torrentClose(fLib, tempTor);
     1580                [GrowlApplicationBridge notifyWithTitle: NSLocalizedString(@"Torrent File Auto Added",
     1581                    "Growl notification title") description: file
     1582                    notificationName: GROWL_AUTO_ADD iconData: nil priority: 0 isSticky: NO clickContext: nil];
     1583            }
     1584            else
     1585            {
     1586                //create a temporary torrent to check if it didn't import because of error
     1587                int error;
     1588                tr_torrent_t * tempTor = tr_torrentInit(fLib, [[path stringByAppendingPathComponent: file] UTF8String],
     1589                                                    0, & error);
    15791590               
    1580                 int count = [fTorrents count];
    1581                 [self openFiles: [NSArray arrayWithObject: [path stringByAppendingPathComponent: file]]];
    1582                
    1583                 //check if torrent was opened
    1584                 if ([fTorrents count] > count)
    1585                 {
    1586                     [GrowlApplicationBridge notifyWithTitle: NSLocalizedString(@"Torrent File Auto Added",
    1587                         "Growl notification title") description: file
    1588                         notificationName: GROWL_AUTO_ADD iconData: nil priority: 0 isSticky: NO clickContext: nil];
    1589                 }
     1591                if (tempTor)
     1592                    tr_torrentClose(fLib, tempTor);
     1593                else if (error != TR_EUNSUPPORTED && error != TR_EDUPLICATE)
     1594                    [fAutoImportedNames removeObjectIdenticalTo: file]; //can try to import later
     1595                else;
    15901596            }
    1591             else if (error != TR_EUNSUPPORTED && error != TR_EDUPLICATE)
    1592                 [fAutoImportedNames removeObjectIdenticalTo: file]; //failed to import for unknown reason, so try again later
    1593             else;
    15941597        }
    15951598    }
Note: See TracChangeset for help on using the changeset viewer.