Changeset 445

Show
Ignore:
Timestamp:
01/03/08 21:08:45 (1 year ago)
Author:
gbooker
Message:
  • Fixed clearing of metadata on dirs
  • Added ability to skip directories on import
  • Hooked up code to add/remove arbitrary dirs as collections (will not remove a mount)

(Not tested)
Fixes #15, #76

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/SapphireImporterDataMenu.m

    r444 r445  
    173173        } 
    174174        SapphireDirectoryMetaData *meta = [metaCollection directoryForPath:path]; 
    175         [meta getSubFileMetasWithDelegate:self skipDirectories:[NSMutableSet set]]; 
     175        [meta getSubFileMetasWithDelegate:self skipDirectories:[NSMutableSet setWithSet:[metaCollection skipDirectories]]]; 
    176176        collectionIndex++; 
    177177} 
  • trunk/SapphireMarkMenu.m

    r436 r445  
    5757        /*Create the menu*/ 
    5858        if(isDir) 
     59        { 
    5960                names = [[NSMutableArray alloc] initWithObjects: 
    6061                        BRLocalizedString(@"Mark All as Watched", @"Mark whole directory as watched"), 
     
    6667                        BRLocalizedString(@"Mark All to Clear Metadata", @"Mark whole directory to delete the metadata"), 
    6768                        nil]; 
     69                SapphireMetaDataCollection *collection = [meta collection]; 
     70                NSString *path = [meta path]; 
     71                if([collection skipCollection:path]) 
     72                        [names addObject:BRLocalizedString(@"Mark this Directory to Not Skip Import", @"Marks this directory to be no longer be skipped during import")]; 
     73                else 
     74                        [names addObject:BRLocalizedString(@"Mark this Directory to Skip Import", @"Marks this directory to be skipped during import")]; 
     75                if([collection isCollectionDirectory:path]) 
     76                        [names addObject:BRLocalizedString(@"Mark this Directory to Not be a Collection", @"Marks the directory to no longer be a collection")]; 
     77                else 
     78                        [names addObject:BRLocalizedString(@"Mark this Directory as a Collection", @"Marks the directory to be a collection")]; 
     79        } 
    6880        else if([meta isKindOfClass:[SapphireFileMetaData class]]) 
    6981        { 
     
    307319        { 
    308320                SapphireDirectoryMetaData *dirMeta = (SapphireDirectoryMetaData *)metaData; 
     321                SapphireMetaDataCollection *collection = [dirMeta collection]; 
     322                NSString *path = [dirMeta path]; 
    309323                switch(row) 
    310324                { 
     
    326340                                [dirMeta setToImportFromSource:META_IMDB_IMPORT_KEY forPredicate:predicate]; 
    327341                                break; 
     342                        case 6: 
     343                                [dirMeta clearMetaDataForPredicate:predicate]; 
     344                                break; 
     345                        case 7: 
     346                                [collection setSkip:![collection skipCollection:path] forCollection:path]; 
     347                                break; 
     348                        case 8: 
     349                                if([collection isCollectionDirectory:path]) 
     350                                        [collection removeCollectionDirectory:path]; 
     351                                else 
     352                                        [collection addCollectionDirectory:path]; 
     353                                break; 
    328354                } 
    329355        } 
  • trunk/SapphireMetaData.h

    r438 r445  
    389389 
    390390/*! 
     391 * @brief The set of directories to skip during import 
     392 * 
     393 * @return An NSSet of directories to not import 
     394 */ 
     395- (NSSet *)skipDirectories; 
     396 
     397/*! 
    391398 * @brief Add a collection 
    392399 * 
  • trunk/SapphireMetaData.m

    r438 r445  
    645645        [skipCollection setObject:[NSNumber numberWithBool:skip] forKey:collection]; 
    646646        [self writeMetaData]; 
     647} 
     648 
     649- (NSSet *)skipDirectories 
     650{ 
     651        NSMutableSet *ret = [NSMutableSet set]; 
     652        NSEnumerator *colEnum = [[self collectionDirectories] objectEnumerator]; 
     653        NSString *collection; 
     654        while((collection = [colEnum nextObject]) != nil) 
     655        { 
     656                if(![self skipCollection:collection]) 
     657                        [ret addObject:collection]; 
     658        } 
     659         
     660        return ret; 
    647661} 
    648662