Changeset 1261
- Timestamp:
- 06/05/10 15:40:54 (2 years ago)
- Location:
- trunk/SapphireFrappliance
- Files:
-
- 3 modified
-
MetaData/SapphireMObjects/SapphireTVShow.h (modified) (1 diff)
-
MetaData/SapphireMObjects/SapphireTVShow.m (modified) (2 diffs)
-
main_debug.m (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/SapphireFrappliance/MetaData/SapphireMObjects/SapphireTVShow.h
r1251 r1261 9 9 10 10 - (NSComparisonResult)compare:(SapphireTVShow *)other; 11 - (NSString *)calculateAutoSortPath; 11 12 @end -
trunk/SapphireFrappliance/MetaData/SapphireMObjects/SapphireTVShow.m
r1251 r1261 8 8 #import "SapphireFileSorter.h" 9 9 #import "SapphireTVTranslation.h" 10 #import "SapphireFileMetaData.h" 10 11 11 12 @implementation SapphireTVShow … … 147 148 } 148 149 150 - (NSString *)calculateAutoSortPath 151 { 152 NSArray *files = doFetchRequest(SapphireFileMetaDataName, [self managedObjectContext], [self metaFileFetchPredicate]); 153 if([files count] == 0) 154 return nil; 155 156 NSString *sortPath = [[(SapphireFileMetaData *)[files objectAtIndex:0] path] stringByDeletingLastPathComponent]; 157 BOOL cropTwoDirs = NO; 158 NSEnumerator *fileEnum = [files objectEnumerator]; 159 SapphireFileMetaData *file; 160 while((file = [fileEnum nextObject]) != nil) 161 { 162 NSString *dirPath = [[file path] stringByDeletingLastPathComponent]; 163 if(cropTwoDirs) 164 dirPath = [dirPath stringByDeletingLastPathComponent]; 165 166 if([dirPath isEqualToString:sortPath]) 167 continue; 168 169 if(!cropTwoDirs) 170 { 171 sortPath = [sortPath stringByDeletingLastPathComponent]; 172 dirPath = [dirPath stringByDeletingLastPathComponent]; 173 cropTwoDirs = YES; 174 if([dirPath isEqualToString:sortPath]) 175 continue; 176 } 177 178 return nil; 179 } 180 181 return sortPath; 182 } 183 149 184 @end -
trunk/SapphireFrappliance/main_debug.m
r1251 r1261 43 43 #import "SapphireMovieDirectory.h" 44 44 45 #define TESTING_UPGRADE45 //#define TESTING_UPGRADE 46 46 //#define LISTING_MOVIES 47 47 //#define TESTING_XML_IMPORT … … 55 55 //#define TESTING_MOVIE_VIRTUAL_DIRS_IN_XML 56 56 //#define TESTING_TV_IMPORT_THROUGH_XML 57 #define TESTING_AUTO_SORT_PATH 57 58 58 59 void overrideApplicationSupportdir(NSString *override); … … 195 196 } 196 197 197 //overrideApplicationSupportdir([NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Frontrow"]);198 overrideApplicationSupportdir([NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Frontrow"]); 198 199 #ifdef TESTING_UPGRADE 199 200 { … … 348 349 } 349 350 #endif 351 #ifdef TESTING_AUTO_SORT_PATH 352 { 353 NSArray *shows = doFetchRequest(SapphireTVShowName, moc, nil); 354 NSEnumerator *showEnum = [shows objectEnumerator]; 355 SapphireTVShow *show; 356 while((show = [showEnum nextObject]) != nil) 357 { 358 NSString *autoPath = [show calculateAutoSortPath]; 359 NSLog(@"Sort path for %@ is %@", [show name], autoPath); 360 } 361 } 362 #endif 350 363 351 364 [allImporter release];
