Changeset 451
- Timestamp:
- 01/10/08 11:10:56 (11 months ago)
- Files:
-
- trunk/SapphireBrowser.m (modified) (1 diff)
- trunk/SapphireMediaPreview.m (modified) (1 diff)
- trunk/SapphireMetaData.h (modified) (2 diffs)
- trunk/SapphireMetaData.m (modified) (2 diffs)
- trunk/SapphireTVShowImporter.m (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/SapphireBrowser.m
r450 r451 353 353 /*Display episode number if availble*/ 354 354 int eps= [meta episodeNumber] ; 355 int ep2= [meta secondEpisodeNumber] ; 355 356 displayName=[meta episodeTitle] ; 356 357 if(eps>0) 357 358 { 358 [SapphireFrontRowCompat setRightJustifiedText:[NSString stringWithFormat:@" %02d",eps] forMenu:result]; 359 if(ep2>0) 360 [SapphireFrontRowCompat setRightJustifiedText:[NSString stringWithFormat:@" %02d-%02d",eps, ep2] forMenu:result]; 361 else 362 [SapphireFrontRowCompat setRightJustifiedText:[NSString stringWithFormat:@" %02d",eps] forMenu:result]; 359 363 rightTextSet = YES; 360 364 } trunk/SapphireMediaPreview.m
r436 r451 212 212 /*Remove the individuals so we don't display them*/ 213 213 [allMeta removeObjectForKey:META_EPISODE_NUMBER_KEY]; 214 [allMeta removeObjectForKey:META_EPISODE_2_NUMBER_KEY]; 214 215 [allMeta removeObjectForKey:META_SEASON_NUMBER_KEY]; 215 216 } trunk/SapphireMetaData.h
r445 r451 38 38 #define META_ABSOLUTE_EP_NUMBER_KEY @"Episode Number" 39 39 #define META_SHOW_IDENTIFIER_KEY @"Show ID" 40 #define META_EPISODE_2_NUMBER_KEY @"Episode 2" 41 #define META_ABSOLUTE_EP_2_NUMBER_KEY @"Episode Number 2" 40 42 41 43 //ATV Extra Info … … 872 874 873 875 /*! 876 * @brief Returns the second epsiode number of the file for a two part file 877 * 878 * @return The second episode number of the file 879 */ 880 - (int)secondEpisodeNumber; 881 882 /*! 874 883 * @brief Returns the season number of the file 875 884 * trunk/SapphireMetaData.m
r446 r451 1865 1865 } 1866 1866 1867 - (int)secondEpisodeNumber 1868 { 1869 [self constructCombinedData]; 1870 return [[combinedInfo objectForKey:META_EPISODE_2_NUMBER_KEY] intValue]; 1871 } 1872 1867 1873 - (int)seasonNumber 1868 1874 { … … 2045 2051 int ep = [self episodeNumber]; 2046 2052 if(season != 0 && ep != 0) 2047 [ret setObject:[NSString stringWithFormat:@"%@ - %d / %d",[self showName], season, ep] forKey:META_EPISODE_AND_SEASON_KEY]; 2053 { 2054 int secondEp = [self secondEpisodeNumber]; 2055 if(secondEp != nil) 2056 [ret setObject:[NSString stringWithFormat:@"%@ - %d / %d-%d",[self showName], season, ep, secondEp] forKey:META_EPISODE_AND_SEASON_KEY]; 2057 else 2058 [ret setObject:[NSString stringWithFormat:@"%@ - %d / %d",[self showName], season, ep] forKey:META_EPISODE_AND_SEASON_KEY]; 2059 } 2048 2060 return ret; 2049 2061 } trunk/SapphireTVShowImporter.m
r442 r451 105 105 106 106 /*Initialize the regexes*/ 107 regcomp(&letterMarking, "[\\. -]?S[0-9]+E[S0-9]+ ", REG_EXTENDED | REG_ICASE);108 regcomp(&seasonByEpisode, "[\\. -]?[0-9]+x[S0-9]+ ", REG_EXTENDED | REG_ICASE);107 regcomp(&letterMarking, "[\\. -]?S[0-9]+E[S0-9]+(-E[0-9]+)?", REG_EXTENDED | REG_ICASE); 108 regcomp(&seasonByEpisode, "[\\. -]?[0-9]+x[S0-9]+(-[0-9]+)?", REG_EXTENDED | REG_ICASE); 109 109 regcomp(&seasonEpisodeTriple, "[\\. -][0-9]{1,3}[S0-9]{2}[\\. -]", REG_EXTENDED | REG_ICASE); 110 110 return self; … … 449 449 } 450 450 451 - (void)combine:(NSMutableDictionary *)info with:(NSMutableDictionary *)info2 452 { 453 NSMutableDictionary *tdict = [info2 mutableCopy]; 454 [tdict addEntriesFromDictionary:info]; 455 NSString *secname = [info2 objectForKey:META_TITLE_KEY]; 456 NSString *origname = [info objectForKey:META_TITLE_KEY]; 457 if(secname != nil && origname != nil) 458 [tdict setObject:[NSString stringWithFormat:@"%@ / %@", origname, secname] forKey:META_TITLE_KEY]; 459 460 if([info objectForKey:META_EPISODE_NUMBER_KEY] != nil) 461 { 462 NSNumber *secondEp = [info2 objectForKey:META_EPISODE_NUMBER_KEY]; 463 [tdict setObject:secondEp forKey:META_EPISODE_2_NUMBER_KEY]; 464 } 465 NSString *secdesc = [info2 objectForKey:META_DESCRIPTION_KEY]; 466 NSString *origdesc = [info objectForKey:META_DESCRIPTION_KEY]; 467 if(secdesc != nil && origdesc != nil) 468 [tdict setObject:[NSString stringWithFormat:@"%@ / %@", origdesc, secdesc] forKey:META_DESCRIPTION_KEY]; 469 470 if([info objectForKey:META_ABSOLUTE_EP_NUMBER_KEY] != nil) 471 { 472 NSNumber *secondEp = [info2 objectForKey:META_ABSOLUTE_EP_NUMBER_KEY]; 473 [tdict setObject:secondEp forKey:META_ABSOLUTE_EP_2_NUMBER_KEY]; 474 } 475 476 [info addEntriesFromDictionary:tdict]; 477 [tdict release]; 478 } 479 451 480 - (BOOL) importMetaData:(id <SapphireFileMetaDataProtocol>)metaData 452 481 { … … 469 498 /*Check regexes to see if this is a tv show*/ 470 499 int index = NSNotFound; 500 int secondEp = -1; 471 501 regmatch_t matches[3]; 472 502 NSData *fileNameData = [fileName dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; … … 477 507 index = matches[0].rm_so; 478 508 scanString = [fileName substringFromIndex:index]; 509 secondEp = matches[1].rm_so; 479 510 } 480 511 else if(!regexec(&seasonByEpisode, theFileName, 3, matches, 0)) … … 482 513 index = matches[0].rm_so; 483 514 scanString = [fileName substringFromIndex:index]; 515 secondEp = matches[1].rm_so; 484 516 } 485 517 else if(!regexec(&seasonEpisodeTriple, theFileName, 3, matches, 0)) … … 541 573 return NO; 542 574 575 int otherEp = 0; 576 if(secondEp != -1) 577 { 578 [scanner setScanLocation:secondEp - index]; 579 [scanner scanUpToCharactersFromSet:digits intoString:nil]; 580 [scanner scanInt:&otherEp]; 581 } 582 543 583 /*Get the episode's info*/ 544 NSMutableDictionary *info = nil ;584 NSMutableDictionary *info = nil, *info2 = nil; 545 585 if(ep != 0) 586 { 546 587 /*Match on s/e*/ 547 588 info = [self getInfo:show forSeason:season episode:ep]; 589 if(otherEp != 0) 590 info2 = [self getInfo:show forSeason:season episode:otherEp]; 591 } 548 592 else 549 593 { … … 564 608 [NSString stringWithFormat:@"Season %d",[[info objectForKey:META_SEASON_NUMBER_KEY] intValue]]]; 565 609 566 [[NSFileManager defaultManager] constructPath:previewArtPath];610 [[NSFileManager defaultManager] constructPath:previewArtPath]; 567 611 /*Check for screen cap locally and on server*/ 568 612 NSString *showInfoUrl = [info objectForKey:LINK_KEY]; … … 585 629 } 586 630 631 if(info2 != nil) 632 [self combine:info with:info2]; 587 633 /*Import the info*/ 588 634 [info removeObjectForKey:LINK_KEY];
