mirror of
https://github.com/transmission/transmission
synced 2025-02-04 21:43:03 +00:00
only create temporary torrent if import failed
This commit is contained in:
parent
cd0b6875da
commit
d5ca0624a4
1 changed files with 22 additions and 19 deletions
|
@ -509,6 +509,8 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
||||||
{
|
{
|
||||||
NSString * torrentPath;
|
NSString * torrentPath;
|
||||||
Torrent * torrent;
|
Torrent * torrent;
|
||||||
|
|
||||||
|
//determine next file that can be opened
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if ([files count] == 0) //recursive base case
|
if ([files count] == 0) //recursive base case
|
||||||
|
@ -1569,14 +1571,6 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
||||||
{
|
{
|
||||||
if ([[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame)
|
if ([[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame)
|
||||||
{
|
{
|
||||||
int error;
|
|
||||||
tr_torrent_t * tempTor = tr_torrentInit(fLib, [[path stringByAppendingPathComponent: file] UTF8String],
|
|
||||||
0, & error);
|
|
||||||
|
|
||||||
if (tempTor)
|
|
||||||
{
|
|
||||||
tr_torrentClose(fLib, tempTor);
|
|
||||||
|
|
||||||
int count = [fTorrents count];
|
int count = [fTorrents count];
|
||||||
[self openFiles: [NSArray arrayWithObject: [path stringByAppendingPathComponent: file]]];
|
[self openFiles: [NSArray arrayWithObject: [path stringByAppendingPathComponent: file]]];
|
||||||
|
|
||||||
|
@ -1587,12 +1581,21 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
||||||
"Growl notification title") description: file
|
"Growl notification title") description: file
|
||||||
notificationName: GROWL_AUTO_ADD iconData: nil priority: 0 isSticky: NO clickContext: nil];
|
notificationName: GROWL_AUTO_ADD iconData: nil priority: 0 isSticky: NO clickContext: nil];
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
//create a temporary torrent to check if it didn't import because of error
|
||||||
|
int error;
|
||||||
|
tr_torrent_t * tempTor = tr_torrentInit(fLib, [[path stringByAppendingPathComponent: file] UTF8String],
|
||||||
|
0, & error);
|
||||||
|
|
||||||
|
if (tempTor)
|
||||||
|
tr_torrentClose(fLib, tempTor);
|
||||||
else if (error != TR_EUNSUPPORTED && error != TR_EDUPLICATE)
|
else if (error != TR_EUNSUPPORTED && error != TR_EDUPLICATE)
|
||||||
[fAutoImportedNames removeObjectIdenticalTo: file]; //failed to import for unknown reason, so try again later
|
[fAutoImportedNames removeObjectIdenticalTo: file]; //can try to import later
|
||||||
else;
|
else;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[newNames release];
|
[newNames release];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue