Changeset 605
- Timestamp:
- 07/01/08 19:19:19 (6 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/CoreData/SapphireFrappliance/MetaDataImporting/SapphireMovieImporter.m
r560 r605 39 39 /* IMDB XPATHS */ 40 40 #define IMDB_SEARCH_XPATH @"//td[starts-with(a/@href,'/title')]" 41 #define IMDB_UNIQUE_SEARCH_XPATH @"//a[@class='tn15more inline']/@href"41 #define IMDB_UNIQUE_SEARCH_XPATH @"//a[@class='tn15more']/@href" 42 42 #define IMDB_RESULT_LINK_XPATH @"a/@href" 43 43 #define IMDB_POSTER_LINK_XPATH @"//ul/li/a/@href" … … 181 181 - (NSString *)getPosterPath:(NSString *)candidateIMDBLink 182 182 { 183 NSLog(@"Getting posters for %@", candidateIMDBLink); 183 184 NSError *error = nil ; 184 185 NSURL * url=[NSURL URLWithString:[NSString stringWithFormat:@"http://www.imdb.com%@/posters",candidateIMDBLink]] ; … … 188 189 /*Get the results list*/ 189 190 NSArray *results = [root objectsForXQuery:IMDB_POSTER_LINK_XPATH error:&error]; 191 NSLog(@"Results is %@", results); 190 192 if([results count]) 191 193 { … … 530 532 searchStr = [searchStr stringByReplacingAllOccurancesOf:@"." withString:@" "]; 531 533 searchStr = [searchStr stringByReplacingAllOccurancesOf:@"-" withString:@" "]; 532 searchStr = [searchStr stringByReplacingAllOccurancesOf:@"(" withString:@" "];533 searchStr = [searchStr stringByReplacingAllOccurancesOf:@")" withString:@" "];534 534 NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://www.imdb.com/find?s=all&site=aka&q=%@", [searchStr URLEncode]]]; 535 535 NSError * error = nil; … … 551 551 ret = [NSMutableArray arrayWithCapacity:1]; 552 552 results = [root objectsForXQuery:IMDB_UNIQUE_SEARCH_XPATH error:&error]; 553 } 553 } 554 554 555 555 if([results count]) … … 562 562 if(uniqueResult)/*Check for a unique title link*/ 563 563 { 564 NSURL *resultURL = [NSURL URLWithString:[ [[result objectsForXQuery:IMDB_UNIQUE_SEARCH_XPATH error:&error] objectAtIndex:0]stringValue]] ;564 NSURL *resultURL = [NSURL URLWithString:[result stringValue]] ; 565 565 if(resultURL == nil) 566 566 continue; 567 567 NSString *URLSubPath =[resultURL path] ; 568 unsigned int location = [URLSubPath rangeOfString:@"#"].location; 569 if(location != NSNotFound) 570 URLSubPath = [URLSubPath substringToIndex:location]; 568 571 if([URLSubPath hasSuffix:@"/releaseinfo"]) 569 572 {
