Changeset 606

Show
Ignore:
Timestamp:
07/01/08 19:21:57 (6 months ago)
Author:
gbooker
Message:

Correctly set the mount flag by not setting it during import, and then allowing it to be set later by the collection populator
Added a function to return the skipped directories so they can properly be skipped

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireCollectionDirectory.h

    r540 r606  
    55+ (SapphireCollectionDirectory *)collectionAtPath:(NSString *)path inContext:(NSManagedObjectContext *)moc; 
    66+ (NSArray *)availableCollectionDirectoriesInContext:(NSManagedObjectContext *)moc; 
     7+ (NSArray *)skippedCollectionDirectoriesInContext:(NSManagedObjectContext *)moc; 
    78@end 
  • branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireCollectionDirectory.m

    r580 r606  
    1616        SapphireCollectionDirectory *ret = dir.collectionDirectory; 
    1717        if(ret != nil) 
     18        { 
     19                if(isMount) 
     20                        ret.isMountValue = isMount; 
    1821                return ret; 
     22        } 
    1923         
    2024        ret = [NSEntityDescription insertNewObjectForEntityForName:MY_NAME inManagedObjectContext:moc]; 
     
    6771        return ret; 
    6872} 
     73 
     74+ (NSArray *)skippedCollectionDirectoriesInContext:(NSManagedObjectContext *)moc 
     75{ 
     76        NSPredicate *predicate = [NSPredicate predicateWithFormat:@"skip == YES"]; 
     77        NSSortDescriptor *sort = [[NSSortDescriptor alloc] initWithKey:@"directory.path" ascending:YES]; 
     78        NSArray *ret = doSortedFetchRequest(MY_NAME, moc, predicate, sort); 
     79         
     80        [sort release]; 
     81        return ret; 
     82} 
    6983@end 
  • branches/CoreData/SapphireFrappliance/MetaData/Support/SapphireMetaDataSupport.m

    r595 r606  
    174174        while((collectionPath = [collectionEnum nextObject]) != nil) 
    175175        { 
    176                 [SapphireCollectionDirectory collectionAtPath:collectionPath mount:([custom containsObject:collectionPath] == nil) skip:[[skipped objectForKey:collectionPath] boolValue] hidden:[[hidden objectForKey:collectionPath] boolValue] inContext:context]; 
    177         } 
    178          
    179 //      NSArray *mountedCollections = [SapphireCollectionDirectory availableCollectionDirectoriesInContext:context]; 
     176                [SapphireCollectionDirectory collectionAtPath:collectionPath 
     177                                                                                                mount:NO 
     178                                                                                                 skip:[[skipped objectForKey:collectionPath] boolValue] 
     179                                                                                           hidden:[[hidden objectForKey:collectionPath] boolValue] 
     180                                                                                        inContext:context]; 
     181        } 
     182        //Set the mount values for all 
     183        [SapphireCollectionDirectory availableCollectionDirectoriesInContext:context]; 
    180184         
    181185        [display setCurrentFile:BRLocalizedString(@"Upgrading Movie Translations", @"")]; 
  • branches/CoreData/SapphireFrappliance/MetaDataImporting/SapphireImporterDataMenu.m

    r558 r606  
    2222#import <BackRow/BackRow.h> 
    2323#import "SapphireDirectoryMetaData.h" 
     24#import "SapphireFileMetaData.h" 
    2425#import "SapphireCollectionDirectory.h" 
    2526#import <SapphireCompatClasses/SapphireFrontRowCompat.h> 
     
    170171                return; 
    171172        } 
    172         NSArray *collections = [SapphireCollectionDirectory availableCollectionDirectoriesInContext:moc]; 
    173         NSArray *skipCol = [collections filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"skip == YES"]]; 
     173        NSArray *skipCol = [SapphireCollectionDirectory skippedCollectionDirectoriesInContext:moc]; 
    174174        NSMutableSet *skipSet = [NSMutableSet setWithSet:[skipCol valueForKeyPath:@"directory.path"]]; 
    175175        [meta getSubFileMetasWithDelegate:self skipDirectories:skipSet]; 
     
    259259{ 
    260260        BOOL ret = NO; 
     261        SapphireFileMetaData *file = [importItems objectAtIndex:0]; 
     262        if(file.joinedToFile != nil) 
     263                return NO; 
    261264        @try { 
    262                 ImportState result = [importer importMetaData:[importItems objectAtIndex:0]]; 
     265                ImportState result = [importer importMetaData:file]; 
    263266                switch(result) 
    264267                { 
     
    458461                        return YES; 
    459462                        break; 
     463                case kBREventTapMenu: 
     464                        [self cancel]; 
     465                        break; 
    460466        } 
    461467        return [super brEventAction:event];