Changeset 1269
- Timestamp:
- 06/06/10 18:45:50 (2 years ago)
- Location:
- trunk/SapphireFrappliance
- Files:
-
- 7 modified
-
Browser/SapphireMarkMenu.m (modified) (2 diffs)
-
MetaData/SapphireMObjects/SapphireSeason.h (modified) (1 diff)
-
MetaData/SapphireMObjects/SapphireSeason.m (modified) (1 diff)
-
MetaData/SapphireMObjects/SapphireTVShow.h (modified) (1 diff)
-
MetaData/SapphireMObjects/SapphireTVShow.m (modified) (2 diffs)
-
MetaData/Support/SapphireOtherInformation.m (modified) (1 diff)
-
Settings/SapphireSettings.m (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/SapphireFrappliance/Browser/SapphireMarkMenu.m
r1268 r1269 697 697 [invoke setTarget:self]; 698 698 [invoke setArgument:&dirMeta atIndex:3]; 699 [invoke retainArguments]; 699 700 700 701 SapphireConfirmPrompt *confirm = [[SapphireConfirmPrompt alloc] initWithScene:[self scene] title:BRLocalizedString(@"Delete Directory?", @"Delete Directory Prompt Title") subtitle:[NSString stringWithFormat:BRLocalizedString(@"Are you sure you wish to delete %@?", @"parameter is file/dir that is being deleted"), [[dirMeta path] lastPathComponent]] invokation:invoke]; … … 787 788 [invoke setTarget:self]; 788 789 [invoke setArgument:&fileMeta atIndex:3]; 790 [invoke retainArguments]; 789 791 790 792 SapphireConfirmPrompt *confirm = [[SapphireConfirmPrompt alloc] initWithScene:[self scene] title:BRLocalizedString(@"Delete File?", @"Delete File Prompt Title") subtitle:[NSString stringWithFormat:BRLocalizedString(@"Are you sure you wish to delete %@?", @"parameter is file/dir that is being deleted"), [[fileMeta path] lastPathComponent]] invokation:invoke]; -
trunk/SapphireFrappliance/MetaData/SapphireMObjects/SapphireSeason.h
r1251 r1269 9 9 - (NSComparisonResult)compare:(SapphireSeason *)other; 10 10 - (NSString *)seasonName; 11 - (NSString *)autoSortPath; 11 12 @end -
trunk/SapphireFrappliance/MetaData/SapphireMObjects/SapphireSeason.m
r1251 r1269 62 62 } 63 63 64 - (NSString *)autoSortPath 65 { 66 NSString *showPath = [self.tvShow autoSortPath]; 67 if(showPath == nil) 68 return nil; 69 70 return [showPath stringByAppendingPathComponent:[self seasonName]]; 71 } 72 64 73 - (NSPredicate *)metaFileFetchPredicate 65 74 { -
trunk/SapphireFrappliance/MetaData/SapphireMObjects/SapphireTVShow.h
r1261 r1269 10 10 - (NSComparisonResult)compare:(SapphireTVShow *)other; 11 11 - (NSString *)calculateAutoSortPath; 12 - (NSString *)autoSortPath; 13 - (void)setAutoSortPath:(NSString *)path; 12 14 @end -
trunk/SapphireFrappliance/MetaData/SapphireMObjects/SapphireTVShow.m
r1261 r1269 9 9 #import "SapphireTVTranslation.h" 10 10 #import "SapphireFileMetaData.h" 11 #import "SapphireOtherInformation.h" 12 13 NSString *autoSortPathKey = @"autoSortPath"; 11 14 12 15 @implementation SapphireTVShow … … 179 182 } 180 183 184 if(!cropTwoDirs) 185 { 186 NSString *lastPathComponent = [sortPath lastPathComponent]; 187 if([[lastPathComponent lowercaseString] hasPrefix:@"season"]) 188 sortPath = [sortPath stringByDeletingLastPathComponent]; 189 } 190 181 191 return sortPath; 182 192 } 183 193 194 - (NSString *)autoSortPath 195 { 196 return [self otherInformationForKey:autoSortPathKey]; 197 } 198 199 - (void)setAutoSortPath:(NSString *)path 200 { 201 [self setOtherObject:path forKey:autoSortPathKey]; 202 } 203 184 204 @end -
trunk/SapphireFrappliance/MetaData/Support/SapphireOtherInformation.m
r1251 r1269 54 54 { 55 55 NSMutableDictionary *mutOther = [[self otherInformation] mutableCopy]; 56 if(mutOther == nil) 57 mutOther = [[NSMutableDictionary alloc] init]; 56 58 [mutOther setObject:obj forKey:key]; 57 59 NSDictionary *dict = [mutOther copy]; -
trunk/SapphireFrappliance/Settings/SapphireSettings.m
r1251 r1269 34 34 #import "SapphireDirectoryMetaData.h" 35 35 #import "SapphireMetaDataSupport.h" 36 #import "SapphireTVShow.h" 37 #import "SapphireConfirmPrompt.h" 38 #import "CoreDataSupportFunctions.h" 39 #import "SapphireErrorDisplayController.h" 40 36 41 #import <SapphireCompatClasses/SapphireFrontRowCompat.h> 37 42 #import "NSString-Extensions.h" … … 68 73 COMMAND_IMPORT_TV_DATA, 69 74 COMMAND_IMPORT_MOVIE_DATA, 75 COMMAND_IMPORT_TV_AUTOSORT_CALCULATE, 70 76 COMMAND_IMPORT_HIDE_POSTER_CHOOSER, 71 77 COMMAND_IMPORT_USE_DIR_NAME, … … 134 140 [theme gem:IMDB_GEM_KEY], SETTING_GEM, 135 141 [NSNumber numberWithInt:COMMAND_IMPORT_MOVIE_DATA], SETTING_COMMAND, 142 nil], 143 [NSDictionary dictionaryWithObjectsAndKeys: 144 BRLocalizedString(@" Calculate TV Directories", @"Calculate TV Dirs menu item"), SETTING_NAME, 145 BRLocalizedString(@"Tells Sapphire to calculate directories where each TV show is stored.", @"Calculate TV Dirs description"), SETTING_DESCRIPTION, 146 [theme gem:TVR_GEM_KEY], SETTING_GEM, 147 [NSNumber numberWithInt:COMMAND_IMPORT_TV_AUTOSORT_CALCULATE], SETTING_COMMAND, 136 148 nil], 137 149 /* [NSDictionary dictionaryWithObjectsAndKeys: … … 424 436 } 425 437 438 - (SapphireConfirmPrompt *)nextAutoSortPathConfirm:(NSArray *)shows 439 { 440 int i, count = [shows count]; 441 SapphireTVShow *show; 442 NSString *calcAutoPath; 443 NSString *autoPath; 444 for(i=0; i<count; i++) 445 { 446 show = [shows objectAtIndex:i]; 447 calcAutoPath = [show calculateAutoSortPath]; 448 autoPath = [show autoSortPath]; 449 if(autoPath == nil && calcAutoPath == nil) 450 continue; 451 if(autoPath == nil || calcAutoPath == nil) 452 //Only one of them is nil 453 break; 454 if(![autoPath isEqualToString:calcAutoPath]) 455 break; 456 } 457 458 if(i == count) 459 return nil; 460 461 NSArray *newArray = [shows subarrayWithRange:NSMakeRange(i+1, count-i-1)]; 462 NSInvocation *invoke = [NSInvocation invocationWithMethodSignature:[self methodSignatureForSelector:@selector(promptResult:forShow:remaining:)]]; 463 [invoke setTarget:self]; 464 [invoke setSelector:@selector(promptResult:forShow:remaining:)]; 465 [invoke setArgument:&show atIndex:3]; 466 [invoke setArgument:&newArray atIndex:4]; 467 [invoke retainArguments]; 468 469 NSString *question; 470 if(calcAutoPath != nil) 471 question = [NSString stringWithFormat:BRLocalizedString(@"Do you want to set the show path for %@ to %@?", @"Prompt for setting a show's path, arguments are show name and path"), [show name], calcAutoPath]; 472 else 473 question = [NSString stringWithFormat:BRLocalizedString(@"Do you want to delete the show path for %@?", @"Prompt for deleting a show's path, argument is show name"), [show name]]; 474 475 SapphireConfirmPrompt *prompt = [[SapphireConfirmPrompt alloc] initWithScene:[self scene] title:BRLocalizedString(@"Show Path", @"Show Path") subtitle:question invokation:invoke]; 476 return [prompt autorelease]; 477 } 478 479 - (BRLayerController *)promptResult:(SapphireConfirmPromptResult)result forShow:(SapphireTVShow *)show remaining:(NSArray *)remain 480 { 481 if(result == SapphireConfirmPromptResultAbort) 482 return nil; 483 484 if(result == SapphireConfirmPromptResultOK) 485 { 486 [show setAutoSortPath:[show calculateAutoSortPath]]; 487 [SapphireMetaDataSupport save:moc]; 488 } 489 490 return [self nextAutoSortPathConfirm:remain]; 491 } 492 426 493 - (void)wasExhumed 427 494 { … … 546 613 [menu release]; 547 614 [importer release]; 615 break; 616 } 617 case COMMAND_IMPORT_TV_AUTOSORT_CALCULATE: 618 { 619 NSArray *shows = doFetchRequest(SapphireTVShowName, moc, nil); 620 SapphireConfirmPrompt *confirm = [self nextAutoSortPathConfirm:shows]; 621 if(confirm != nil) 622 [[self stack] pushController:confirm]; 623 else 624 { 625 SapphireErrorDisplayController *error = [[SapphireErrorDisplayController alloc] initWithScene:[self scene] error:BRLocalizedString(@"No Changes", @"No Changes") longError:BRLocalizedString(@"Sapphire didn't detect any changes to show paths", @"Display info for no show path changes detected")]; 626 [[self stack] pushController:error]; 627 [error release]; 628 } 548 629 break; 549 630 }
