Changeset 1179

Show
Ignore:
Timestamp:
02/25/2010 05:31:35 PM (2 years ago)
Author:
gbooker
Message:

Merged changes from the branch back to trunk

Location:
trunk
Files:
19 modified
57 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/SapphireFrappliance/Browser/SapphireBrowser.m

    r1038 r1179  
    4444#import "SapphireErrorDisplayController.h" 
    4545#import "SapphireAudioNowPlayingController.h" 
     46 
     47 
     48#import "SapphireCMPWrapper.h" 
    4649 
    4750#import <objc/objc-class.h> 
     
    555558        if([currentPlayFile fileContainerTypeValue] == FILE_CONTAINER_TYPE_VIDEO_TS && path != nil) 
    556559        { 
    557                 if([SapphireFrontRowCompat usingLeopard]) 
    558                 { 
    559                         BRDVDMediaAsset *asset = [[BRDVDMediaAsset alloc] initWithPath:path]; 
    560                         SapphireDVDLoadingController *controller = [[SapphireDVDLoadingController alloc] initWithScene:[self scene] forAsset:asset]; 
    561                         [asset release]; 
    562                         [[self stack] pushController:controller]; 
    563                         [controller release]; 
    564                 } 
    565                 else 
    566                 { 
    567                         SapphireErrorDisplayController *controller = [[SapphireErrorDisplayController alloc] initWithScene:[self scene] error:BRLocalizedString(@"Playback Error", @"Short error indicating an error while playing a file") longError:BRLocalizedString(@"DVD Playback is not supported on the AppleTV", @"Error message saying DVD on ATV not supported")]; 
    568                         [[self stack] pushController:controller]; 
    569                         [controller release]; 
    570                 } 
     560                SapphireCMPWrapper *wrapper = [[SapphireCMPWrapper alloc] initWithFile:currentPlayFile scene:[self scene]]; 
     561                id controller = [wrapper controller]; 
     562                [wrapper release]; 
     563//                      SapphireErrorDisplayController *controller = [[SapphireErrorDisplayController alloc] initWithScene:[self scene] error:BRLocalizedString(@"Playback Error", @"Short error indicating an error while playing a file") longError:BRLocalizedString(@"DVD Playback is not supported on the AppleTV", @"Error message saying DVD on ATV not supported")]; 
     564                [[self stack] pushController:controller]; 
    571565        } 
    572566        else if([[NSFileManager defaultManager] acceptFilePath:path] && [currentPlayFile hasVideoValue]) 
  • trunk/SapphireFrappliance/Browser/SapphireMarkMenu.m

    r1092 r1179  
    289289                 
    290290                NSString *prettyName = [fileMeta prettyName]; 
    291                 if(prettyName != nil && [[[[fileMeta path] lastPathComponent] stringByDeletingPathExtension] caseInsensitiveCompare:prettyName] != NSOrderedSame) 
     291                if(prettyName != nil && [[fileMeta fileName] caseInsensitiveCompare:prettyName] != NSOrderedSame) 
    292292                { 
    293293                        [marks insertObject: 
     
    469469                NSString *savePath = [[joinList objectAtIndex:0] path]; 
    470470                BOOL hasmovExt = [[savePath pathExtension] isEqualToString:@"mov"]; 
    471                 NSString *base = [savePath stringByDeletingPathExtension]; 
     471                NSString *base = [[joinList objectAtIndex:0] extensionlessPath]; 
    472472                if([[base lowercaseString] hasSuffix:@" part 1"]) 
    473473                        base = [base substringToIndex:[base length] - 7]; 
     
    750750                        { 
    751751                                NSString *title = [NSString stringWithFormat:BRLocalizedString(@"Rename %@", @"Rename a file, directory, or collection, argument is path"), [fileMeta path]]; 
    752                                 NSString *oldName = [[[fileMeta path] lastPathComponent] stringByDeletingPathExtension]; 
     752                                NSString *oldName = [fileMeta fileName]; 
    753753                                 
    754754                                NSInvocation *invoke = [NSInvocation invocationWithMethodSignature:[fileMeta methodSignatureForSelector:@selector(rename:)]]; 
  • trunk/SapphireFrappliance/FRAppliance/SapphireAppliance.m

    r1038 r1179  
    2929 
    3030#import <SapphireCompatClasses/BackRowUtils.h> 
     31#ifdef DEBUG 
     32//#define FrameworkLoadDebug 
     33#define FrameworkAlwaysCopy 
     34#endif 
     35#import <CommonMediaPlayer/CMPPlayerManager.h> 
    3136 
    3237#define TV_SHOW_IDENTIFIER      @"tv-shows" 
     
    6166@end 
    6267 
     68static NSString *initialError = nil; 
    6369 
    6470@implementation SapphireAppliance 
     71 
     72BOOL usingCategories = NO; 
    6573 
    6674+ (void) initialize 
     
    6977        NSString *frameworkPath = [myBundlePath stringByAppendingPathComponent:@"Contents/Frameworks"]; 
    7078        SapphireLoadFramework(frameworkPath); 
     79        if(!loadCMPFramework(myBundlePath)) 
     80                initialError = BRLocalizedString(@"Error loading common player framework.  Continuing is not recomended", @"Error string for loading common player framework"); 
     81        else if([CMPPlayerManager version] != CMPVersion) 
     82                initialError = BRLocalizedString(@"Common player framework is newer than expected.  You may wish to check if a newer version of Sapphire is available.  You may attempt to continue if you like.", @"Warning string for common player framework being newer than Sapphire"); 
    7183        Class cls = NSClassFromString( @"BRFeatureManager" ); 
    7284        if ( cls == Nil ) 
     
    156168- (id) applianceControllerWithScene: (id) scene 
    157169{ 
     170        if(initialError && !usingCategories) 
     171        { 
     172                BRAlertController *controller = [SapphireFrontRowCompat alertOfType:0 titled:@"Error" primaryText:@"Framework Error" secondaryText:initialError withScene:nil]; 
     173                initialError = nil; 
     174                return controller; 
     175        } 
    158176        // this function is called when your item is selected on the main menu 
    159177        @try { 
     
    180198        NSMutableArray *categories = [NSMutableArray array]; 
    181199         
     200        usingCategories = YES; 
    182201        if([SapphireApplianceController upgradeNeeded]) 
    183202        { 
     
    229248-(id)controllerForIdentifier:(id)ident 
    230249{ 
     250        if(initialError) 
     251        { 
     252                BRAlertController *controller = [SapphireFrontRowCompat alertOfType:0 titled:@"Error" primaryText:@"Framework Error" secondaryText:initialError withScene:nil]; 
     253                initialError = nil; 
     254                return controller; 
     255        } 
    231256        NSString *identifier = (NSString *)ident; 
    232257        if([identifier isEqualToString:UPGRADE_IDENTIFIER]) 
  • trunk/SapphireFrappliance/FRAppliance/SapphireURLLoader.m

    r1038 r1179  
    132132- (int)cancelForTarget:(id)target 
    133133{ 
    134         for(int i=0; i<[informers count]; i++) 
     134        int i; 
     135        for(i=0; i<[informers count]; i++) 
    135136        { 
    136137                NSInvocation *invoke = [informers objectAtIndex:i]; 
  • trunk/SapphireFrappliance/MetaData/SapphireMObjects/SapphireFileMetaData.h

    r949 r1179  
    191191 
    192192/*! 
     193 * @brief Return the filename, minus the path extension 
     194 */ 
     195- (NSString *)fileName; 
     196 
     197/*! 
     198 * @brief Return the path, minus the path extension 
     199 */ 
     200- (NSString *)extensionlessPath; 
     201 
     202/*! 
    193203 * @brief Get the overridden show name 
    194204 * 
  • trunk/SapphireFrappliance/MetaData/SapphireMObjects/SapphireFileMetaData.m

    r977 r1179  
    231231                        self.fileClassValue = FILE_CLASS_TV_SHOW; 
    232232                        NSString *epCoverPath = [[SapphireMetaDataSupport collectionArtPath] stringByAppendingPathComponent:[ep path]]; 
    233                         NSString *oldBasePath = [[epCoverPath stringByDeletingLastPathComponent] stringByAppendingPathComponent:[self.path lastPathComponent]]; 
    234                         NSString *oldCoverPath = searchCoverArtExtForPath([oldBasePath stringByDeletingPathExtension]); 
     233                        NSString *oldBasePath = [[epCoverPath stringByDeletingLastPathComponent] stringByAppendingPathComponent:[self fileName]]; 
     234                        NSString *oldCoverPath = searchCoverArtExtForPath(oldBasePath); 
    235235                        if(oldCoverPath != nil) 
    236236                        { 
     
    251251                        self.fileClassValue = FILE_CLASS_MOVIE; 
    252252                        NSString *movieCoverPath = [movie coverArtPath]; 
    253                         NSString *oldBasePath = [[[SapphireMetaDataSupport collectionArtPath] stringByAppendingPathComponent:@"@MOVIES"] stringByAppendingPathComponent:[self.path lastPathComponent]]; 
    254                         NSString *oldCoverPath = searchCoverArtExtForPath([oldBasePath stringByDeletingPathExtension]); 
     253                        NSString *oldBasePath = [[[SapphireMetaDataSupport collectionArtPath] stringByAppendingPathComponent:@"@MOVIES"] stringByAppendingPathComponent:[self fileName]]; 
     254                        NSString *oldCoverPath = searchCoverArtExtForPath(oldBasePath); 
    255255                        if(oldCoverPath != nil) 
    256256                        { 
     
    324324{ 
    325325        /*Check modified date*/ 
    326         NSDictionary *props = [[NSFileManager defaultManager] fileAttributesAtPath:self.path traverseLink:YES]; 
     326        NSString *path = nil; 
     327        NSFileManager *fm = [NSFileManager defaultManager]; 
     328        if([self fileContainerTypeValue] == FILE_CONTAINER_TYPE_VIDEO_TS) 
     329        { 
     330                NSString *vtsPath = [self.path stringByAppendingPathComponent:@"VIDEO_TS"]; 
     331                NSEnumerator *fileEnum = [[fm directoryContentsAtPath:vtsPath] objectEnumerator]; 
     332                NSString *file; 
     333                while((file = [fileEnum nextObject]) != nil) 
     334                { 
     335                        NSString *lowerFile = [file lowercaseString]; 
     336                        if([lowerFile hasSuffix:@".ifo"] && ![[lowerFile lastPathComponent] isEqualToString:@"video_ts.ifo"]) 
     337                        { 
     338                                path = [vtsPath stringByAppendingPathComponent:file]; 
     339                                break; 
     340                        } 
     341                } 
     342        } 
     343        else 
     344                path = self.path; 
     345        NSDictionary *props = [fm fileAttributesAtPath:path traverseLink:YES]; 
    327346        int modTime = [[props objectForKey:NSFileModificationDate] timeIntervalSince1970]; 
    328347         
     
    352371         
    353372        //Check XML 
    354         NSString *xmlFilePath=[[self.path stringByDeletingPathExtension] stringByAppendingPathExtension:@"xml"]; 
     373        NSString *xmlFilePath=[[self extensionlessPath] stringByAppendingPathExtension:@"xml"]; 
    355374        SapphireXMLData *xml = self.xmlData; 
    356375        NSDictionary *xmlProps = [fm fileAttributesAtPath:xmlFilePath traverseLink:YES]; 
     
    410429                NSMutableDictionary *fileMeta = [NSMutableDictionary dictionary]; 
    411430                NSString *path = [file path]; 
     431                NSString *modifiedPath = path; 
     432                NSFileManager *fm = [NSFileManager defaultManager]; 
    412433                 
    413                 NSDictionary *props = [[NSFileManager defaultManager] fileAttributesAtPath:path traverseLink:YES]; 
     434                if([file fileContainerTypeValue] == FILE_CONTAINER_TYPE_VIDEO_TS) 
     435                { 
     436                        NSString *vtsPath = [[file path] stringByAppendingPathComponent:@"VIDEO_TS"]; 
     437                        NSEnumerator *fileEnum = [[fm directoryContentsAtPath:vtsPath] objectEnumerator]; 
     438                        NSString *file; 
     439                        while((file = [fileEnum nextObject]) != nil) 
     440                        { 
     441                                NSString *lowerFile = [file lowercaseString]; 
     442                                if([lowerFile hasSuffix:@".ifo"] && ![[lowerFile lastPathComponent] isEqualToString:@"video_ts.ifo"]) 
     443                                { 
     444                                        modifiedPath = [vtsPath stringByAppendingPathComponent:file]; 
     445                                        break; 
     446                                } 
     447                        } 
     448                } 
     449                NSDictionary *props = [fm fileAttributesAtPath:modifiedPath traverseLink:YES]; 
    414450                int modTime = [[props objectForKey:NSFileModificationDate] timeIntervalSince1970]; 
    415451                /*Set modified, size, and version*/ 
     
    511547                { 
    512548                        SapphireVideoTsParser *dvd = [[SapphireVideoTsParser alloc] initWithPath:path]; 
    513                          
    514                         [fileMeta setObject:[dvd videoFormatsString ] forKey:META_FILE_VIDEO_DESC_KEY]; 
    515                         [fileMeta setObject:[dvd audioFormatsString ] forKey:META_FILE_AUDIO_DESC_KEY]; 
    516                         [fileMeta setObject:[dvd subtitlesString    ] forKey:META_FILE_SUBTITLES_KEY ]; 
    517                         [fileMeta setObject:[dvd mainFeatureDuration] forKey:META_FILE_DURATION_KEY  ]; 
    518                         [fileMeta setObject:[dvd totalSize          ] forKey:META_FILE_SIZE_KEY      ]; 
     549                        id description = [dvd videoFormatsString]; 
     550                        if(description) 
     551                                [fileMeta setObject:description forKey:META_FILE_VIDEO_DESC_KEY]; 
     552                        description = [dvd audioFormatsString]; 
     553                        if(description) 
     554                                [fileMeta setObject:description forKey:META_FILE_AUDIO_DESC_KEY]; 
     555                        description = [dvd mainFeatureDuration]; 
     556                        if(description) 
     557                                [fileMeta setObject:description forKey:META_FILE_DURATION_KEY]; 
     558                        description = [dvd totalSize]; 
     559                        if(description) 
     560                                [fileMeta setObject:description forKey:META_FILE_SIZE_KEY]; 
     561                        description = [dvd subtitlesString]; 
     562                        if(description) 
     563                                [fileMeta setObject:description forKey:META_FILE_SUBTITLES_KEY ]; 
    519564                         
    520565                        [dvd release]; 
     
    591636{ 
    592637        NSManagedObjectContext *moc = [self managedObjectContext]; 
    593         NSString *lowerFileName = [[self.path lastPathComponent] lowercaseString]; 
     638        NSString *lowerFileName = [[self fileName] lowercaseString]; 
    594639 
    595640        SapphireEpisode *ep = self.tvEpisode; 
     
    613658        else 
    614659                lookupName = lowerFileName; 
    615         SapphireMovieTranslation *movieTran = [SapphireMovieTranslation movieTranslationWithName:[lookupName stringByDeletingPathExtension] inContext:moc]; 
     660        SapphireMovieTranslation *movieTran = [SapphireMovieTranslation movieTranslationWithName:lookupName inContext:moc]; 
    616661        if(movieTran != nil) 
    617662        { 
     
    651696{ 
    652697        /*Find cover art for the current file in the "Cover Art" dir */ 
    653         NSString *subPath = [self path]; 
    654         if([self fileContainerTypeValue] != FILE_CONTAINER_TYPE_VIDEO_TS) 
    655                 subPath = [subPath stringByDeletingPathExtension]; 
     698        NSString *subPath = [self extensionlessPath]; 
    656699         
    657700        NSString *fileName = [subPath lastPathComponent]; 
     
    737780        [SapphireMetaDataSupport save:[self managedObjectContext]]; 
    738781        NSLog(@"Save done"); 
    739         NSString *extLessPath = [oldPath stringByDeletingPathExtension]; 
     782        NSString *extLessPath = [self extensionlessPath]; 
    740783        NSEnumerator *secondaryExtEnum = [secondaryFiles objectEnumerator]; 
    741784        NSString *extension; 
     785        NSString *newExtlessPath = newPath; 
     786        if(self.fileContainerTypeValue != FILE_CONTAINER_TYPE_VIDEO_TS) 
     787                newExtlessPath = [newExtlessPath stringByDeletingPathExtension]; 
    742788         
    743789        while((extension = [secondaryExtEnum nextObject]) != nil) 
     
    746792                if([fm fileExistsAtPath:secondaryPath]) 
    747793                { 
    748                         NSString *newSecondaryPath = [[newPath stringByDeletingPathExtension] stringByAppendingPathExtension:extension]; 
     794                        NSString *newSecondaryPath = [newExtlessPath stringByAppendingPathExtension:extension]; 
    749795                        if(newParent != nil) 
    750796                        { 
     
    767813        if(coverArtPath != nil) 
    768814        { 
    769                 NSString *newCoverArtPath = [[newPath stringByDeletingPathExtension] stringByAppendingPathExtension:[coverArtPath pathExtension]]; 
     815                NSString *newCoverArtPath = [newExtlessPath stringByAppendingPathExtension:[coverArtPath pathExtension]]; 
    770816                if(newParent != nil) 
    771817                { 
     
    800846                return BRLocalizedString(@"A File name should not contain any '/' characters", @"Error indicating that filenames cannot contain / characters"); 
    801847        NSString *oldPath = [self path]; 
    802         newFilename = [newFilename stringByAppendingPathExtension:[oldPath pathExtension]]; 
     848        if(self.fileContainerTypeValue != FILE_CONTAINER_TYPE_VIDEO_TS) 
     849                newFilename = [newFilename stringByAppendingPathExtension:[oldPath pathExtension]]; 
    803850        NSString *newPath = [[oldPath stringByDeletingLastPathComponent] stringByAppendingPathComponent:newFilename]; 
    804851        if([oldPath isEqualToString:newPath]) 
     
    858905} 
    859906 
     907- (NSString *)fileName 
     908{ 
     909        NSString *ret = [self.path lastPathComponent]; 
     910        if(self.fileContainerTypeValue != FILE_CONTAINER_TYPE_VIDEO_TS) 
     911                ret = [ret stringByDeletingPathExtension]; 
     912         
     913        return ret; 
     914} 
     915 
     916- (NSString *)extensionlessPath 
     917{ 
     918        NSString *ret = self.path; 
     919        if(self.fileContainerTypeValue != FILE_CONTAINER_TYPE_VIDEO_TS) 
     920                ret = [ret stringByDeletingPathExtension]; 
     921         
     922        return ret; 
     923} 
     924 
    860925- (NSMutableDictionary *)getDisplayedMetaDataInOrder:(NSArray * *)order; 
    861926{ 
  • trunk/SapphireFrappliance/MetaData/SapphireMObjects/SapphireMovieTranslation.m

    r734 r1179  
    4545- (SapphireMoviePoster *)selectedPoster 
    4646{ 
     47        NSNumber *index = self.selectedPosterIndex; 
     48        if(index == nil) 
     49                return nil; 
     50         
    4751        NSArray *allPosters = [self.postersSet allObjects]; 
    48         NSPredicate *indexSearch = [NSPredicate predicateWithFormat:@"index = %d", self.selectedPosterIndexValue]; 
     52        NSPredicate *indexSearch = [NSPredicate predicateWithFormat:@"index = %d", [index intValue]]; 
    4953        allPosters = [allPosters filteredArrayUsingPredicate:indexSearch]; 
    5054        if(![allPosters count]) 
  • trunk/SapphireFrappliance/MetaData/Support/SapphireMetaDataSupport.m

    r977 r1179  
    324324        if(error != nil) 
    325325        { 
    326                 SapphireLog(SAPPHIRE_LOG_METADATA_STORE, SAPPHIRE_LOG_LEVEL_DETAIL, @"Save error \"%@\"", error); 
     326                SapphireLog(SAPPHIRE_LOG_METADATA_STORE, SAPPHIRE_LOG_LEVEL_ERROR, @"Save error \"%@\"", error); 
    327327                NSArray *details = [[error userInfo] objectForKey:@"NSDetailedErrors"]; 
    328328                if(details != nil) 
     
    331331                        NSError *aError; 
    332332                        while((aError = [errorEnum nextObject]) != nil) 
    333                                 SapphireLog(SAPPHIRE_LOG_METADATA_STORE, SAPPHIRE_LOG_LEVEL_DETAIL, @"One error is %@: %@", aError, [aError userInfo]); 
     333                                SapphireLog(SAPPHIRE_LOG_METADATA_STORE, SAPPHIRE_LOG_LEVEL_ERROR, @"One error is %@: %@", aError, [aError userInfo]); 
    334334                } 
    335335                NSException *underlying = [[error userInfo] objectForKey:@"NSUnderlyingException"]; 
  • trunk/SapphireFrappliance/MetaDataImporting/SapphireMovieImporter.m

    r1139 r1179  
    3232#import "SapphireURLLoader.h" 
    3333#import "SapphireScraper.h" 
     34#import "NSString-Extensions.h" 
    3435 
    3536@interface SapphireMovieImportStateData : SapphireImportStateData 
     
    3738@public 
    3839        SapphireSiteMovieScraper        *siteScraper; 
     40        SapphireMovieTranslation        *translation; 
    3941} 
    4042- (id)initWithFile:(SapphireFileMetaData *)aFile atPath:(NSString *)aPath scraper:(SapphireSiteMovieScraper *)siteScaper; 
     43- (void)setTranslation:(SapphireMovieTranslation *)aTranslation; 
     44- (SapphireMovieTranslation *)createTranslationInContext:(NSManagedObjectContext *)moc; 
    4145@end 
    4246 
     
    5761{ 
    5862        [siteScraper release]; 
     63        [translation release]; 
    5964        [super dealloc]; 
    6065} 
    6166 
     67- (void)setTranslation:(SapphireMovieTranslation *)aTranslation 
     68{ 
     69        [translation autorelease]; 
     70        translation = [aTranslation retain]; 
     71} 
     72 
     73- (SapphireMovieTranslation *)createTranslationInContext:(NSManagedObjectContext *)moc 
     74{ 
     75        SapphireMovieTranslation *tran = [SapphireMovieTranslation createMovieTranslationWithName:lookupName inContext:moc]; 
     76        [self setTranslation:tran]; 
     77        return tran; 
     78} 
     79 
    6280@end 
    6381 
     
    6583 
    6684@interface SapphireMovieImporter () 
    67 - (void)getMovieResultsForState:(SapphireMovieImportStateData *)state translation:(SapphireMovieTranslation *)tran; 
    68 - (void)getMoviePostersForState:(SapphireMovieImportStateData *)state translation:(SapphireMovieTranslation *)tran thumbElements:(NSArray *)thumbElements; 
     85- (void)getMovieResultsForState:(SapphireMovieImportStateData *)state; 
     86- (void)getMoviePostersForState:(SapphireMovieImportStateData *)state thumbElements:(NSArray *)thumbElements; 
    6987- (void)saveMoviePosterAtURL:(NSString *)url forTranslation:(SapphireMovieTranslation *)tran; 
    7088- (void)completeWithState:(SapphireMovieImportStateData *)state withStatus:(ImportState)status importComplete:(BOOL)importComplete; 
     
    7997                return self; 
    8098         
    81         NSError *error = nil; 
    8299        scraper = [[SapphireScraper scrapperWithName:@"IMDb.com"] retain]; 
    83100         
     
    102119} 
    103120 
    104 - (void)retrievedSearchResuls:(NSXMLDocument *)results forObject:(SapphireMovieImportStateData *)state 
    105 { 
     121- (void)retrievedSearchResuls:(NSXMLDocument *)results forObject:(id)stateObj 
     122{ 
     123        SapphireMovieImportStateData *state = (SapphireMovieImportStateData *)stateObj; 
    106124        [state->siteScraper setObject:nil];     //Avoid retain loop 
    107125        if(cancelled) 
     
    157175                SapphireFileMetaData *metaData = state->file; 
    158176                NSManagedObjectContext *moc = [metaData managedObjectContext]; 
    159                 NSString *lookupName = [[state->lookupName lowercaseString] stringByDeletingPathExtension]; 
    160                 SapphireMovieTranslation *tran = [SapphireMovieTranslation createMovieTranslationWithName:lookupName inContext:moc]; 
     177                SapphireMovieTranslation *tran = [state createTranslationInContext:moc]; 
    161178                [tran setIMDBLink:[[movies objectAtIndex:0] objectForKey:movieTranslationLinkKey]]; 
    162                 [self getMovieResultsForState:state translation:tran]; 
     179                [self getMovieResultsForState:state]; 
    163180        } 
    164181        else 
     
    167184                SapphireMovieChooser *chooser = [[SapphireMovieChooser alloc] initWithScene:[delegate chooserScene]]; 
    168185                [chooser setMovies:movies]; 
    169                 [chooser setFileName:state->lookupName];                 
     186                [chooser setFileName:[NSString stringByCroppingDirectoryPath:state->path toLength:3]]; 
    170187                [chooser setListTitle:BRLocalizedString(@"Select Movie Title", @"Prompt the user for title of movie")]; 
    171188                /*And display prompt*/ 
     
    176193} 
    177194 
    178 - (void)getMovieResultsForState:(SapphireMovieImportStateData *)state translation:(SapphireMovieTranslation *)tran 
    179 { 
     195- (void)getMovieResultsForState:(SapphireMovieImportStateData *)state 
     196{ 
     197        SapphireMovieTranslation *tran = state->translation; 
    180198        NSString *link = [tran IMDBLink]; 
    181199        SapphireSiteMovieScraper *siteScraper = state->siteScraper; 
     
    188206} 
    189207 
    190 - (void)retrievedMovieDetails:(NSXMLDocument *)details forObject:(SapphireMovieImportStateData *)state 
    191 { 
     208- (void)retrievedMovieDetails:(NSXMLDocument *)details forObject:(id)stateObj 
     209{ 
     210        SapphireMovieImportStateData *state = (SapphireMovieImportStateData *)stateObj; 
    192211        [state->siteScraper setObject:nil];     //Avoid retain loop 
    193212 
     
    265284                [infoIMDB setObject:movieTitle forKey:META_MOVIE_TITLE_KEY]; 
    266285         
    267         NSString *movieTranslationString = [[state->lookupName lowercaseString] stringByDeletingPathExtension]; 
    268286        SapphireFileMetaData *metaData = state->file; 
    269287        NSManagedObjectContext *moc = [metaData managedObjectContext]; 
    270         SapphireMovieTranslation *tran = [SapphireMovieTranslation movieTranslationWithName:movieTranslationString inContext:moc]; 
    271288        SapphireMovie *movie = [SapphireMovie movieWithDictionary:infoIMDB inContext:moc]; 
    272289        if(movie == nil) 
     
    276293                return; 
    277294        } 
    278         [tran setMovie:movie]; 
     295        [state->translation setMovie:movie]; 
    279296        [metaData setMovie:movie]; 
    280297         
     
    286303        BOOL canDisplay = [delegate canDisplayChooser]; 
    287304        if(canDisplay && [thumbs count]) 
    288                 [self getMoviePostersForState:state translation:tran thumbElements:thumbs]; 
     305                [self getMoviePostersForState:state thumbElements:thumbs]; 
    289306        else 
    290307                [self completeWithState:state withStatus:ImportStateUpdated importComplete:canDisplay]; 
    291308} 
    292309 
    293 - (void)getMoviePostersForState:(SapphireMovieImportStateData *)state translation:(SapphireMovieTranslation *)tran thumbElements:(NSArray *)thumbElements; 
     310- (void)getMoviePostersForState:(SapphireMovieImportStateData *)state thumbElements:(NSArray *)thumbElements; 
    294311{ 
    295312        NSMutableArray *previews = [NSMutableArray arrayWithCapacity:[thumbElements count]]; 
     313        SapphireMovieTranslation *tran = state->translation; 
    296314        if([thumbElements count]) 
    297315        { 
    298316                int index = 0; 
    299317                NSManagedObjectContext *moc = [tran managedObjectContext]; 
     318                //Redoing posters, get rid of old ones 
     319                [tran setSelectedPosterIndex:nil]; 
     320                NSEnumerator *posterEnum = [[tran postersSet] objectEnumerator]; 
     321                SapphireMoviePoster *poster; 
     322                while((poster = [posterEnum nextObject]) != nil) 
     323                        [moc deleteObject:poster]; 
     324                 
    300325                NSEnumerator *thumbEnum = [thumbElements objectEnumerator]; 
    301326                NSXMLElement *thumb; 
     
    330355                } 
    331356        } 
    332         if([previews count]) 
     357        if([tran selectedPoster]) 
     358        { 
     359                [self saveMoviePosterAtURL:[[tran selectedPoster] link] forTranslation:tran]; 
     360                [self completeWithState:state withStatus:ImportStateUpdated importComplete:YES]; 
     361        } 
     362        else if([previews count]) 
    333363        { 
    334364                SapphirePosterChooser *posterChooser = [[SapphirePosterChooser alloc] initWithScene:[delegate chooserScene]]; 
     
    342372                { 
    343373                        [posterChooser setPosters:previews]; 
    344                         [posterChooser setFileName:state->lookupName]; 
     374                        [posterChooser setFileName:[NSString stringByCroppingDirectoryPath:state->path toLength:3]]; 
    345375                        [posterChooser setFile:state->file]; 
    346376                        [posterChooser setListTitle:BRLocalizedString(@"Select Movie Poster", @"Prompt the user for poster selection")]; 
     
    430460                return ImportStateNotUpdated; 
    431461        SapphireLog(SAPPHIRE_LOG_IMPORT, SAPPHIRE_LOG_LEVEL_DEBUG, @"Going to movie import %@", path); 
    432         NSString *fileName = [path lastPathComponent]; 
     462        NSString *extLessPath = path; 
     463        if([metaData fileContainerTypeValue] != FILE_CONTAINER_TYPE_VIDEO_TS) 
     464                extLessPath = [extLessPath stringByDeletingPathExtension]; 
     465         
    433466        /*choose between file or directory name for lookup */ 
    434467        NSString *lookupName; 
    435468        if([[SapphireSettings sharedSettings] dirLookup]) 
    436                 lookupName = [[path stringByDeletingLastPathComponent] lastPathComponent]; 
    437         else 
    438                 lookupName = fileName; 
     469                lookupName = [[[path stringByDeletingLastPathComponent] lastPathComponent] lowercaseString]; 
     470        else 
     471                lookupName = [[extLessPath lastPathComponent] lowercaseString]; 
    439472         
    440473        SapphireSiteMovieScraper *siteScraper = [[[SapphireSiteMovieScraper alloc] initWithMovieScraper:scraper delegate:self loader:[SapphireApplianceController urlLoader]] autorelease]; 
    441474        SapphireMovieImportStateData *state = [[[SapphireMovieImportStateData alloc] initWithFile:metaData atPath:path scraper:siteScraper] autorelease]; 
    442475        [state setLookupName:lookupName]; 
    443         /*Get the movie title*/ 
    444         NSString *movieDataLink = nil ; 
    445476        /*Check to see if we know this movie*/ 
    446         NSString *movieTranslationString = [[lookupName lowercaseString] stringByDeletingPathExtension]; 
    447         SapphireLog(SAPPHIRE_LOG_IMPORT, SAPPHIRE_LOG_LEVEL_DETAIL, @"Searching for movie %@", movieTranslationString); 
     477         
     478        /*Look for a year in the title*/ 
     479        NSScanner *titleYearScanner = [NSScanner scannerWithString:state->lookupName]; 
     480        NSString *normalTitle = nil; 
     481        int year = 0; 
     482        BOOL success = YES; 
     483        success &= [titleYearScanner scanUpToString:@"(" intoString:&normalTitle]; 
     484        success &= [titleYearScanner scanString:@"(" intoString:nil]; 
     485        success &= [titleYearScanner scanInt:&year]; 
     486        success &= [titleYearScanner scanString:@")" intoString:nil]; 
     487         
     488        NSString *yearStr = nil; 
     489        if(success) 
     490        { 
     491                yearStr = [NSString stringWithFormat:@"%d", year]; 
     492                if([normalTitle hasSuffix:@" "]) 
     493                   normalTitle = [normalTitle substringToIndex:[normalTitle length]-1]; 
     494                [state setLookupName:normalTitle]; 
     495        } 
     496         
     497        SapphireLog(SAPPHIRE_LOG_IMPORT, SAPPHIRE_LOG_LEVEL_DETAIL, @"Searching for movie \"%@\"", state->lookupName); 
    448498        NSManagedObjectContext *moc = [metaData managedObjectContext]; 
    449         SapphireMovieTranslation *tran = [SapphireMovieTranslation movieTranslationWithName:movieTranslationString inContext:moc]; 
     499        SapphireMovieTranslation *tran = [SapphireMovieTranslation movieTranslationWithName:state->lookupName inContext:moc]; 
     500        [state setTranslation:tran]; 
    450501        int searchIMDBNumber = [metaData searchIMDBNumber]; 
    451502        if(searchIMDBNumber > 0) 
    452503        { 
    453504                if(!tran) 
    454                         tran = [SapphireMovieTranslation createMovieTranslationWithName:movieTranslationString inContext:moc]; 
     505                        tran = [state createTranslationInContext:moc]; 
    455506                [tran setIMDBLink:[NSString stringWithFormat:@"/title/tt%08d", searchIMDBNumber]]; 
    456507        } 
     
    458509        { 
    459510                BOOL nfoPathIsDir = NO; 
    460                 NSString *nfoFilePath=[[path stringByDeletingPathExtension] stringByAppendingPathExtension:@"nfo"]; 
     511                NSString *nfoFilePath=[extLessPath stringByAppendingPathExtension:@"nfo"]; 
    461512                NSString *moviePath = nil; 
    462513                if([[NSFileManager defaultManager] fileExistsAtPath:nfoFilePath isDirectory:&nfoPathIsDir] && !nfoPathIsDir) 
     
    464515                 
    465516                if([moviePath length]) 
     517                { 
     518                        if(tran == nil) 
     519                                tran = [state createTranslationInContext:moc]; 
    466520                        [tran setIMDBLink:moviePath]; 
     521                } 
    467522                else 
    468523                { 
     
    471526                                return ImportStateNotUpdated; 
    472527                         
    473                         /*Look for a year in the title*/ 
    474                         NSString *searchStr = [lookupName stringByDeletingPathExtension]; 
    475                         NSScanner *titleYearScanner = [NSScanner scannerWithString:searchStr]; 
    476                         NSString *normalTitle = nil; 
    477                         int year = 0; 
    478                         BOOL success = YES; 
    479                         success &= [titleYearScanner scanUpToString:@"(" intoString:&normalTitle]; 
    480                         NSString *junk = nil; 
    481                         success &= [titleYearScanner scanString:@"(" intoString:nil]; 
    482                         success &= [titleYearScanner scanInt:&year]; 
    483                         success &= [titleYearScanner scanString:@")" intoString:nil]; 
    484                          
    485                         NSString *yearStr = nil; 
    486                         if(!success) 
    487                         { 
    488                                 normalTitle = searchStr; 
    489                         } 
    490                         else 
    491                                 yearStr = [NSString stringWithFormat:@"%d", year]; 
    492                          
    493                         SapphireLog(SAPPHIRE_LOG_IMPORT, SAPPHIRE_LOG_LEVEL_DEBUG, @"Searching for %@ with year %@", normalTitle, yearStr); 
     528                        SapphireLog(SAPPHIRE_LOG_IMPORT, SAPPHIRE_LOG_LEVEL_DEBUG, @"Searching for %@ with year %@", state->lookupName, yearStr); 
    494529                         
    495530                        /*Ask the user what movie this is*/ 
    496531                        [siteScraper setObject:state]; 
    497                         [siteScraper searchForMovieName:normalTitle year:yearStr]; 
     532                        [siteScraper searchForMovieName:state->lookupName year:yearStr]; 
    498533                        return ImportStateBackground; 
    499534                } 
     
    504539        {        
    505540                [metaData setMovie:movie]; 
    506                 return ImportStateUpdated; 
    507         } 
    508         [self getMovieResultsForState:state translation:tran]; 
     541                if([tran selectedPoster] != nil) 
     542                        return ImportStateUpdated; 
     543                [self getMoviePostersForState:state thumbElements:[NSArray array]]; 
     544                return ImportStateBackground; 
     545        } 
     546        [self getMovieResultsForState:state]; 
    509547        return ImportStateBackground; 
    510548} 
     
    531569} 
    532570 
    533 - (BOOL)stillNeedsDisplayOfChooser:(BRLayerController <SapphireChooser> *)chooser withContext:(SapphireMovieImportStateData *)state 
    534 { 
     571- (BOOL)stillNeedsDisplayOfChooser:(BRLayerController <SapphireChooser> *)chooser withContext:(id)context 
     572{ 
     573        SapphireMovieImportStateData *state = (SapphireMovieImportStateData *)context; 
    535574        if([chooser isKindOfClass:[SapphireMovieChooser class]]) 
    536575        { 
    537                 SapphireMovieChooser *movieChooser = (SapphireMovieChooser *)chooser; 
    538576                NSManagedObjectContext *moc = [state->file managedObjectContext]; 
    539                 NSString *filename = [[[movieChooser fileName] lowercaseString] stringByDeletingPathExtension]; 
    540                 SapphireMovieTranslation *tran = [SapphireMovieTranslation movieTranslationWithName:filename inContext:moc]; 
     577                SapphireMovieTranslation *tran = [SapphireMovieTranslation movieTranslationWithName:state->lookupName inContext:moc]; 
     578                if(tran) 
     579                        [state setTranslation:tran]; 
    541580                if([tran IMDBLink]) 
    542581                { 
    543                         [self getMovieResultsForState:state translation:tran]; 
     582                        [self getMovieResultsForState:state]; 
    544583                        return NO; 
    545584                } 
     
    547586        else if([chooser isKindOfClass:[SapphirePosterChooser class]]) 
    548587        { 
    549                 SapphirePosterChooser *posterChooser = (SapphirePosterChooser *)chooser; 
    550                 NSString *filename = [[[posterChooser fileName] lowercaseString] stringByDeletingPathExtension]; 
    551                 NSManagedObjectContext *moc = [state->file managedObjectContext]; 
    552                 SapphireMovieTranslation *tran = [SapphireMovieTranslation movieTranslationWithName:filename inContext:moc]; 
     588                SapphireMovieTranslation *tran = state->translation; 
    553589                if([[tran selectedPoster] link]) 
    554590                { 
     
    561597} 
    562598 
    563 - (void)exhumedChooser:(BRLayerController <SapphireChooser> *)chooser withContext:(SapphireMovieImportStateData *)state 
    564 { 
     599- (void)exhumedChooser:(BRLayerController <SapphireChooser> *)chooser withContext:(id)context 
     600{ 
     601        SapphireMovieImportStateData *state = (SapphireMovieImportStateData *)context; 
    565602        /*See if it was a movie chooser*/ 
    566603        if([chooser isKindOfClass:[SapphireMovieChooser class]]) 
     
    585622                        /*They selected a movie title, save the translation and write it*/ 
    586623                        NSDictionary *movie = [[movieChooser movies] objectAtIndex:selection]; 
    587                         NSString *filename = [[[movieChooser fileName] lowercaseString] stringByDeletingPathExtension]; 
    588                         SapphireMovieTranslation *tran = [SapphireMovieTranslation createMovieTranslationWithName:filename inContext:moc]; 
     624                        SapphireMovieTranslation *tran = [state createTranslationInContext:moc]; 
    589625                        /* Add IMDB Key */ 
    590626                        [tran setIMDBLink:[movie objectForKey:movieTranslationLinkKey]]; 
    591627                        /*We can resume now*/ 
    592                         [self getMovieResultsForState:state translation:tran]; 
     628                        [self getMovieResultsForState:state]; 
    593629                } 
    594630                [SapphireMetaDataSupport save:moc]; 
     
    605641                else 
    606642                { 
    607                         NSString *filename = [[[posterChooser fileName] lowercaseString] stringByDeletingPathExtension]; 
    608                         SapphireMovieTranslation *tran = [SapphireMovieTranslation createMovieTranslationWithName:filename inContext:moc]; 
     643                        SapphireMovieTranslation *tran = state->translation; 
    609644                        [tran setSelectedPosterIndexValue:selectedPoster]; 
    610                         [self saveMoviePosterAtURL:[[tran posterAtIndex:selectedPoster] link] forTranslation:tran]; 
     645                        [self saveMoviePosterAtURL:[[tran selectedPoster] link] forTranslation:tran]; 
    611646                        [self completeWithState:state withStatus:ImportStateUpdated importComplete:YES]; 
    612647                } 
    613                 posterChooser = nil; 
    614648                [SapphireMetaDataSupport save:moc]; 
    615649        } 
  • trunk/SapphireFrappliance/MetaDataImporting/SapphireNfoImporter.m

    r1044 r1179  
    4848        /*Check for NFO file*/ 
    4949        BOOL nfoPathIsDir = NO; 
    50         NSString *nfoFilePath=[[path stringByDeletingPathExtension] stringByAppendingPathExtension:@"nfo"]; 
     50        NSString *extLessPath = path; 
     51        if([metaData fileContainerTypeValue] != FILE_CONTAINER_TYPE_VIDEO_TS) 
     52                extLessPath = [extLessPath stringByDeletingPathExtension]; 
     53         
     54        NSString *nfoFilePath=[extLessPath stringByAppendingPathExtension:@"nfo"]; 
    5155        if(![fm fileExistsAtPath:nfoFilePath isDirectory:&nfoPathIsDir] || nfoPathIsDir) 
    5256                return ImportStateNotUpdated; 
  • trunk/SapphireFrappliance/MetaDataImporting/SapphirePosterChooser.h

    r1017 r1179  
    3131 */ 
    3232@interface SapphirePosterChooser : SapphireMediaMenuController <BRIconSourceProtocol, BRMenuListItemProvider, SapphireLayoutDelegate, SapphireChooser> { 
     33        BOOL                                    displayed;              /*!< @brief YES if currently displayed, NO otherwise*/ 
    3334        NSMutableArray                  *posters;               /*!< @brief The array of poster urls and after loaded, the NSImages*/ 
    3435        NSMutableArray                  *posterLayers;  /*!< @brief The image layers of posters*/ 
     36        NSMutableArray                  *posterData;    /*!< @brief The data for the poster images*/ 
    3537        NSString                                *fileName;              /*!< @brief The movie filename*/ 
    3638        NSString                                *movieTitle;    /*!< @brief The title of the movie*/ 
  • trunk/SapphireFrappliance/MetaDataImporting/SapphirePosterChooser.m

    r1038 r1179  
    4242- (BRBlurryImageLayer *)getPosterLayerForData:(NSData *)thePosterData; 
    4343- (void)loadPoster:(int)index; 
     44- (void)reloadPosterWithData:(NSData *)data atIndex:(int)intIndex; 
    4445@end 
    4546 
     
    9394        [posters release]; 
    9495        [posterLayers release]; 
     96        [posterData release]; 
    9597        [fileName release]; 
    9698        [movieTitle release]; 
     
    187189        int i, count = [posters count]; 
    188190        posterLayers = [posters mutableCopy]; 
     191        posterData = [[NSMutableArray alloc] initWithCapacity:[posters count]]; 
     192        NSNull *nsnull = [NSNull null]; 
     193        for(i=0; i<count; i++) 
     194                [posterData addObject:nsnull]; 
    189195        for(i=0; i<count; i++) 
    190196                [self loadPoster:i]; 
     
    202208        NSString *posterURL = [posters objectAtIndex:index]; 
    203209        [posterLayers replaceObjectAtIndex:index withObject:[self getPosterLayerForData:nil]]; 
    204         [[SapphireApplianceController urlLoader] loadDataURL:posterURL withTarget:self selector:@selector(reloadPosterWithData:atIndex:) object:[NSNumber numberWithInt:index] withPriority:YES]; 
    205 } 
    206  
    207 - (void)reloadPosterWithData:(NSData *)data atIndex:(NSNumber *)index; 
    208 { 
    209         int intIndex = [index intValue]; 
     210        [[SapphireApplianceController urlLoader] loadDataURL:posterURL withTarget:self selector:@selector(gotPosterData:atIndex:) object:[NSNumber numberWithInt:index] withPriority:YES]; 
     211} 
     212 
     213- (void)gotPosterData:(NSData *)data atIndex:(NSNumber *)index; 
     214{ 
     215        if(displayed) 
     216                [self reloadPosterWithData:data atIndex:[index intValue]]; 
     217        else 
     218                [posterData replaceObjectAtIndex:[index intValue] withObject:data]; 
     219} 
     220 
     221- (void)reloadPosterWithData:(NSData *)data atIndex:(int)intIndex; 
     222{ 
    210223        [posterLayers replaceObjectAtIndex:intIndex withObject:[self getPosterLayerForData:data]]; 
    211224        NSImage *image = [[NSImage alloc] initWithData:data]; 
     
    539552        [[self list] reload]; 
    540553        [super wasPushed]; 
     554        displayed = YES; 
     555        int i, count = [posterData count]; 
     556        for(i=0; i<count; i++) 
     557        { 
     558                id obj = [posterData objectAtIndex:i]; 
     559                if([obj isKindOfClass:[NSData class]]) 
     560                        [self reloadPosterWithData:obj atIndex:i]; 
     561        } 
    541562} 
    542563 
  • trunk/SapphireFrappliance/MetaDataImporting/SapphireScraper.m

    r1141 r1179  
    228228- (void)clearBuffers 
    229229{ 
    230         for(int i=0; i<SCRAPER_BUFFER_COUNT; i++) 
     230        int i; 
     231        for(i=0; i<SCRAPER_BUFFER_COUNT; i++) 
    231232        {        
    232233                [scraperBuffers[i] release]; 
     
    243244- (void)clearStorchMatches 
    244245{ 
    245         for(int i=0; i<SCRAPER_MATCH_COUNT; i++) 
     246        int i; 
     247        for(i=0; i<SCRAPER_MATCH_COUNT; i++) 
    246248        { 
    247249                [storedMatches[i] release]; 
     
    286288        NSArray *settingDescs = [rootSetting elementsForName:@"setting"]; 
    287289         
    288         int count = [settingDescs count]; 
    289         for(int i=0; i<count; i++) 
     290        int count = [settingDescs count], i; 
     291        for(i=0; i<count; i++) 
    290292        { 
    291293                [self parseSetting:[settingDescs objectAtIndex:i]]; 
     
    341343void bufferBooleanAttributeWithDefault(NSXMLElement *element, NSString *attributeName, BOOL defaultValue, BOOL *values) 
    342344{ 
     345        int i; 
    343346        if(defaultValue) 
    344                 for(int i=0; i<SCRAPER_MATCH_COUNT; i++) 
     347                for(i=0; i<SCRAPER_MATCH_COUNT; i++) 
    345348                        values[i] = YES; 
    346349        else 
     
    352355                NSArray *valueStrings = [attr componentsSeparatedByString:@","]; 
    353356                int count = [valueStrings count]; 
    354                 for(int i=0; i<count; i++) 
     357                for(i=0; i<count; i++) 
    355358                { 
    356359                        int index = [[valueStrings objectAtIndex:i] intValue]; 
     
    575578        if(count) 
    576579        { 
    577                 for(int i=0; i<count; i++) 
     580                int i; 
     581                for(i=0; i<count; i++) 
    578582                        [self parseElement:[regexChildren objectAtIndex:i]]; 
    579583        } 
     
    610614        NSXMLElement *functionElement = [elements objectAtIndex:0]; 
    611615        elements = [functionElement elementsForName:@"RegExp"]; 
    612         int count = [elements count]; 
    613         for(int i=0; i<count; i++) 
     616        int count = [elements count], i; 
     617        for(i=0; i<count; i++) 
    614618        { 
    615619                [self parseElement:[elements objectAtIndex:i]]; 
  • trunk/SapphireFrappliance/MetaDataImporting/SapphireTVShowImporter.m

    r1134 r1179  
    231231} 
    232232 
    233 - (void)retrievedSearchResuls:(NSXMLDocument *)results forObject:(SapphireTVShowImportStateData *)state 
    234 { 
     233- (void)retrievedSearchResuls:(NSXMLDocument *)results forObject:(id)stateObj 
     234{ 
     235        SapphireTVShowImportStateData *state = (SapphireTVShowImportStateData *)stateObj; 
    235236        [state->siteScraper setObject:nil];     //Avoid retain loop 
    236237        if(cancelled) 
     
    286287                SapphireShowChooser *chooser = [[SapphireShowChooser alloc] initWithScene:[delegate chooserScene]]; 
    287288                [chooser setShows:shows]; 
    288                 [chooser setFileName:[NSString stringByCroppingDirectoryPath:state->path toLength:3]];           
     289                [chooser setFileName:[NSString stringByCroppingDirectoryPath:state->path toLength:3]]; 
    289290                [chooser setListTitle:BRLocalizedString(@"Select Show Title", @"Prompt the user for showname with a file")]; 
    290291                /*And display prompt*/ 
     
    307308        { 
    308309                NSString *coverArtPath = [[SapphireMetaDataSupport collectionArtPath] stringByAppendingPathComponent:[NSString stringWithFormat:@"@TV/%@/cover.jpg", [show name]]]; 
    309                 BOOL isDir = NO; 
    310310                if(![[NSFileManager defaultManager] fileExistsAtPath:coverArtPath]) 
    311311                        fetchShowData = YES; 
     
    325325} 
    326326 
    327 - (void)retrievedShowDetails:(NSXMLDocument *)details forObject:(SapphireTVShowImportStateData *)state 
    328 { 
     327- (void)retrievedShowDetails:(NSXMLDocument *)details forObject:(id)stateObj 
     328{ 
     329        SapphireTVShowImportStateData *state = (SapphireTVShowImportStateData *)stateObj; 
    329330        [state->siteScraper setObject:nil];     //Avoid retain loop 
    330331        if(cancelled) 
     
    408409} 
    409410 
    410 - (void)retrievedEpisodeList:(NSXMLDocument *)episodeList forObject:(SapphireTVShowImportStateData *)state 
    411 { 
     411- (void)retrievedEpisodeList:(NSXMLDocument *)episodeList forObject:(id)stateObj 
     412{ 
     413        SapphireTVShowImportStateData *state = (SapphireTVShowImportStateData *)stateObj; 
    412414        [state->siteScraper setObject:nil];     //Avoid retain loop 
    413415        if(cancelled) 
     
    441443} 
    442444 
    443 - (void)retrievedEpisodeDetails:(NSXMLDocument *)details forObject:(SapphireSingleTVShowEpisodeImportStateData *)state 
    444 { 
     445- (void)retrievedEpisodeDetails:(NSXMLDocument *)details forObject:(id)stateObj 
     446{ 
     447        SapphireSingleTVShowEpisodeImportStateData *state = (SapphireSingleTVShowEpisodeImportStateData *)stateObj; 
    445448        SapphireTVShowImportStateData *tvState = state->state; 
    446449        [state->siteScraper setObject:nil];     //Avoid retain loop 
     
    525528        if(state->episodesCompleted == [infoArray count]) 
    526529        { 
    527                 for(int i=0; i<[infoArray count]; i++) 
     530                int i; 
     531                for(i=0; i<[infoArray count]; i++) 
    528532                { 
    529533                        if(![[infoArray objectAtIndex:i] count]) 
     
    593597                return ImportStateNotUpdated; 
    594598        //      NSArray *pathComponents = [path pathComponents]; 
     599        NSString *extLessPath = path; 
     600        if([metaData fileContainerTypeValue] != FILE_CONTAINER_TYPE_VIDEO_TS) 
     601                extLessPath = [extLessPath stringByDeletingPathExtension]; 
     602 
    595603        NSString *fileName = [path lastPathComponent]; 
    596604         
     
    704712        { 
    705713                BOOL nfoPathIsDir = NO; 
    706                 NSString *nfoFilePath=[[path stringByDeletingPathExtension] stringByAppendingPathExtension:@"nfo"]; 
     714                NSString *nfoFilePath=[extLessPath stringByAppendingPathExtension:@"nfo"]; 
    707715                NSString *showPath = nil; 
    708716                if([[NSFileManager defaultManager] fileExistsAtPath:nfoFilePath isDirectory:&nfoPathIsDir] && !nfoPathIsDir) 
     
    768776} 
    769777 
    770 - (BOOL)stillNeedsDisplayOfChooser:(BRLayerController <SapphireChooser> *)chooser withContext:(SapphireTVShowImportStateData *)state 
    771 { 
     778- (BOOL)stillNeedsDisplayOfChooser:(BRLayerController <SapphireChooser> *)chooser withContext:(id)context 
     779{ 
     780        SapphireTVShowImportStateData *state = (SapphireTVShowImportStateData *)context; 
    772781        /*Check for a match done earlier*/ 
    773782        NSManagedObjectContext *moc = [state->file managedObjectContext]; 
     
    782791} 
    783792 
    784 - (void)exhumedChooser:(BRLayerController <SapphireChooser> *)aChooser withContext:(SapphireTVShowImportStateData *)state; 
    785 { 
     793- (void)exhumedChooser:(BRLayerController <SapphireChooser> *)aChooser withContext:(id)context 
     794{ 
     795        SapphireTVShowImportStateData *state = (SapphireTVShowImportStateData *)context; 
    786796        if(![aChooser isKindOfClass:[SapphireShowChooser class]]) 
    787797                return; 
  • trunk/SapphireFrappliance/MetaDataImporting/SapphireVideoTSParser.m

    r913 r1179  
    2424// Instead of declaring them in the header, we declare them here in a category that extends the class. 
    2525 
    26 @interface SapphireVideoTsParser (InternalMethods) 
     26@interface SapphireVideoTsParser () 
    2727 
    2828/*! 
     
    7676#define vts_VideoIsWidescreen(attrs)                 ( attrs[0] & 0x0c) 
    7777 
    78 #define vts_AudioIsDTS(attrs)                        ((attrs[0] & 0xe0) == 0x0c) 
     78#define vts_AudioIsDTS(attrs)                        ((attrs[0] & 0xe0) == 0xc0) 
    7979#define vts_AudioIsSurround(attrs)                   ( attrs[0] & 0x02) 
    8080#define vts_AudioIsCommentary(attrs)                 ( attrs[5] >    1) 
     
    100100static NSString *languageFromEncodedChars( const char firstChar, const char secondChar ) 
    101101{ 
    102         static NSLocale *currentLocale = nil; 
     102        NSLocale *currentLocale = [NSLocale currentLocale]; 
    103103        const char       langCode[]    = { firstChar, secondChar, 0 }; 
    104104         
    105         if( currentLocale == nil ) 
    106                 currentLocale = [NSLocale currentLocale]; 
    107  
    108105        return [currentLocale displayNameForKey:NSLocaleLanguageCode 
    109106                                                                          value:[NSString stringWithCString:langCode encoding:NSASCIIStringEncoding]]; 
     
    319316                audio = commaSeparatedStringFromCollection( audioList ); 
    320317        } 
    321  
    322         if( audio == nil ) 
    323                 audio = BRLocalizedString( @"Not specified", @"No Audio information available for a DVD" );; 
    324318} 
    325319 
     
    355349                subtitles = commaSeparatedStringFromCollection( subtitleList ); 
    356350        } 
    357  
    358         if( subtitles == nil ) 
    359                 subtitles = BRLocalizedString( @"None", @"No Subtitle information available for a DVD" ); 
    360351} 
    361352 
  • trunk/SapphireFrappliance/MetaDataImporting/SapphireXMLFileDataImporter.m

    r1019 r1179  
    9999        /*Check for XML file*/ 
    100100        BOOL xmlPathIsDir = NO; 
    101         NSString *xmlFilePath=[[path stringByDeletingPathExtension] stringByAppendingPathExtension:@"xml"]; 
     101        NSString *extLessPath = path; 
     102        if([metaData fileContainerTypeValue] != FILE_CONTAINER_TYPE_VIDEO_TS) 
     103                extLessPath = [extLessPath stringByDeletingPathExtension]; 
     104 
     105        NSString *xmlFilePath=[extLessPath stringByAppendingPathExtension:@"xml"]; 
    102106        SapphireXMLData *xml = [metaData xmlData]; 
    103107        if(![fm fileExistsAtPath:xmlFilePath isDirectory:&xmlPathIsDir] || xmlPathIsDir) 
  • trunk/SapphireFrappliance/Sapphire.xcodeproj/project.pbxproj

    r1043 r1179  
    6464                F50044160D19A268003FEA08 /* LeopardOnly.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = F5003FF90D19980B003FEA08 /* LeopardOnly.framework */; }; 
    6565                F506593110B22EC800D0F1FE /* SapphireTVDirectory.m in Sources */ = {isa = PBXBuildFile; fileRef = F506593010B22EC800D0F1FE /* SapphireTVDirectory.m */; }; 
     66                F50CCEEE1119E3E300213966 /* CommonMediaPlayer.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = F50CCEEC1119E3BD00213966 /* CommonMediaPlayer.framework */; }; 
    6667                F51BFC1B0D26ACAD00E22363 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F56A19480C3170870022918E /* AppKit.framework */; }; 
    6768                F51BFC1C0D26ACAD00E22363 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 089C1672FE841209C02AAC07 /* Foundation.framework */; }; 
     
    103104                F58AAF7A0ECFB04F0071CF4B /* SapphireLogging.m in Sources */ = {isa = PBXBuildFile; fileRef = F58AAF790ECFB04F0071CF4B /* SapphireLogging.m */; }; 
    104105                F58C52230F13B18F00DE7A65 /* SapphireTextEntryController.m in Sources */ = {isa = PBXBuildFile; fileRef = F58C52220F13B18F00DE7A65 /* SapphireTextEntryController.m */; }; 
     106                F595C614111A679D00C6C322 /* SapphireCMPWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = F595C613111A679D00C6C322 /* SapphireCMPWrapper.m */; }; 
    105107                F59B29D10D9E8C6E002D5DBD /* NSArray-Extensions.m in Sources */ = {isa = PBXBuildFile; fileRef = F5FB82E30D18065F0018E4C9 /* NSArray-Extensions.m */; }; 
    106108                F59BB9180DF43C3E00EC11A2 /* SapphireMetaDataUpgrading.m in Sources */ = {isa = PBXBuildFile; fileRef = F59BB9170DF43C3E00EC11A2 /* SapphireMetaDataUpgrading.m */; }; 
     
    219221 
    220222/* Begin PBXContainerItemProxy section */ 
     223                F500272411235751001B52FE /* PBXContainerItemProxy */ = { 
     224                        isa = PBXContainerItemProxy; 
     225                        containerPortal = F50CCEE71119E3BD00213966 /* CommonMediaPlayer.xcodeproj */; 
     226                        proxyType = 2; 
     227                        remoteGlobalIDString = F500271A11235732001B52FE; 
     228                        remoteInfo = UIDebug; 
     229                }; 
    221230                F50044110D19A242003FEA08 /* PBXContainerItemProxy */ = { 
    222231                        isa = PBXContainerItemProxy; 
     
    232241                        remoteGlobalIDString = F5B4186D0D0B29D800BDD361; 
    233242                        remoteInfo = "Complete Sapphire"; 
     243                }; 
     244                F50CCEEB1119E3BD00213966 /* PBXContainerItemProxy */ = { 
     245                        isa = PBXContainerItemProxy; 
     246                        containerPortal = F50CCEE71119E3BD00213966 /* CommonMediaPlayer.xcodeproj */; 
     247                        proxyType = 2; 
     248                        remoteGlobalIDString = 8DC2EF5B0486A6940098B216; 
     249                        remoteInfo = CommonMediaPlayer; 
     250                }; 
     251                F50CCEF11119E3EE00213966 /* PBXContainerItemProxy */ = { 
     252                        isa = PBXContainerItemProxy; 
     253                        containerPortal = F50CCEE71119E3BD00213966 /* CommonMediaPlayer.xcodeproj */; 
     254                        proxyType = 1; 
     255                        remoteGlobalIDString = 8DC2EF4F0486A6940098B216; 
     256                        remoteInfo = CommonMediaPlayer; 
    234257                }; 
    235258                F532EC470E44FBC900DBEE13 /* PBXContainerItemProxy */ = { 
     
    405428                                F59FEEFD0ED85FEF0052012E /* SapphireTakeTwoPointTwoCompatClasses.framework in CopyFiles */, 
    406429                                F54A38ED109F43C600DCC808 /* SapphireTakeThreeCompatClasses.framework in CopyFiles */, 
     430                                F50CCEEE1119E3E300213966 /* CommonMediaPlayer.framework in CopyFiles */, 
    407431                        ); 
    408432                        runOnlyForDeploymentPostprocessing = 0; 
     
    433457                F506592F10B22EC800D0F1FE /* SapphireTVDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SapphireTVDirectory.h; sourceTree = "<group>"; }; 
    434458                F506593010B22EC800D0F1FE /* SapphireTVDirectory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SapphireTVDirectory.m; sourceTree = "<group>"; }; 
     459                F50CCEE71119E3BD00213966 /* CommonMediaPlayer.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CommonMediaPlayer.xcodeproj; path = ../CommonMediaPlayer/CommonMediaPlayer.xcodeproj; sourceTree = SOURCE_ROOT; }; 
    435460                F5185B400D1344D700712020 /* ExceptionHandling.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ExceptionHandling.framework; path = /System/Library/Frameworks/ExceptionHandling.framework; sourceTree = "<absolute>"; }; 
    436461                F51BFD2D0D26BDF300E22363 /* SapphireCompatibilityClasses.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SapphireCompatibilityClasses.xcodeproj; path = ../SapphireCompatibilityClasses/SapphireCompatibilityClasses.xcodeproj; sourceTree = "<group>"; }; 
     
    494519                F58C52210F13B18F00DE7A65 /* SapphireTextEntryController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SapphireTextEntryController.h; sourceTree = "<group>"; }; 
    495520                F58C52220F13B18F00DE7A65 /* SapphireTextEntryController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SapphireTextEntryController.m; sourceTree = "<group>"; }; 
     521                F595C612111A679D00C6C322 /* SapphireCMPWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SapphireCMPWrapper.h; sourceTree = "<group>"; }; 
     522                F595C613111A679D00C6C322 /* SapphireCMPWrapper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SapphireCMPWrapper.m; sourceTree = "<group>"; }; 
    496523                F59BB9160DF43C3E00EC11A2 /* SapphireMetaDataUpgrading.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SapphireMetaDataUpgrading.h; sourceTree = "<group>"; }; 
    497524                F59BB9170DF43C3E00EC11A2 /* SapphireMetaDataUpgrading.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SapphireMetaDataUpgrading.m; sourceTree = "<group>"; }; 
     
    747774                                19C28FB8FE9D52D311CA2CBB /* Products */, 
    748775                                F51BFD2D0D26BDF300E22363 /* SapphireCompatibilityClasses.xcodeproj */, 
     776                                F50CCEE71119E3BD00213966 /* CommonMediaPlayer.xcodeproj */, 
    749777                                F532EC3B0E44FB8100DBEE13 /* main_debug.m */, 
    750778                                F5BA7E6E0EE336A900A5C679 /* main_rescanDir.m */, 
     
    843871                        sourceTree = "<group>"; 
    844872                }; 
     873                F50CCEE81119E3BD00213966 /* Products */ = { 
     874                        isa = PBXGroup; 
     875                        children = ( 
     876                                F50CCEEC1119E3BD00213966 /* CommonMediaPlayer.framework */, 
     877                                F500272511235751001B52FE /* UIDebug */, 
     878                        ); 
     879                        name = Products; 
     880                        sourceTree = "<group>"; 
     881                }; 
    845882                F56B6D8F0C34713400E934AA /* Browser */ = { 
    846883                        isa = PBXGroup; 
     
    947984                                F5505DC51040864D0064D392 /* SapphireAudioNowPlayingController.h */, 
    948985                                F5505DC61040864D0064D392 /* SapphireAudioNowPlayingController.m */, 
     986                                F595C612111A679D00C6C322 /* SapphireCMPWrapper.h */, 
     987                                F595C613111A679D00C6C322 /* SapphireCMPWrapper.m */, 
    949988                        ); 
    950989                        path = Players; 
     
    12021241                                F59FEEFC0ED85FE50052012E /* PBXTargetDependency */, 
    12031242                                F54A38EC109F43B900DCC808 /* PBXTargetDependency */, 
     1243                                F50CCEF21119E3EE00213966 /* PBXTargetDependency */, 
    12041244                        ); 
    12051245                        name = Sapphire; 
     
    12971337                        projectReferences = ( 
    12981338                                { 
     1339                                        ProductGroup = F50CCEE81119E3BD00213966 /* Products */; 
     1340                                        ProjectRef = F50CCEE71119E3BD00213966 /* CommonMediaPlayer.xcodeproj */; 
     1341                                }, 
     1342                                { 
    12991343                                        ProductGroup = F5EBE6D80D4A775400042BA0 /* Products */; 
    13001344                                        ProjectRef = F51BFD2D0D26BDF300E22363 /* SapphireCompatibilityClasses.xcodeproj */; 
     
    13161360 
    13171361/* Begin PBXReferenceProxy section */ 
     1362                F500272511235751001B52FE /* UIDebug */ = { 
     1363                        isa = PBXReferenceProxy; 
     1364                        fileType = "compiled.mach-o.executable"; 
     1365                        path = UIDebug; 
     1366                        remoteRef = F500272411235751001B52FE /* PBXContainerItemProxy */; 
     1367                        sourceTree = BUILT_PRODUCTS_DIR; 
     1368                }; 
     1369                F50CCEEC1119E3BD00213966 /* CommonMediaPlayer.framework */ = { 
     1370                        isa = PBXReferenceProxy; 
     1371                        fileType = wrapper.framework; 
     1372                        path = CommonMediaPlayer.framework; 
     1373                        remoteRef = F50CCEEB1119E3BD00213966 /* PBXContainerItemProxy */; 
     1374                        sourceTree = BUILT_PRODUCTS_DIR; 
     1375                }; 
    13181376                F54A38E8109F43A600DCC808 /* SapphireTakeThreeCompatClasses.framework */ = { 
    13191377                        isa = PBXReferenceProxy; 
     
    15351593                                F5F515EA10DD8B21006B9DED /* SapphireSiteScraper.m in Sources */, 
    15361594                                F542052810E6D1FE007B0D3A /* SapphireNfoImporter.m in Sources */, 
     1595                                F595C614111A679D00C6C322 /* SapphireCMPWrapper.m in Sources */, 
    15371596                        ); 
    15381597                        runOnlyForDeploymentPostprocessing = 0; 
     
    15831642                        target = F5B4186D0D0B29D800BDD361 /* Complete Sapphire */; 
    15841643                        targetProxy = F5038FA60DE7AB600046C674 /* PBXContainerItemProxy */; 
     1644                }; 
     1645                F50CCEF21119E3EE00213966 /* PBXTargetDependency */ = { 
     1646                        isa = PBXTargetDependency; 
     1647                        name = CommonMediaPlayer; 
     1648                        targetProxy = F50CCEF11119E3EE00213966 /* PBXContainerItemProxy */; 
    15851649                }; 
    15861650                F532EC480E44FBC900DBEE13 /* PBXTargetDependency */ = { 
     
    17321796                                GCC_WARN_ABOUT_RETURN_TYPE = YES; 
    17331797                                GCC_WARN_UNUSED_VARIABLE = YES; 
     1798                                OTHER_CFLAGS = "-DDEBUG"; 
    17341799                                PREBINDING = NO; 
    17351800                                SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk"; 
     
    18351900                                FRAMEWORK_SEARCH_PATHS = ( 
    18361901                                        "$(inherited)", 
    1837                                         "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", 
    1838                                 ); 
     1902                                        "$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)", 
     1903                                ); 
     1904                                FRAMEWORK_SEARCH_PATHS_QUOTED_1 = "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\""; 
    18391905                                GCC_DYNAMIC_NO_PIC = NO; 
    18401906                                GCC_ENABLE_FIX_AND_CONTINUE = YES; 
     
    18421908                                GCC_OPTIMIZATION_LEVEL = 0; 
    18431909                                GCC_PRECOMPILE_PREFIX_HEADER = YES; 
    1844                                 GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; 
     1910                                GCC_PREFIX_HEADER = FRAppliance/Sapphire_Prefix.pch; 
    18451911                                INSTALL_PATH = /usr/local/bin; 
     1912                                LIBRARY_SEARCH_PATHS = ( 
     1913                                        "$(inherited)", 
     1914                                        "\"$(SRCROOT)/pcre\"", 
     1915                                ); 
    18461916                                OTHER_LDFLAGS = ( 
    18471917                                        "-undefined", 
     
    18841954                        buildSettings = { 
    18851955                                COPY_PHASE_STRIP = NO; 
     1956                                FRAMEWORK_SEARCH_PATHS = ( 
     1957                                        "$(inherited)", 
     1958                                        "$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)", 
     1959                                ); 
     1960                                FRAMEWORK_SEARCH_PATHS_QUOTED_1 = "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\""; 
    18861961                                GCC_PRECOMPILE_PREFIX_HEADER = YES; 
    1887                                 GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; 
     1962                                GCC_PREFIX_HEADER = FRAppliance/Sapphire_Prefix.pch; 
    18881963                                INSTALL_PATH = /usr/local/bin; 
     1964                                LIBRARY_SEARCH_PATHS = ( 
     1965                                        "$(inherited)", 
     1966                                        "\"$(SRCROOT)/pcre\"", 
     1967                                ); 
    18891968                                OTHER_LDFLAGS = ( 
    18901969                                        "-framework", 
     
    19031982                        buildSettings = { 
    19041983                                COPY_PHASE_STRIP = YES; 
     1984                                FRAMEWORK_SEARCH_PATHS = ( 
     1985                                        "$(inherited)", 
     1986                                        "$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)", 
     1987                                ); 
     1988                                FRAMEWORK_SEARCH_PATHS_QUOTED_1 = "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\""; 
    19051989                                GCC_PRECOMPILE_PREFIX_HEADER = YES; 
    1906                                 GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; 
     1990                                GCC_PREFIX_HEADER = FRAppliance/Sapphire_Prefix.pch; 
    19071991                                INSTALL_PATH = /usr/local/bin; 
     1992                                LIBRARY_SEARCH_PATHS = ( 
     1993                                        "$(inherited)", 
     1994                                        "\"$(SRCROOT)/pcre\"", 
     1995                                ); 
    19081996                                OTHER_LDFLAGS = ( 
    19091997                                        "-framework", 
  • trunk/SapphireFrappliance/main_debug.m

    r1049 r1179  
    4343#import "SapphireMovieDirectory.h" 
    4444 
     45//#define TESTING_UPGRADE 
     46//#define LISTING_MOVIES 
     47//#define TESTING_XML_IMPORT 
     48//#define TESTING_FILE_SCANNING 
     49//#define TESTING_UPDATED_VALUES 
     50//#define TESTING_DIRECTORY_RESCAN 
     51//#define TESTING_AUTO_PRUNING 
     52#define TESTING_MOVIE_IMPORT 
     53//#define TESTING_TV_SHOW_IMPORT 
     54//#define TESTING_MULTIPLE_AND_SINGLE_TV_SHOW_IMPORT 
     55//#define TESTING_MOVIE_VIRTUAL_DIRS_IN_XML 
     56//#define TESTING_TV_IMPORT_THROUGH_XML 
     57 
    4558void overrideApplicationSupportdir(NSString *override); 
    4659 
     
    151164- (BOOL)canDisplayChooser 
    152165{ 
    153         return NO; 
     166        return YES; 
    154167} 
    155168 
     
    161174- (void)displayChooser:(BRLayerController <SapphireChooser> *)chooser forImporter:(id <SapphireImporter>)importer withContext:(id)context 
    162175{ 
     176        [chooser itemSelected:1]; 
     177        [importer exhumedChooser:chooser withContext:context]; 
    163178} 
    164179 
     
    181196         
    182197//      overrideApplicationSupportdir([NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Frontrow"]); 
    183 //#define TESTING_UPGRADE 
    184198#ifdef TESTING_UPGRADE 
    185199        { 
     
    202216         
    203217        //Debug code goes here: 
    204 //#define LISTING_MOVIES 
    205218#ifdef LISTING_MOVIES 
    206219        { 
     
    218231        } 
    219232#endif 
    220 //#define TESTING_XML_IMPORT 
    221233#ifdef TESTING_XML_IMPORT 
    222234        { 
     
    230242        } 
    231243#endif 
    232 //#define TESTING_FILE_SCANNING 
    233244#ifdef TESTING_FILE_SCANNING 
    234245        { 
     
    246257        } 
    247258#endif 
    248 //#define TESTING_UPDATED_VALUES 
    249259#ifdef TESTING_UPDATED_VALUES 
    250260        { 
     
    260270        } 
    261271#endif 
    262 //#define TESTING_DIRECTORY_RESCAN 
    263272#ifdef TESTING_DIRECTORY_RESCAN 
    264273        { 
     
    271280        } 
    272281#endif 
    273 //#define TESTING_AUTO_PRUNING 
    274282#ifdef TESTING_AUTO_PRUNING 
    275283        { 
     
    293301        } 
    294302#endif 
    295 #define TESTING_MOVIE_IMPORT 
    296303#ifdef TESTING_MOVIE_IMPORT 
    297304        { 
    298                 SapphireFileMetaData *file = [SapphireFileMetaData fileWithPath:@"/Users/gbooker/Movies/MovieTests/FIFTH_ELEMENT.mov" inContext:moc]; 
     305                SapphireFileMetaData *file = [SapphireFileMetaData createFileWithPath:@"/Users/gbooker/Movies/MovieTests/FIFTH_ELEMENT.mov" inContext:moc]; 
    299306                SapphireMovieImporter *import = [[SapphireMovieImporter alloc] init]; 
    300307                [file setToReimportFromMaskValue:IMPORT_TYPE_MOVIE_MASK]; 
     308                [file setToResetImportDecisions]; 
    301309                [importManager importer:import importMetaData:file path:[file path]]; 
    302310                [import release]; 
    303311        } 
    304312#endif 
    305 //#define TESTING_TV_SHOW_IMPORT 
    306313#ifdef TESTING_TV_SHOW_IMPORT 
    307314        { 
    308                 SapphireFileMetaData *file = [SapphireFileMetaData fileWithPath:@"/Users/gbooker/Movies/TVShowsTests/Doctor Who (2005) S03ES1 Voyage of the Damned.avi" inContext:moc]; 
     315                SapphireFileMetaData *file = [SapphireFileMetaData createFileWithPath:@"/Users/gbooker/Movies/TVShowsTests/Doctor Who (2005) S03ES1 Voyage of the Damned.avi" inContext:moc]; 
    309316                SapphireTVShowImporter *import = [[SapphireTVShowImporter alloc] init]; 
    310317                [file setToReimportFromMaskValue:IMPORT_TYPE_TVSHOW_MASK]; 
     
    313320        } 
    314321#endif 
    315 //#define TESTING_MULTIPLE_AND_SINGLE_TV_SHOW_IMPORT 
    316322#ifdef TESTING_MULTIPLE_AND_SINGLE_TV_SHOW_IMPORT 
    317323        { 
     
    328334        } 
    329335#endif 
    330 //#define TESTING_MOVIE_VIRTUAL_DIRS_IN_XML 
    331336#ifdef TESTING_MOVIE_VIRTUAL_DIRS_IN_XML 
    332337        { 
     
    337342        } 
    338343#endif 
    339 //#define TESTING_TV_IMPORT_THROUGH_XML 
    340344#ifdef TESTING_TV_IMPORT_THROUGH_XML 
    341345        {