Ticket #120: directory_lookup.patch
| File directory_lookup.patch, 5.2 kB (added by Stephan, 10 months ago) |
|---|
-
SapphireFrappliance/SapphireMovieImporter.m
old new 26 26 #import "SapphirePosterChooser.h" 27 27 #import <SapphireCompatClasses/SapphireFrontRowCompat.h> 28 28 #import "SapphireShowChooser.h" 29 #import "SapphireSettings.h" 29 30 30 31 #define VERSION_KEY @"Version" 31 32 #define CURRENT_VERSION 2 … … 663 664 /*Get path*/ 664 665 if(![self isMovieCandidate:metaData]) 665 666 return IMPORT_STATE_NOT_UPDATED; 666 /*Get fineName*/667 667 NSString *path = [metaData path]; 668 668 NSString *fileName = [path lastPathComponent]; 669 /*choose between file or directory name for lookup */ 670 NSString *lookupName; 671 if([[SapphireSettings sharedSettings] dirLookup]) 672 lookupName = [[path stringByDeletingLastPathComponent] lastPathComponent]; 673 else 674 lookupName = fileName; 669 675 if([metaData fileClass]==FILE_CLASS_TV_SHOW) /* File is a TV Show - skip it */ 670 676 return IMPORT_STATE_NOT_UPDATED; 671 677 … … 679 685 /*There is no data menu, background import. So we can't ask user, skip*/ 680 686 return IMPORT_STATE_NOT_UPDATED; 681 687 /*Ask the user what movie this is*/ 682 NSArray *movies = [self searchResultsForMovie: fileName];688 NSArray *movies = [self searchResultsForMovie:lookupName]; 683 689 /* No need to prompt the user for an empty set */ 684 690 if(movies==nil) 685 691 { -
SapphireFrappliance/SapphireSettings.h
old new 142 142 - (BOOL)fastSwitching; 143 143 144 144 /*! 145 * @brief Returns whether to use directory based lookup 146 * 147 * @return YES if set, NO otherwise 148 */ 149 - (BOOL)dirLookup; 150 151 /*! 145 152 * @brief Returns the index of the last predicate used 146 153 * 147 154 * @return The index of the last predicate used -
SapphireFrappliance/SapphireSettings.m
old new 50 50 #define HIDE_UI_QUIT_KEY @"HideUIQuit" 51 51 #define ENABLE_FAST_SWITCHING_KEY @"EnableFastSwitching" 52 52 #define USE_AC3_PASSTHROUGH @"EnableAC3Passthrough" 53 #define ENABLE_DIR_LOOKUP @"EnableDirLookup" 53 54 #define DISABLE_ANON_KEY @"DisableAnonymousReporting" 54 55 #define LAST_PREDICATE @"LastPredicate" 55 56 … … 89 90 BRLocalizedString(@" Hide UI Quit", @"Hide the ui quitter menu item"), 90 91 BRLocalizedString(@" Fast Directory Switching", @"Don't rescan directories upon entry and used cached data"), 91 92 BRLocalizedString(@" Enable AC3 Passthrough", @"Enable AC3 Passthrough menu item"), 93 BRLocalizedString(@" Use Directory Lookup", @"Use directory names instead of filename for movie lookup"), 92 94 BRLocalizedString(@" Disable Anonymous Reporting", @"Disable the anonymous reporting for aid in future features"), nil]; 93 95 94 96 settingDescriptions=[[NSArray alloc] initWithObjects: … … 108 110 BRLocalizedString(@"Tells Sapphire to hide the main menu element forcing frontrow to quit.", @"Hide the ui quitter description"), 109 111 BRLocalizedString(@"Tells Sapphire that when using a filter, use the cached data to setup directories rather than scanning the directories themselves for new files.", @"Fast Directory Switching description"), 110 112 BRLocalizedString(@"Tells Sapphire that you have an AC3 decoder and to enable passthrough of the full audio information to the decoder. This is how you get 5.1 output.", @"Enable AC3 Passthrough description"), 113 BRLocalizedString(@"Tells Sapphire that you want to use directory instead of filenames for movie lookup", @"Enable Directory lookup description"), 111 114 BRLocalizedString(@"Tells Sapphire to not report any anonymous information on how you use Sapphire. Anonymous reporting enables us to improve the plugin for future use.", @"Disable the anonymous reporting description"), nil]; 112 115 113 116 keys = [[NSArray alloc] initWithObjects: @"", … … 126 129 HIDE_UI_QUIT_KEY, 127 130 ENABLE_FAST_SWITCHING_KEY, 128 131 USE_AC3_PASSTHROUGH, 132 ENABLE_DIR_LOOKUP, 129 133 DISABLE_ANON_KEY, nil]; 130 134 SapphireTheme *theme = [SapphireTheme sharedTheme]; 131 135 gems = [[NSArray alloc] initWithObjects: [theme gem:IMPORT_GEM_KEY], … … 144 148 [theme gem:FRONTROW_GEM_KEY], 145 149 [theme gem:FAST_GEM_KEY], 146 150 [theme gem:AC3_GEM_KEY], 151 [theme gem:IMDB_GEM_KEY], 147 152 [theme gem:REPORT_GEM_KEY], nil]; 148 153 149 154 path = [dictionaryPath retain]; … … 160 165 [NSNumber numberWithBool:YES], HIDE_UI_QUIT_KEY, 161 166 [NSNumber numberWithBool:YES], ENABLE_FAST_SWITCHING_KEY, 162 167 [NSNumber numberWithBool:NO], USE_AC3_PASSTHROUGH, 168 [NSNumber numberWithBool:NO], ENABLE_DIR_LOOKUP, 163 169 [NSNumber numberWithBool:NO], DISABLE_ANON_KEY, 164 170 [NSNumber numberWithInt:NSNotFound], LAST_PREDICATE, 165 171 nil]; … … 283 289 284 290 } 285 291 292 - (BOOL)dirLookup 293 { 294 return [self boolForKey:ENABLE_DIR_LOOKUP]; 295 296 } 297 286 298 - (int)indexOfLastPredicate 287 299 { 288 300 return [[self numberForKey:LAST_PREDICATE] intValue];
