Changeset 544
- Timestamp:
- 05/25/08 19:47:32 (8 months ago)
- Files:
-
- branches/CoreData/SapphireCompatibilityClasses/Sapphire_Prefix.pch (modified) (1 diff)
- branches/CoreData/SapphireFrappliance/FRAppliance/SapphireApplianceController.m (modified) (3 diffs)
- branches/CoreData/SapphireFrappliance/MetaData/MOClasses/_SapphireFileMetaData.h (modified) (2 diffs)
- branches/CoreData/SapphireFrappliance/MetaData/MOClasses/_SapphireFileMetaData.m (modified) (2 diffs)
- branches/CoreData/SapphireFrappliance/MetaData/MOClasses/_SapphireMovie.h (modified) (1 diff)
- branches/CoreData/SapphireFrappliance/MetaData/MOClasses/_SapphireMovie.m (modified) (1 diff)
- branches/CoreData/SapphireFrappliance/MetaData/Sapphire.xcdatamodel/elements (modified) (previous)
- branches/CoreData/SapphireFrappliance/MetaData/Sapphire.xcdatamodel/layout (modified) (previous)
- branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireDirectoryMetaData.h (modified) (1 diff)
- branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireDirectoryMetaData.m (modified) (1 diff)
- branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireEpisode.h (modified) (1 diff)
- branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireEpisode.m (modified) (2 diffs)
- branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireFileMetaData.h (modified) (1 diff)
- branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireFileMetaData.m (modified) (5 diffs)
- branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireMetaData.h (modified) (1 diff)
- branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireMetaData.m (modified) (1 diff)
- branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireMovie.h (modified) (1 diff)
- branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireMovie.m (modified) (3 diffs)
- branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireSeason.h (modified) (1 diff)
- branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireSeason.m (modified) (1 diff)
- branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireTVShow.h (modified) (1 diff)
- branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireTVShow.m (modified) (2 diffs)
- branches/CoreData/SapphireFrappliance/MetaData/Support/SapphireMetaDataSupport.h (modified) (2 diffs)
- branches/CoreData/SapphireFrappliance/MetaData/Support/SapphireMetaDataSupport.m (modified) (2 diffs)
- branches/CoreData/SapphireFrappliance/MetaData/generateCoreDataClasses.sh (moved) (moved from branches/CoreData/SapphireFrappliance/generateCoreDataClasses.sh)
- branches/CoreData/SapphireFrappliance/MetaDataImporting/SapphireMovieImporter.m (modified) (3 diffs)
- branches/CoreData/SapphireFrappliance/MetaDataImporting/SapphireTVShowImporter.m (modified) (2 diffs)
- branches/CoreData/SapphireFrappliance/Sapphire.xcodeproj/project.pbxproj (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/CoreData/SapphireCompatibilityClasses/Sapphire_Prefix.pch
r436 r544 6 6 #import <Foundation/Foundation.h> 7 7 #import <BackRow/BackRow.h> 8 #import <CoreData/CoreData.h> 8 9 #import "BackRowUtils.h" 9 10 #endif branches/CoreData/SapphireFrappliance/FRAppliance/SapphireApplianceController.m
r541 r544 38 38 #import "SapphireAllImporter.h" 39 39 #import "SapphireImportHelper.h" 40 #import "SapphireMetaDataSupport.h" 40 41 41 42 #define BROWSER_MENU_ITEM BRLocalizedString(@" Browse", @"Browser Menu Item") … … 176 177 177 178 moc = [[NSManagedObjectContext alloc] init]; 179 [moc setUndoManager:nil]; 178 180 NSString *mopath = [[NSBundle bundleForClass:[self class]] pathForResource:@"Sapphire" ofType:@"mom"]; 179 181 NSURL *mourl = [NSURL fileURLWithPath:mopath]; … … 186 188 NSURL *storeUrl = [NSURL fileURLWithPath:storeFile]; 187 189 NSError *error = nil; 188 id store = [coord addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeUrl options:nil error:&error]; 190 [coord addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeUrl options:nil error:&error]; 191 NSFileManager *fm = [NSFileManager defaultManager]; 192 if(![fm fileExistsAtPath:storeFile]) 193 { 194 NSString *plistFile = [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Application Support/Sapphire/metaData.plist"]; 195 if([fm fileExistsAtPath:plistFile]) 196 [SapphireMetaDataSupport importPlist:plistFile intoContext:moc]; 197 } 189 198 190 199 branches/CoreData/SapphireFrappliance/MetaData/MOClasses/_SapphireFileMetaData.h
r540 r544 78 78 79 79 80 - (NSString*)subtitlesDescription; 81 - (void)setSubtitlesDescription:(NSString*)value_; 82 83 //- (BOOL)validateSubtitlesDescription:(id*)value_ error:(NSError**)error_; 84 85 86 87 - (NSNumber*)resumeTime; 88 - (void)setResumeTime:(NSNumber*)value_; 89 90 - (int)resumeTimeValue; 91 - (void)setResumeTimeValue:(int)value_; 92 93 //- (BOOL)validateResumeTime:(id*)value_ error:(NSError**)error_; 94 95 96 97 - (NSNumber*)importType; 98 - (void)setImportType:(NSNumber*)value_; 99 100 - (int)importTypeValue; 101 - (void)setImportTypeValue:(int)value_; 102 103 //- (BOOL)validateImportType:(id*)value_ error:(NSError**)error_; 104 105 106 107 - (NSNumber*)fileContainerType; 108 - (void)setFileContainerType:(NSNumber*)value_; 109 110 - (short)fileContainerTypeValue; 111 - (void)setFileContainerTypeValue:(short)value_; 112 113 //- (BOOL)validateFileContainerType:(id*)value_ error:(NSError**)error_; 114 115 116 117 - (NSNumber*)watched; 118 - (void)setWatched:(NSNumber*)value_; 119 120 - (BOOL)watchedValue; 121 - (void)setWatchedValue:(BOOL)value_; 122 123 //- (BOOL)validateWatched:(id*)value_ error:(NSError**)error_; 124 125 126 127 - (NSDate*)modified; 128 - (void)setModified:(NSDate*)value_; 129 130 //- (BOOL)validateModified:(id*)value_ error:(NSError**)error_; 131 132 133 134 - (NSNumber*)audioFormatID; 135 - (void)setAudioFormatID:(NSNumber*)value_; 136 137 - (int)audioFormatIDValue; 138 - (void)setAudioFormatIDValue:(int)value_; 139 140 //- (BOOL)validateAudioFormatID:(id*)value_ error:(NSError**)error_; 141 142 143 144 - (NSNumber*)fileClass; 145 - (void)setFileClass:(NSNumber*)value_; 146 147 - (short)fileClassValue; 148 - (void)setFileClassValue:(short)value_; 149 150 //- (BOOL)validateFileClass:(id*)value_ error:(NSError**)error_; 151 152 153 80 154 - (NSNumber*)size; 81 155 - (void)setSize:(NSNumber*)value_; … … 85 159 86 160 //- (BOOL)validateSize:(id*)value_ error:(NSError**)error_; 87 88 89 90 - (NSNumber*)resumeTime;91 - (void)setResumeTime:(NSNumber*)value_;92 93 - (int)resumeTimeValue;94 - (void)setResumeTimeValue:(int)value_;95 96 //- (BOOL)validateResumeTime:(id*)value_ error:(NSError**)error_;97 98 99 100 - (NSNumber*)importType;101 - (void)setImportType:(NSNumber*)value_;102 103 - (int)importTypeValue;104 - (void)setImportTypeValue:(int)value_;105 106 //- (BOOL)validateImportType:(id*)value_ error:(NSError**)error_;107 108 109 110 - (NSNumber*)fileContainerType;111 - (void)setFileContainerType:(NSNumber*)value_;112 113 - (short)fileContainerTypeValue;114 - (void)setFileContainerTypeValue:(short)value_;115 116 //- (BOOL)validateFileContainerType:(id*)value_ error:(NSError**)error_;117 118 119 120 - (NSNumber*)watched;121 - (void)setWatched:(NSNumber*)value_;122 123 - (BOOL)watchedValue;124 - (void)setWatchedValue:(BOOL)value_;125 126 //- (BOOL)validateWatched:(id*)value_ error:(NSError**)error_;127 128 129 130 - (NSDate*)modified;131 - (void)setModified:(NSDate*)value_;132 133 //- (BOOL)validateModified:(id*)value_ error:(NSError**)error_;134 135 136 137 - (NSNumber*)audioFormatID;138 - (void)setAudioFormatID:(NSNumber*)value_;139 140 - (int)audioFormatIDValue;141 - (void)setAudioFormatIDValue:(int)value_;142 143 //- (BOOL)validateAudioFormatID:(id*)value_ error:(NSError**)error_;144 145 146 147 - (NSNumber*)fileClass;148 - (void)setFileClass:(NSNumber*)value_;149 150 - (short)fileClassValue;151 - (void)setFileClassValue:(short)value_;152 153 //- (BOOL)validateFileClass:(id*)value_ error:(NSError**)error_;154 155 156 157 - (NSString*)subtitlesDescription;158 - (void)setSubtitlesDescription:(NSString*)value_;159 160 //- (BOOL)validateSubtitlesDescription:(id*)value_ error:(NSError**)error_;161 161 162 162 branches/CoreData/SapphireFrappliance/MetaData/MOClasses/_SapphireFileMetaData.m
r540 r544 160 160 161 161 162 - (NSString*)subtitlesDescription { 163 [self willAccessValueForKey:@"subtitlesDescription"]; 164 NSString *result = [self primitiveValueForKey:@"subtitlesDescription"]; 165 [self didAccessValueForKey:@"subtitlesDescription"]; 166 return result; 167 } 168 169 - (void)setSubtitlesDescription:(NSString*)value_ { 170 [self willChangeValueForKey:@"subtitlesDescription"]; 171 [self setPrimitiveValue:value_ forKey:@"subtitlesDescription"]; 172 [self didChangeValueForKey:@"subtitlesDescription"]; 173 } 174 175 176 177 178 179 180 - (NSNumber*)resumeTime { 181 [self willAccessValueForKey:@"resumeTime"]; 182 NSNumber *result = [self primitiveValueForKey:@"resumeTime"]; 183 [self didAccessValueForKey:@"resumeTime"]; 184 return result; 185 } 186 187 - (void)setResumeTime:(NSNumber*)value_ { 188 [self willChangeValueForKey:@"resumeTime"]; 189 [self setPrimitiveValue:value_ forKey:@"resumeTime"]; 190 [self didChangeValueForKey:@"resumeTime"]; 191 } 192 193 194 195 - (int)resumeTimeValue { 196 NSNumber *result = [self resumeTime]; 197 return result ? [result intValue] : 0; 198 } 199 200 - (void)setResumeTimeValue:(int)value_ { 201 [self setResumeTime:[NSNumber numberWithInt:value_]]; 202 } 203 204 205 206 207 208 209 - (NSNumber*)importType { 210 [self willAccessValueForKey:@"importType"]; 211 NSNumber *result = [self primitiveValueForKey:@"importType"]; 212 [self didAccessValueForKey:@"importType"]; 213 return result; 214 } 215 216 - (void)setImportType:(NSNumber*)value_ { 217 [self willChangeValueForKey:@"importType"]; 218 [self setPrimitiveValue:value_ forKey:@"importType"]; 219 [self didChangeValueForKey:@"importType"]; 220 } 221 222 223 224 - (int)importTypeValue { 225 NSNumber *result = [self importType]; 226 return result ? [result intValue] : 0; 227 } 228 229 - (void)setImportTypeValue:(int)value_ { 230 [self setImportType:[NSNumber numberWithInt:value_]]; 231 } 232 233 234 235 236 237 238 - (NSNumber*)fileContainerType { 239 [self willAccessValueForKey:@"fileContainerType"]; 240 NSNumber *result = [self primitiveValueForKey:@"fileContainerType"]; 241 [self didAccessValueForKey:@"fileContainerType"]; 242 return result; 243 } 244 245 - (void)setFileContainerType:(NSNumber*)value_ { 246 [self willChangeValueForKey:@"fileContainerType"]; 247 [self setPrimitiveValue:value_ forKey:@"fileContainerType"]; 248 [self didChangeValueForKey:@"fileContainerType"]; 249 } 250 251 252 253 - (short)fileContainerTypeValue { 254 NSNumber *result = [self fileContainerType]; 255 return result ? [result shortValue] : 0; 256 } 257 258 - (void)setFileContainerTypeValue:(short)value_ { 259 [self setFileContainerType:[NSNumber numberWithShort:value_]]; 260 } 261 262 263 264 265 266 267 - (NSNumber*)watched { 268 [self willAccessValueForKey:@"watched"]; 269 NSNumber *result = [self primitiveValueForKey:@"watched"]; 270 [self didAccessValueForKey:@"watched"]; 271 return result; 272 } 273 274 - (void)setWatched:(NSNumber*)value_ { 275 [self willChangeValueForKey:@"watched"]; 276 [self setPrimitiveValue:value_ forKey:@"watched"]; 277 [self didChangeValueForKey:@"watched"]; 278 } 279 280 281 282 - (BOOL)watchedValue { 283 NSNumber *result = [self watched]; 284 return result ? [result boolValue] : 0; 285 } 286 287 - (void)setWatchedValue:(BOOL)value_ { 288 [self setWatched:[NSNumber numberWithBool:value_]]; 289 } 290 291 292 293 294 295 296 - (NSDate*)modified { 297 [self willAccessValueForKey:@"modified"]; 298 NSDate *result = [self primitiveValueForKey:@"modified"]; 299 [self didAccessValueForKey:@"modified"]; 300 return result; 301 } 302 303 - (void)setModified:(NSDate*)value_ { 304 [self willChangeValueForKey:@"modified"]; 305 [self setPrimitiveValue:value_ forKey:@"modified"]; 306 [self didChangeValueForKey:@"modified"]; 307 } 308 309 310 311 312 313 314 - (NSNumber*)audioFormatID { 315 [self willAccessValueForKey:@"audioFormatID"]; 316 NSNumber *result = [self primitiveValueForKey:@"audioFormatID"]; 317 [self didAccessValueForKey:@"audioFormatID"]; 318 return result; 319 } 320 321 - (void)setAudioFormatID:(NSNumber*)value_ { 322 [self willChangeValueForKey:@"audioFormatID"]; 323 [self setPrimitiveValue:value_ forKey:@"audioFormatID"]; 324 [self didChangeValueForKey:@"audioFormatID"]; 325 } 326 327 328 329 - (int)audioFormatIDValue { 330 NSNumber *result = [self audioFormatID]; 331 return result ? [result intValue] : 0; 332 } 333 334 - (void)setAudioFormatIDValue:(int)value_ { 335 [self setAudioFormatID:[NSNumber numberWithInt:value_]]; 336 } 337 338 339 340 341 342 343 - (NSNumber*)fileClass { 344 [self willAccessValueForKey:@"fileClass"]; 345 NSNumber *result = [self primitiveValueForKey:@"fileClass"]; 346 [self didAccessValueForKey:@"fileClass"]; 347 return result; 348 } 349 350 - (void)setFileClass:(NSNumber*)value_ { 351 [self willChangeValueForKey:@"fileClass"]; 352 [self setPrimitiveValue:value_ forKey:@"fileClass"]; 353 [self didChangeValueForKey:@"fileClass"]; 354 } 355 356 357 358 - (short)fileClassValue { 359 NSNumber *result = [self fileClass]; 360 return result ? [result shortValue] : 0; 361 } 362 363 - (void)setFileClassValue:(short)value_ { 364 [self setFileClass:[NSNumber numberWithShort:value_]]; 365 } 366 367 368 369 370 371 162 372 - (NSNumber*)size { 163 373 [self willAccessValueForKey:@"size"]; … … 182 392 - (void)setSizeValue:(long long)value_ { 183 393 [self setSize:[NSNumber numberWithLongLong:value_]]; 184 }185 186 187 188 189 190 191 - (NSNumber*)resumeTime {192 [self willAccessValueForKey:@"resumeTime"];193 NSNumber *result = [self primitiveValueForKey:@"resumeTime"];194 [self didAccessValueForKey:@"resumeTime"];195 return result;196 }197 198 - (void)setResumeTime:(NSNumber*)value_ {199 [self willChangeValueForKey:@"resumeTime"];200 [self setPrimitiveValue:value_ forKey:@"resumeTime"];201 [self didChangeValueForKey:@"resumeTime"];202 }203 204 205 206 - (int)resumeTimeValue {207 NSNumber *result = [self resumeTime];208 return result ? [result intValue] : 0;209 }210 211 - (void)setResumeTimeValue:(int)value_ {212 [self setResumeTime:[NSNumber numberWithInt:value_]];213 }214 215 216 217 218 219 220 - (NSNumber*)importType {221 [self willAccessValueForKey:@"importType"];222 NSNumber *result = [self primitiveValueForKey:@"importType"];223 [self didAccessValueForKey:@"importType"];224 return result;225 }226 227 - (void)setImportType:(NSNumber*)value_ {228 [self willChangeValueForKey:@"importType"];229 [self setPrimitiveValue:value_ forKey:@"importType"];230 [self didChangeValueForKey:@"importType"];231 }232 233 234 235 - (int)importTypeValue {236 NSNumber *result = [self importType];237 return result ? [result intValue] : 0;238 }239 240 - (void)setImportTypeValue:(int)value_ {241 [self setImportType:[NSNumber numberWithInt:value_]];242 }243 244 245 246 247 248 249 - (NSNumber*)fileContainerType {250 [self willAccessValueForKey:@"fileContainerType"];251 NSNumber *result = [self primitiveValueForKey:@"fileContainerType"];252 [self didAccessValueForKey:@"fileContainerType"];253 return result;254 }255 256 - (void)setFileContainerType:(NSNumber*)value_ {257 [self willChangeValueForKey:@"fileContainerType"];258 [self setPrimitiveValue:value_ forKey:@"fileContainerType"];259 [self didChangeValueForKey:@"fileContainerType"];260 }261 262 263 264 - (short)fileContainerTypeValue {265 NSNumber *result = [self fileContainerType];266 return result ? [result shortValue] : 0;267 }268 269 - (void)setFileContainerTypeValue:(short)value_ {270 [self setFileContainerType:[NSNumber numberWithShort:value_]];271 }272 273 274 275 276 277 278 - (NSNumber*)watched {279 [self willAccessValueForKey:@"watched"];280 NSNumber *result = [self primitiveValueForKey:@"watched"];281 [self didAccessValueForKey:@"watched"];282 return result;283 }284 285 - (void)setWatched:(NSNumber*)value_ {286 [self willChangeValueForKey:@"watched"];287 [self setPrimitiveValue:value_ forKey:@"watched"];288 [self didChangeValueForKey:@"watched"];289 }290 291 292 293 - (BOOL)watchedValue {294 NSNumber *result = [self watched];295 return result ? [result boolValue] : 0;296 }297 298 - (void)setWatchedValue:(BOOL)value_ {299 [self setWatched:[NSNumber numberWithBool:value_]];300 }301 302 303 304 305 306 307 - (NSDate*)modified {308 [self willAccessValueForKey:@"modified"];309 NSDate *result = [self primitiveValueForKey:@"modified"];310 [self didAccessValueForKey:@"modified"];311 return result;312 }313 314 - (void)setModified:(NSDate*)value_ {315 [self willChangeValueForKey:@"modified"];316 [self setPrimitiveValue:value_ forKey:@"modified"];317 [self didChangeValueForKey:@"modified"];318 }319 320 321 322 323 324 325 - (NSNumber*)audioFormatID {326 [self willAccessValueForKey:@"audioFormatID"];327 NSNumber *result = [self primitiveValueForKey:@"audioFormatID"];328 [self didAccessValueForKey:@"audioFormatID"];329 return result;330 }331 332 - (void)setAudioFormatID:(NSNumber*)value_ {333 [self willChangeValueForKey:@"audioFormatID"];334 [self setPrimitiveValue:value_ forKey:@"audioFormatID"];335 [self didChangeValueForKey:@"audioFormatID"];336 }337 338 339 340 - (int)audioFormatIDValue {341 NSNumber *result = [self audioFormatID];342 return result ? [result intValue] : 0;343 }344 345 - (void)setAudioFormatIDValue:(int)value_ {346 [self setAudioFormatID:[NSNumber numberWithInt:value_]];347 }348 349 350 351 352 353 354 - (NSNumber*)fileClass {355 [self willAccessValueForKey:@"fileClass"];356 NSNumber *result = [self primitiveValueForKey:@"fileClass"];357 [self didAccessValueForKey:@"fileClass"];358 return result;359 }360 361 - (void)setFileClass:(NSNumber*)value_ {362 [self willChangeValueForKey:@"fileClass"];363 [self setPrimitiveValue:value_ forKey:@"fileClass"];364 [self didChangeValueForKey:@"fileClass"];365 }366 367 368 369 - (short)fileClassValue {370 NSNumber *result = [self fileClass];371 return result ? [result shortValue] : 0;372 }373 374 - (void)setFileClassValue:(short)value_ {375 [self setFileClass:[NSNumber numberWithShort:value_]];376 }377 378 379 380 381 382 383 - (NSString*)subtitlesDescription {384 [self willAccessValueForKey:@"subtitlesDescription"];385 NSString *result = [self primitiveValueForKey:@"subtitlesDescription"];386 [self didAccessValueForKey:@"subtitlesDescription"];387 return result;388 }389 390 - (void)setSubtitlesDescription:(NSString*)value_ {391 [self willChangeValueForKey:@"subtitlesDescription"];392 [self setPrimitiveValue:value_ forKey:@"subtitlesDescription"];393 [self didChangeValueForKey:@"subtitlesDescription"];394 394 } 395 395 branches/CoreData/SapphireFrappliance/MetaData/MOClasses/_SapphireMovie.h
r540 r544 33 33 34 34 //- (BOOL)validateImdbRating:(id*)value_ error:(NSError**)error_; 35 36 37 38 - (NSString*)plot; 39 - (void)setPlot:(NSString*)value_; 40 41 //- (BOOL)validatePlot:(id*)value_ error:(NSError**)error_; 35 42 36 43 branches/CoreData/SapphireFrappliance/MetaData/MOClasses/_SapphireMovie.m
r540 r544 37 37 38 38 39 - (NSString*)plot { 40 [self willAccessValueForKey:@"plot"]; 41 NSString *result = [self primitiveValueForKey:@"plot"]; 42 [self didAccessValueForKey:@"plot"]; 43 return result; 44 } 45 46 - (void)setPlot:(NSString*)value_ { 47 [self willChangeValueForKey:@"plot"]; 48 [self setPrimitiveValue:value_ forKey:@"plot"]; 49 [self didChangeValueForKey:@"plot"]; 50 } 51 52 53 54 55 56 39 57 40 58 branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireDirectoryMetaData.h
r540 r544 14 14 + (SapphireDirectoryMetaData *)createDirectoryWithPath:(NSString *)path parent:(SapphireDirectoryMetaData *)parent inContext:(NSManagedObjectContext *)moc; 15 15 - (void)insertDictionary:(NSDictionary *)dict withDefer:(NSMutableDictionary *)defer; 16 17 /*! 18 * @brief Get the cover art Path 19 * 20 * Returns the cover art path. It will also examine up in the directory structure in order to find the cover art. It examines both the current directory, the "cover art" subdirectory, and the same for parent directories up to 2 levels. 21 * 22 * @return The path for the cover art, nil if none found 23 */ 24 - (NSString *)coverArtPath; 25 16 26 @end branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireDirectoryMetaData.m
r540 r544 322 322 } 323 323 324 - (NSString *)coverArtPathUpToParents:(int)parents 325 { 326 NSString *ret = searchCoverArtExtForPath([[self path] stringByAppendingPathComponent:@"Cover Art/cover"]); 327 if(ret != nil) 328 return ret; 329 330 ret = searchCoverArtExtForPath([[self path] stringByAppendingPathComponent:@"cover"]); 331 if(ret != nil) 332 return ret; 333 334 if(parents != 0) 335 return [[self parent] coverArtPathUpToParents:parents-1]; 336 return nil; 337 } 338 339 - (NSString *)coverArtPath 340 { 341 return [self coverArtPathUpToParents:2]; 342 } 343 344 - (NSMutableDictionary *)getDisplayedMetaDataInOrder:(NSArray * *)order; 345 { 346 if(order != nil) 347 *order = nil; 348 return [NSMutableDictionary dictionaryWithObjectsAndKeys: 349 [[self path] lastPathComponent], META_TITLE_KEY, 350 nil]; 351 } 352 324 353 /*Function to invoke a command on all files in a subtree*/ 325 354 - (void)invokeRecursivelyOnFiles:(NSInvocation *)fileInv branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireEpisode.h
r540 r544 12 12 - (NSString *)episodeTitle; 13 13 - (NSComparisonResult)compare:(SapphireEpisode *)other; 14 15 /*! 16 * @brief Get the cover art Path 17 * 18 * Returns the cover art path for this episode 19 * 20 * @return The path for the cover art, nil if none found 21 */ 22 - (NSString *)coverArtPath; 23 24 /*! 25 * @brief Insert preview metadata for a movie 26 * 27 * @param dict The dictionary to store the metadata 28 */ 29 - (void)insertDisplayMetaData:(NSMutableDictionary *)dict; 30 14 31 @end branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireEpisode.m
r540 r544 2 2 #import "SapphireSeason.h" 3 3 #import "SapphireSubEpisode.h" 4 #import "SapphireFile.h" 5 #import "SapphireMediaPreview.h" 4 6 5 7 @implementation SapphireEpisode … … 93 95 } 94 96 97 - (NSString *)coverArtPath 98 { 99 NSString *base = [[self season] coverArtPath]; 100 if([self episodeNumberValue] > 0) 101 return [base stringByAppendingFormat:@"/Episode %d", [self episodeNumberValue]]; 102 return [base stringByAppendingPathComponent:[self episodeTitle]]; 103 } 104 105 - (void)insertDisplayMetaData:(NSMutableDictionary *)dict 106 { 107 id value = [self episodeTitle]; 108 if(value != nil) 109 [dict setObject:value forKey:META_TITLE_KEY]; 110 value = [[sortedSubEpisodes objectAtIndex:0] airDate]; 111 if(value != nil) 112 [dict setObject:value forKey:META_SHOW_AIR_DATE]; 113 int season = [[self season] seasonNumberValue]; 114 int ep = [self episodeNumberValue]; 115 if(season != 0) 116 [dict setObject:[[self season] seasonNumber] forKey:BRLocalizedString(META_SEASON_NUMBER_KEY, @"Season in metadata display")]; 117 if(ep != 0) 118 [dict setObject:[NSNumber numberWithInt:ep] forKey:BRLocalizedString(META_EPISODE_NUMBER_KEY, @"Epsiode in metadata display")]; 119 if(ep != 0 && season != 0) 120 { 121 int lastEp = [self lastEpisodeNumberValue]; 122 NSString *key = BRLocalizedString(META_EPISODE_AND_SEASON_KEY, @"Season / Epsiode in metadata display"); 123 if(lastEp != nil) 124 [dict setObject:[NSString stringWithFormat:@"%@ - %d / %d-%d", [[self tvShow] name], season, ep, lastEp] forKey:key]; 125 else 126 [dict setObject:[NSString stringWithFormat:@"%@ - %d / %d", [[self tvShow] name], season, lastEp] forKey:key]; 127 } 128 } 129 95 130 - (NSString *)path 96 131 { branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireFileMetaData.h
r540 r544 44 44 - (void)clearMetaData; 45 45 46 /*! 47 * @brief Get the cover art Path 48 * 49 * Returns the cover art path. It will also examine up in the directory structure in order to find the cover art. It examines both the current directory, the "cover art" subdirectory, and the same for parent directories up to 2 levels. 50 * 51 * @return The path for the cover art, nil if none found 52 */ 53 - (NSString *)coverArtPath; 54 46 55 @end branches/CoreData/SapphireFrappliance/MetaData/SapphireMObjects/SapphireFileMetaData.m
r540 r544 5 5 #import "SapphireDirectoryMetaData.h" 6 6 #import "SapphireVideoTsParser.h" 7 #import "SapphireMetaDataSupport.h" 8 #import "SapphireMediaPreview.h" 7 9 8 10 #import <QTKit/QTKit.h> … … 24 26 #define JOINED_FILE_KEY @"Joined File" 25 27 28 static NSSet *displayedMetaData; 29 static NSArray *displayedMetaDataOrder; 30 31 + (void)load 32 { 33 displayedMetaDataOrder = [NSArray arrayWithObjects: 34 //These are not shown in the list 35 META_MOVIE_MPAA_RATING_KEY, 36 META_RATING_KEY, 37 META_DESCRIPTION_KEY, 38 META_MOVIE_PLOT_KEY, 39 META_COPYRIGHT_KEY, 40 META_TITLE_KEY, 41 META_MOVIE_TITLE_KEY, 42 META_SHOW_AIR_DATE, 43 META_MOVIE_WIRTERS_KEY, 44 META_MOVIE_RELEASE_DATE_KEY, 45 META_MOVIE_IMDB_250_KEY, 46 META_MOVIE_IMDB_RATING_KEY, 47 //These are displayed as line items 48 META_MOVIE_DIRECTOR_KEY, 49 META_MOVIE_CAST_KEY, 50 META_MOVIE_GENRES_KEY, 51 META_EPISODE_AND_SEASON_KEY, 52 META_SEASON_NUMBER_KEY, 53 META_EPISODE_NUMBER_KEY, 54 META_MOVIE_IMDB_STATS_KEY, 55 SIZE_KEY, 56 DURATION_KEY, 57 VIDEO_DESC_KEY, 58 AUDIO_DESC_KEY, 59 SUBTITLES_KEY, 60 nil]; 61 displayedMetaData = [[NSSet alloc] initWithArray:displayedMetaDataOrder]; 62 } 63 26 64 + (SapphireFileMetaData *)fileWithPath:(NSString *)path inContext:(NSManagedObjectContext *)moc 27 65 { … … 128 166 SapphireEpisode *ep = [SapphireEpisode episodeWithDictionary:tvdict inContext:[self managedObjectContext]]; 129 167 self.tvEpisode = ep; 168 if(ep != nil) 169 self.fileClassValue = FILE_CLASS_TV_SHOW; 130 170 importType |= IMPORT_TYPE_TVSHOW_MASK; 131 171 } … … 136 176 SapphireMovie *movie = [SapphireMovie movieWithDictionary:movieDict inContext:[self managedObjectContext]]; 137 177 self.movie = movie; 178 if(movie != nil) 179 self.fileClassValue = FILE_CLASS_MOVIE; 138 180 importType |= IMPORT_TYPE_MOVIE_MASK; 139 181 } … … 381 423 } 382 424 425 - (NSString *)coverArtPath 426 { 427 /*Find cover art for the current file in the "Cover Art" dir */ 428 NSString *subPath = [[self path] stringByDeletingPathExtension]; 429 NSString *fileName = [subPath lastPathComponent]; 430 NSString * myArtPath=nil; 431 if([self fileClassValue]==FILE_CLASS_TV_SHOW) 432 myArtPath=[[self tvEpisode] coverArtPath]; 433 if([self fileClassValue]==FILE_CLASS_MOVIE) 434 myArtPath=[[self movie] coverArtPath]; 435 436 /* Check the Collection Art location */ 437 NSString *ret=searchCoverArtExtForPath(myArtPath); 438 439 if(ret != nil) 440 return ret; 441 442 /* Try Legacy Folders with the file */ 443 ret=searchCoverArtExtForPath([[[subPath stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"Cover Art"] stringByAppendingPathComponent:fileName]); 444 445 if(ret != nil) 446 return ret; 447 448 /*Find cover art for the current file in the current dir*/ 449 ret = searchCoverArtExtForPath(subPath); 450 451 if(ret != nil) 452 return ret; 453 454 455 return nil; 456 } 457 458 - (NSMutableDictionary *)getDisplayedMetaDataInOrder:(NSArray * *)order; 459 { 460 NSString *name = [[self path] lastPathComponent]; 461 /*Create duration string*/ 462 int duration = [self durationValue]; 463 int secs = duration % 60; 464 int mins = (duration /60) % 60; 465 int hours = duration / 3600; 466 NSString *durationStr = nil; 467 if(hours != 0) 468 durationStr = [NSString stringWithFormat:@"%d:%02d:%02d", hours, mins, secs]; 469 else if (mins != 0) 470 durationStr = [NSString stringWithFormat:@"%d:%02d", mins, secs]; 471 else 472 durationStr = [NSString stringWithFormat:@"%ds", secs]; 473 /*Set the order*/ 474 if(order != nil) 475 *order = displayedMetaDataOrder; 476 477 NSMutableDictionary *ret = [[NSMutableDictionary alloc] init]; 478 479 SapphireMovie *movie = [self movie]; 480 SapphireEpisode *ep = [self tvEpisode]; 481 if(movie != nil) 482 { 483 [movie insertDisplayMetaData:ret]; 484 } 485 else if (ep != nil) 486 { <
