Changeset 658

Show
Ignore:
Timestamp:
08/17/08 18:10:53 (4 months ago)
Author:
gbooker
Message:

Properly background import instead of waiting on background process to complete. This was the intended operation from the beginning

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/CoreData/SapphireFrappliance/MetaDataImporting/SapphireImporterDataMenu.m

    r650 r658  
    308308} 
    309309 
     310- (void)updateDisplay 
     311{ 
     312        /*Check for completion*/ 
     313        if(current == max) 
     314        { 
     315                [self setListTitle:BRLocalizedString(@"Import Complete", @"The import is complete")]; 
     316                [self setFileProgress:[NSString stringWithFormat:BRLocalizedString(@"Updated %0.0f Entries.", @"Import complete format with number updated"), updated]]; 
     317                [self setCurrentFile:@""]; 
     318                [self setCompletionText]; 
     319                [bar setPercentage:100.0f]; 
     320                [self setButtonTitle:nil]; 
     321                action = NULL; 
     322 
     323                [SapphireMetaDataSupport save:moc]; 
     324                 
     325                NSEnumerator *colEnum = [collectionDirectories objectEnumerator]; 
     326                SapphireCollectionDirectory *col; 
     327                while((col = [colEnum nextObject]) != nil) 
     328                        [col.directory refreshAllObjects]; 
     329        } 
     330        else 
     331        { 
     332                if([importItems count]) 
     333                { 
     334                        SapphireFileMetaData *fileMeta = [importItems objectAtIndex:0]; 
     335                        NSString * fileName=[[fileMeta path] lastPathComponent] ; 
     336                        [self setCurrentFile:[NSString stringWithFormat:BRLocalizedString(@"Fetching For: %@", "Current TV Show import process format, filename"),fileName]];            
     337                } 
     338                else 
     339                { 
     340                        [self setCurrentFile:BRLocalizedString(@"Waiting for background import to complete", @"The import is complete, just waiting on background processes")]; 
     341                } 
     342                [self setFileProgress:[NSString stringWithFormat:BRLocalizedString(@"Finished Processing: %0.0f / %0.0f", @"Import progress format, current and the max"), current, max,updated]]; 
     343                [bar setPercentage:current/max * 100.0f]; 
     344        } 
     345        [SapphireFrontRowCompat renderScene:[self scene]];               
     346} 
     347 
    310348/*! 
    311349 * @brief Timer function to start the import of the next file 
     
    319357                [importTimer invalidate]; 
    320358                importTimer = nil; 
     359 
     360                /*Update the display*/ 
     361                [self updateDisplay]; 
     362 
    321363                if([importItems count]) 
    322364                { 
    323                         /*Update the display*/ 
    324                         SapphireFileMetaData *fileMeta = [importItems objectAtIndex:0]; 
    325                         NSString * fileName=[[fileMeta path] lastPathComponent] ; 
    326                         [self setCurrentFile:[NSString stringWithFormat:BRLocalizedString(@"Fetching For: %@", "Current TV Show import process format, filename"),fileName]]; 
    327                          
    328365                        current++ ; 
    329366                        /*Update the imported count*/ 
     
    336373                                backgrounded = NO; 
    337374                                current--; 
    338                                 return; 
     375                                if(suspended) 
     376                                        return; 
    339377                        } 
    340378                         
    341379                        /*Start with the first item*/ 
    342380                        [importItems removeObjectAtIndex:0]; 
    343                 } 
    344                 else 
    345                         [self setCurrentFile:BRLocalizedString(@"Waiting for background import to complete", @"The import is complete, just waiting on background processes")]; 
    346                 [self setFileProgress:[NSString stringWithFormat:BRLocalizedString(@"Finished Processing: %0.0f / %0.0f", @"Import progress format, current and the max"), current, max,updated]]; 
    347                 [bar setPercentage:current/max * 100.0f]; 
    348                  
    349                 /*Check for completion*/ 
    350                 if(current == max) 
    351                 { 
    352                         [SapphireMetaDataSupport save:moc]; 
    353                         /*Update display*/ 
    354                         [self setButtonTitle:nil]; 
    355                         action = NULL; 
    356                         [self setListTitle:BRLocalizedString(@"Import Complete", @"The import is complete")]; 
    357                         [self setFileProgress:[NSString stringWithFormat:BRLocalizedString(@"Updated %0.0f Entries.", @"Import complete format with number updated"), updated]]; 
    358                         [self setCurrentFile:@""]; 
    359                         [self setCompletionText]; 
    360                         [SapphireFrontRowCompat renderScene:[self scene]]; 
    361                          
    362                         NSEnumerator *colEnum = [collectionDirectories objectEnumerator]; 
    363                         SapphireCollectionDirectory *col; 
    364                         while((col = [colEnum nextObject]) != nil) 
    365                                 [col.directory refreshAllObjects]; 
    366                 } 
    367                 else 
    368                 { 
    369381                        importTimer = [NSTimer scheduledTimerWithTimeInterval:0.0f target:self selector:@selector(importNextItem:) userInfo:nil repeats:NO]; 
    370382                } 
     
    412424                updated++; 
    413425        current++; 
    414         [self importNextItem:nil]; 
     426        [self updateDisplay]; 
    415427} 
    416428 
    417429- (void)itemImportBackgrounded 
    418430{ 
    419         if([importItems count] && !suspended) 
    420                 [importItems removeObjectAtIndex:0]; 
    421431        backgrounded = YES; 
    422432}