Changeset 966
- Timestamp:
- 11/16/09 20:07:37 (10 months ago)
- Location:
- trunk/SapphireFrappliance
- Files:
-
- 2 added
- 8 modified
-
FRAppliance/SapphireApplianceController.h (modified) (2 diffs)
-
FRAppliance/SapphireApplianceController.m (modified) (5 diffs)
-
MetaData/SapphireMObjects/SapphireTVShow.h (modified) (1 diff)
-
MetaData/SapphireMObjects/SapphireTVShow.m (modified) (1 diff)
-
MetaData/Support/SapphireCustomVirtualDirectoryImporter.m (modified) (4 diffs)
-
MetaData/Support/SapphireMovieDirectory.h (modified) (2 diffs)
-
MetaData/Support/SapphireMovieDirectory.m (modified) (4 diffs)
-
MetaData/Support/SapphireTVDirectory.h (added)
-
MetaData/Support/SapphireTVDirectory.m (added)
-
Sapphire.xcodeproj/project.pbxproj (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/SapphireFrappliance/FRAppliance/SapphireApplianceController.h
r903 r966 23 23 #define DISTRIBUTED_MESSAGES_PORT 15473 24 24 25 @class SapphireSettings, SapphireTheme, SapphireLeopardOnly, SapphireImporterDataMenu, SapphireBrowser, SapphireDistributedMessagesReceiver ;25 @class SapphireSettings, SapphireTheme, SapphireLeopardOnly, SapphireImporterDataMenu, SapphireBrowser, SapphireDistributedMessagesReceiver, SapphireCustomVirtualDirectoryImporter; 26 26 27 27 extern NSString *SAPPHIRE_MANAGED_OBJECT_CONTEXT_CLOSING; … … 141 141 142 142 /*! 143 * @brief Gets the current custom virtual directory importer 144 * 145 * @return The current custom virtual directory importer 146 */ 147 + (SapphireCustomVirtualDirectoryImporter *)customVirtualDirectoryImporter; 148 149 /*! 143 150 * @brief Log an exception to the console 144 151 * -
trunk/SapphireFrappliance/FRAppliance/SapphireApplianceController.m
r903 r966 27 27 #import "SapphireBrowser.h" 28 28 #import "SapphireDirectoryMetaData.h" 29 #import "SapphireFileMetaData.h"30 29 #import "SapphireSettings.h" 31 30 #import "SapphireTheme.h" 32 31 #import "SapphireCollectionDirectory.h" 33 #import "CoreDataSupportFunctions.h"34 #import "SapphireEpisode.h"35 32 36 33 #import "SapphireImporterDataMenu.h" … … 43 40 #import "SapphireMetaDataSupport.h" 44 41 #import "SapphireEntityDirectory.h" 45 #import "SapphireTVShow.h"46 42 #import "SapphireMovieDirectory.h" 47 43 #import "SapphireMarkMenu.h" 48 44 #import "SapphireDisplayMenu.h" 49 45 #import "SapphireAudioNowPlayingController.h" 46 #import "SapphireTVDirectory.h" 47 #import "SapphireCustomVirtualDirectoryImporter.h" 50 48 51 49 #import "NSFileManager-Extensions.h" … … 248 246 } 249 247 248 + (SapphireCustomVirtualDirectoryImporter *)customVirtualDirectoryImporter 249 { 250 static SapphireCustomVirtualDirectoryImporter *customVirtualDirectoryImporter = nil; 251 if(customVirtualDirectoryImporter == nil) 252 customVirtualDirectoryImporter = [[SapphireCustomVirtualDirectoryImporter alloc] initWithPath:[applicationSupportDir() stringByAppendingPathComponent:@"virtualDirs.xml"]]; 253 return customVirtualDirectoryImporter; 254 } 255 250 256 + (void)logException:(NSException *)e 251 257 { … … 368 374 SapphireSetLogLevel(SAPPHIRE_LOG_ALL, SAPPHIRE_LOG_LEVEL_ERROR); 369 375 SapphireSetLogLevel(SAPPHIRE_LOG_METADATA_STORE, SAPPHIRE_LOG_LEVEL_DEBUG); 376 SapphireSetLogLevel(SAPPHIRE_LOG_IMPORT, SAPPHIRE_LOG_LEVEL_INFO); 370 377 371 378 distributed = [[SapphireDistributedMessagesReceiver alloc] initWithController:self]; … … 431 438 } 432 439 433 NSArray *showEntityFetch(NSManagedObjectContext *moc, NSPredicate *filterPredicate)434 {435 NSPredicate *showPred = nil;436 if(filterPredicate != nil)437 {438 NSPredicate *fetchPredicate = [NSPredicate predicateWithFormat:@"tvEpisode != nil"];439 NSPredicate *finalPred;440 if(filterPredicate == nil)441 finalPred = fetchPredicate;442 else443 finalPred = [NSCompoundPredicate andPredicateWithSubpredicates:[NSArray arrayWithObjects:filterPredicate, fetchPredicate, nil]];444 NSArray *files = doFetchRequest(SapphireFileMetaDataName, moc, finalPred);445 446 NSSet *epIds = [NSSet setWithArray:[files valueForKeyPath:@"tvEpisode.objectID"]];447 NSPredicate *epPred = [NSPredicate predicateWithFormat:@"SELF IN %@", epIds];448 NSArray *episodes = doFetchRequest(SapphireEpisodeName, moc, epPred);449 450 NSSet *showIds = [NSSet setWithArray:[episodes valueForKeyPath:@"tvShow.objectID"]];451 showPred = [NSPredicate predicateWithFormat:@"SELF IN %@", showIds];452 }453 return doFetchRequest(SapphireTVShowName, moc, showPred);454 }455 456 440 - (SapphireBrowser *)tvBrowser 457 441 { 458 442 BRTexture *predicateGem = [SapphireApplianceController gemForPredicate:[SapphireApplianceController predicate]]; 459 SapphireEntityDirectory *tvDir = [[SapphireEntityDirectory alloc] initWithEntityFetch:showEntityFetch inContext:moc]; 460 [tvDir setMetaFileFetchPredicate:[NSPredicate predicateWithFormat:@"tvEpisode != nil"]]; 443 SapphireTVDirectory *tvDir = [[SapphireTVDirectory alloc] initWithContext:moc]; 461 444 SapphireBrowser *tvBrowser = [[SapphireBrowser alloc] initWithScene:[self scene] metaData:tvDir]; 462 445 [tvDir release]; -
trunk/SapphireFrappliance/MetaData/SapphireMObjects/SapphireTVShow.h
r734 r966 7 7 + (SapphireTVShow *)showWithPath:(NSString *)path inContext:(NSManagedObjectContext *)moc; 8 8 + (void)upgradeV1ShowsFromContext:(NSManagedObjectContext *)oldMoc toContext:(NSManagedObjectContext *)newMoc; 9 + (NSArray *)sortMethods; 9 10 10 11 - (NSComparisonResult)compare:(SapphireTVShow *)other; -
trunk/SapphireFrappliance/MetaData/SapphireMObjects/SapphireTVShow.m
r849 r966 68 68 } 69 69 } 70 } 71 72 + (NSArray *)sortMethods 73 { 74 return allowedSorts; 70 75 } 71 76 -
trunk/SapphireFrappliance/MetaData/Support/SapphireCustomVirtualDirectoryImporter.m
r963 r966 73 73 //TVShow specifice attributes 74 74 #define TV_SHOW_SEASON_ELEM @"season" 75 #define TV_SHOW_SHOW_ELEM @"show Title"75 #define TV_SHOW_SHOW_ELEM @"showtitle" 76 76 #define TV_SHOW_EPISODE_ELEM @"episode" 77 #define TV_SHOW_ABS_EPISODE_ELEM @"episode Number"77 #define TV_SHOW_ABS_EPISODE_ELEM @"episodenumber" 78 78 #define TV_SHOW_EPISODE_TITLE_ELEM @"title" 79 79 #define TV_SHOW_EPISODE_DESC_ELEM @"description" 80 #define TV_SHOW_AIR_DATE_ELEM @"air Date"80 #define TV_SHOW_AIR_DATE_ELEM @"airdate" 81 81 82 82 typedef enum { … … 171 171 [SapphireCommandWrapper commandWithType:CommandTypeFormatElementString formatString:@"ANY tvEpisode.subEpisodes.episodeTitle"], TV_SHOW_EPISODE_TITLE_ELEM, 172 172 [SapphireCommandWrapper commandWithType:CommandTypeFormatElementString formatString:@"ANY tvEpisode.subEpisodes.episodeDescription"], TV_SHOW_EPISODE_DESC_ELEM, 173 [SapphireCommandWrapper commandWithType:CommandTypeFormatIntValue formatString:@"tvEpisode.season.seasonNumber "], TV_SHOW_SEASON_ELEM,174 [SapphireCommandWrapper commandWithType:CommandTypeFormatIntValue formatString:@"ANY tvEpisode.subEpisodes.episodeNumber "], TV_SHOW_EPISODE_ELEM,175 [SapphireCommandWrapper commandWithType:CommandTypeFormatIntValue formatString:@"ANY tvEpisode.subEpisodes.episodeNumber "], TV_SHOW_ABS_EPISODE_ELEM,176 [SapphireCommandWrapper commandWithType:CommandTypeFormatNSDateValue formatString:@"ANY tvEpisode.subEpisodes.airDate "], TV_SHOW_AIR_DATE_ELEM,173 [SapphireCommandWrapper commandWithType:CommandTypeFormatIntValue formatString:@"tvEpisode.season.seasonNumber == %d"], TV_SHOW_SEASON_ELEM, 174 [SapphireCommandWrapper commandWithType:CommandTypeFormatIntValue formatString:@"ANY tvEpisode.subEpisodes.episodeNumber == %d"], TV_SHOW_EPISODE_ELEM, 175 [SapphireCommandWrapper commandWithType:CommandTypeFormatIntValue formatString:@"ANY tvEpisode.subEpisodes.episodeNumber == %d"], TV_SHOW_ABS_EPISODE_ELEM, 176 [SapphireCommandWrapper commandWithType:CommandTypeFormatNSDateValue formatString:@"ANY tvEpisode.subEpisodes.airDate >= %@"], TV_SHOW_AIR_DATE_ELEM, 177 177 nil]; 178 178 … … 221 221 { 222 222 matchPred = [NSCompoundPredicate andPredicateWithSubpredicates:[NSArray arrayWithObjects:basePredicate, matchPred, nil]]; 223 SapphireLog(SAPPHIRE_LOG_ ALL, SAPPHIRE_LOG_LEVEL_INFO, @"Creating virtual directory with filter: %@", matchPred);223 SapphireLog(SAPPHIRE_LOG_IMPORT, SAPPHIRE_LOG_LEVEL_INFO, @"Creating virtual directory with filter: %@", matchPred); 224 224 [virtualDir setPredicate:matchPred]; 225 225 } … … 235 235 { 236 236 /*Check for XML file*/ 237 SapphireLog(SAPPHIRE_LOG_ ALL, SAPPHIRE_LOG_LEVEL_DETAIL, @"Looking for file: %@", path);237 SapphireLog(SAPPHIRE_LOG_IMPORT, SAPPHIRE_LOG_LEVEL_DETAIL, @"Looking for file: %@", path); 238 238 NSFileManager *fm = [NSFileManager defaultManager]; 239 239 BOOL xmlPathIsDir = NO; -
trunk/SapphireFrappliance/MetaData/Support/SapphireMovieDirectory.h
r934 r966 22 22 #import "SapphireBasicDirectoryFunctionsDefines.h" 23 23 24 @class SapphireMovieVirtualDirectoryImporter;25 26 24 /*! 27 25 * @brief The base movies virtual directory … … 37 35 NSArray *virtualDirs; /*!< @brief The virtual directories last imported*/ 38 36 NSArray *defaultSorters; /*!< @brief The list of default file sorters*/ 39 SapphireMovieVirtualDirectoryImporter *vdImport; /*!< @brief The virtial directory importer*/40 37 Basic_Directory_Function_Instance_Variables 41 38 } -
trunk/SapphireFrappliance/MetaData/Support/SapphireMovieDirectory.m
r963 r966 127 127 128 128 NSString *moviePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"video_H" ofType:@"png"]; 129 vdImport = [[SapphireCustomVirtualDirectoryImporter alloc] initWithPath:[applicationSupportDir() stringByAppendingPathComponent:@"virtualDirs.xml"]];130 129 defaultSorters = [[NSArray alloc] initWithObjects:titleSort, dateSort, imdbRatingSort, nil]; 131 130 … … 169 168 [virtualDirs release]; 170 169 [defaultSorters release]; 171 [vdImport release];172 170 Basic_Directory_Function_Deallocs 173 171 [super dealloc]; … … 221 219 { 222 220 /*Import any defined movie virtual directories*/ 223 NSArray *newVirtualDirs = [ vdImportmovieVirtualDirectories];221 NSArray *newVirtualDirs = [[SapphireApplianceController customVirtualDirectoryImporter] movieVirtualDirectories]; 224 222 if(![virtualDirs isEqualToArray:newVirtualDirs]) 225 223 { … … 238 236 SapphireFilteredFileDirectory *custom = [[SapphireFilteredFileDirectory alloc] initWithPredicate:[virtualDir predicate] Context:moc]; 239 237 [subDirs addObject:custom]; 240 [names addObject: BRLocalizedString([virtualDir title], [virtualDir description])];238 [names addObject:[virtualDir title]]; 241 239 [custom setPath:[[VIRTUAL_DIR_ROOT_PATH stringByAppendingString:@"/"] stringByAppendingString:[virtualDir description]]]; 242 240 [custom setCoverArtPath:moviePath]; // Change this to be part of the XML? -
trunk/SapphireFrappliance/Sapphire.xcodeproj/project.pbxproj
r962 r966 63 63 F50040110D1998FA003FEA08 /* SapphireLeopardFileEvents.m in Sources */ = {isa = PBXBuildFile; fileRef = F500400F0D1998FA003FEA08 /* SapphireLeopardFileEvents.m */; }; 64 64 F50044160D19A268003FEA08 /* LeopardOnly.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = F5003FF90D19980B003FEA08 /* LeopardOnly.framework */; }; 65 F506593110B22EC800D0F1FE /* SapphireTVDirectory.m in Sources */ = {isa = PBXBuildFile; fileRef = F506593010B22EC800D0F1FE /* SapphireTVDirectory.m */; }; 65 66 F51BFC1B0D26ACAD00E22363 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F56A19480C3170870022918E /* AppKit.framework */; }; 66 67 F51BFC1C0D26ACAD00E22363 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 089C1672FE841209C02AAC07 /* Foundation.framework */; }; … … 393 394 F500400E0D1998FA003FEA08 /* SapphireLeopardFileEvents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SapphireLeopardFileEvents.h; sourceTree = "<group>"; }; 394 395 F500400F0D1998FA003FEA08 /* SapphireLeopardFileEvents.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SapphireLeopardFileEvents.m; sourceTree = "<group>"; }; 396 F506592F10B22EC800D0F1FE /* SapphireTVDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SapphireTVDirectory.h; sourceTree = "<group>"; }; 397 F506593010B22EC800D0F1FE /* SapphireTVDirectory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SapphireTVDirectory.m; sourceTree = "<group>"; }; 395 398 F5185B400D1344D700712020 /* ExceptionHandling.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ExceptionHandling.framework; path = /System/Library/Frameworks/ExceptionHandling.framework; sourceTree = "<absolute>"; }; 396 399 F51BFD2D0D26BDF300E22363 /* SapphireCompatibilityClasses.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SapphireCompatibilityClasses.xcodeproj; path = ../SapphireCompatibilityClasses/SapphireCompatibilityClasses.xcodeproj; sourceTree = "<group>"; }; … … 1048 1051 F5C55ECC0DE90F7000661563 /* SapphireObjectDirectory.h */, 1049 1052 F5C55ECD0DE90F7000661563 /* SapphireObjectDirectory.m */, 1053 F506592F10B22EC800D0F1FE /* SapphireTVDirectory.h */, 1054 F506593010B22EC800D0F1FE /* SapphireTVDirectory.m */, 1050 1055 ); 1051 1056 path = Support; … … 1425 1430 5941C04810786ECA004C887B /* SapphireCustomVirtualDirectoryImporter.m in Sources */, 1426 1431 F5A9A89510A7A69600BA95CD /* NSXMLDocument-Extensions.m in Sources */, 1432 F506593110B22EC800D0F1FE /* SapphireTVDirectory.m in Sources */, 1427 1433 ); 1428 1434 runOnlyForDeploymentPostprocessing = 0;
