Skip to content

Commit

Permalink
Bring Peter's comment and spacing changes over from experimental branch.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeabdullah committed Nov 15, 2011
1 parent 05159d6 commit b0f50cc
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
14 changes: 9 additions & 5 deletions IMBAppleMediaParser.m
Expand Up @@ -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,
Expand All @@ -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];
Expand Down Expand Up @@ -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];
Expand All @@ -656,18 +658,19 @@ - (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]];

object.preliminaryMetadata = preliminaryMetadata; // This metadata from the XML file is available immediately
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;
Expand All @@ -681,6 +684,7 @@ - (void) populateFacesNode:(IMBNode*)inNode
object.imageRepresentation = nil;
}
}

[pool drain];
inNode.subNodes = subNodes;
inNode.objects = objects;
Expand Down
1 change: 1 addition & 0 deletions IMBFireFoxParser.m
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion IMBLightroomParser.m
Expand Up @@ -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;
}
Expand Down
14 changes: 7 additions & 7 deletions IMBiPhotoParser.m
Expand Up @@ -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...
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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]];

Expand All @@ -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];

Expand Down

0 comments on commit b0f50cc

Please sign in to comment.