diff --git a/IMBAppleMediaParser.m b/IMBAppleMediaParser.m index cf689fffb..b5593dd97 100644 --- a/IMBAppleMediaParser.m +++ b/IMBAppleMediaParser.m @@ -598,7 +598,8 @@ - (void) populateFacesNode:(IMBNode*)inNode images:(NSDictionary*)inImages { // Pull all information on faces from faces dictionary and face occurences in images - // into a faces array (sorted by name) + // into a faces array (sorted by name)... + NSArray* sortedFaces = [self faces:inFaces collectedFromImages:inImages]; // Create the subNodes array on demand - even if turns out to be empty after exiting this method, @@ -607,6 +608,7 @@ - (void) populateFacesNode:(IMBNode*)inNode // Create the objects array on demand - even if turns out to be empty after exiting this method, because // without creating an array we would cause an endless loop... + NSMutableArray* objects = [[NSMutableArray alloc] initWithArray:inNode.objects]; NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; @@ -640,7 +642,7 @@ - (void) populateFacesNode:(IMBNode*)inNode subNode.attributes = faceDict; // Set the node's identifier. This is needed later to link it to the correct parent node. - // Note that a faces dictionary always has a "key" key. + // Note that a faces dictionary always has a "key" key... NSNumber* subNodeId = [faceDict objectForKey:@"key"]; subNode.identifier = [self identifierForId:subNodeId inSpace:FACES_ID_SPACE]; @@ -656,7 +658,8 @@ - (void) populateFacesNode:(IMBNode*)inNode [object release]; // Adjust keys "KeyPhotoKey", "KeyList", and "PhotoCount" in metadata dictionary - // because movies and images are not jointly displayed in iMedia browser + // because movies and images are not jointly displayed in iMedia browser... + NSMutableDictionary* preliminaryMetadata = [NSMutableDictionary dictionaryWithDictionary:faceDict]; [preliminaryMetadata addEntriesFromDictionary:[self childrenInfoForNode:subNode images:inImages]]; @@ -664,10 +667,10 @@ - (void) populateFacesNode:(IMBNode*)inNode object.metadata = nil; // Build lazily when needed (takes longer) object.metadataDescription = nil; // Build lazily when needed (takes longer) - // Obtain key photo dictionary (key photo is displayed while not skimming) + // Obtain key photo dictionary (key photo is displayed while not skimming)... + faceKeyPhotoKey = [object.preliminaryMetadata objectForKey:@"KeyPhotoKey"]; NSDictionary* keyPhotoDict = [inImages objectForKey:faceKeyPhotoKey]; - path = [keyPhotoDict objectForKey:@"ImagePath"]; object.representedNodeIdentifier = subNode.identifier; @@ -681,6 +684,7 @@ - (void) populateFacesNode:(IMBNode*)inNode object.imageRepresentation = nil; } } + [pool drain]; inNode.subNodes = subNodes; inNode.objects = objects; diff --git a/IMBFireFoxParser.m b/IMBFireFoxParser.m index 23b7e871f..cedfc9a69 100644 --- a/IMBFireFoxParser.m +++ b/IMBFireFoxParser.m @@ -279,6 +279,7 @@ - (IMBNode*) nodeWithOldNode:(const IMBNode*)inOldNode options:(IMBOptions)inOpt node.attributes = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:1] forKey:@"id"]; self.database = [FMDatabase databaseWithPath:self.databasePathCurrent]; + if ([self openDatabase]) { [self populateNode:node options:inOptions error:outError]; // populate the WHOLE thing. diff --git a/IMBLightroomParser.m b/IMBLightroomParser.m index 25f2a1d01..8542d39d0 100644 --- a/IMBLightroomParser.m +++ b/IMBLightroomParser.m @@ -453,7 +453,8 @@ - (BOOL) populateNode:(IMBNode*)inNode options:(IMBOptions)inOptions error:(NSEr - (void) didStopUsingParser { - @synchronized (self) { + @synchronized (self) + { self.databases = nil; self.thumbnailDatabases = nil; } diff --git a/IMBiPhotoParser.m b/IMBiPhotoParser.m index 3051de271..4734a6ee8 100644 --- a/IMBiPhotoParser.m +++ b/IMBiPhotoParser.m @@ -856,9 +856,7 @@ - (NSDictionary*) childrenInfoForNode:(IMBNode*)inNode images:(NSDictionary*)inI // Create a subnode for each event and a corresponding visual object -- (void) populateEventsNode:(IMBNode*)inNode - withEvents:(NSArray*)inEvents - images:(NSDictionary*)inImages +- (void) populateEventsNode:(IMBNode*)inNode withEvents:(NSArray*)inEvents images:(NSDictionary*)inImages { // Create the subNodes array on demand - even if turns out to be empty after exiting this method, // because without creating an array we would cause an endless loop... @@ -869,7 +867,6 @@ - (void) populateEventsNode:(IMBNode*)inNode // without creating an array we would cause an endless loop... NSMutableArray* objects = [[NSMutableArray alloc] initWithArray:inNode.objects]; - NSUInteger index = 0; // We saved a reference to the album dictionary when this node was created @@ -903,6 +900,7 @@ - (void) populateEventsNode:(IMBNode*)inNode subNode.parser = self; // Keep a ref to the subnode dictionary for potential later use + subNode.attributes = subNodeDict; // Set the node's identifier. This is needed later to link it to the correct parent node. Please note @@ -917,14 +915,15 @@ - (void) populateEventsNode:(IMBNode*)inNode [subNodes addObject:subNode]; - // Now create the visual object and link it to subnode just created + // Now create the visual object and link it to subnode just created... object = [[IMBiPhotoEventNodeObject alloc] init]; [objects addObject:object]; [object release]; - // Adjust keys "KeyPhotoKey", "KeyList", and "PhotoCount" in metadata dictionary - // because movies and images are not jointly displayed in iMedia browser + // Adjust keys "KeyPhotoKey", "KeyList", and "PhotoCount" in metadata dictionary because movies and + // images are not jointly displayed in iMedia browser... + NSMutableDictionary* preliminaryMetadata = [NSMutableDictionary dictionaryWithDictionary:subNodeDict]; [preliminaryMetadata addEntriesFromDictionary:[self childrenInfoForNode:subNode images:inImages]]; @@ -933,6 +932,7 @@ - (void) populateEventsNode:(IMBNode*)inNode object.metadataDescription = nil; // Build lazily when needed (takes longer) // Obtain key photo dictionary (key photo is displayed while not skimming) + eventKeyPhotoKey = [object.preliminaryMetadata objectForKey:@"KeyPhotoKey"]; NSDictionary* keyPhotoDict = [inImages objectForKey:eventKeyPhotoKey];