autoimport can now tell if not opening was a result of the torrent already existing or not being supported
This commit is contained in:
parent
f165fb0404
commit
0f75cc7799
|
@ -1569,18 +1569,27 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
{
|
||||
if ([[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame)
|
||||
{
|
||||
oldCount = [fTorrents count];
|
||||
int error;
|
||||
tr_torrent_t * tempTor = tr_torrentInit(fLib, [path UTF8String], 0, & error);
|
||||
|
||||
if (tempTor)
|
||||
{
|
||||
tr_torrentClose(fLib, tempTor);
|
||||
|
||||
int count = [fTorrents count];
|
||||
[self openFiles: [NSArray arrayWithObject: [path stringByAppendingPathComponent: file]]];
|
||||
|
||||
//import only actually happened if the torrent array is larger
|
||||
if (oldCount < [fTorrents count])
|
||||
//check if torrent was opened
|
||||
if ([fTorrents count] > count)
|
||||
{
|
||||
[GrowlApplicationBridge notifyWithTitle: NSLocalizedString(@"Torrent File Auto Added",
|
||||
"Growl notification title") description: file
|
||||
notificationName: GROWL_AUTO_ADD iconData: nil priority: 0 isSticky: NO clickContext: nil];
|
||||
}
|
||||
else
|
||||
[fAutoImportedNames removeObjectIdenticalTo: file]; //failed to import, possibly because not fully downloaded
|
||||
}
|
||||
else if (error != TR_EUNSUPPORTED || error != TR_EDUPLICATE)
|
||||
[fAutoImportedNames removeObjectIdenticalTo: file]; //failed to import for unknown reason, so try again later
|
||||
else;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue