Changeset 624

Show
Ignore:
Timestamp:
07/05/08 16:36:46 (6 months ago)
Author:
gbooker
Message:

Corrected movie import on single result files. This seems to be more reliable; hopefully it is.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/CoreData/SapphireFrappliance/MetaDataImporting/SapphireMovieImporter.m

    r617 r624  
    3939 /* IMDB XPATHS */ 
    4040#define IMDB_SEARCH_XPATH                               @"//td[starts-with(a/@href,'/title')]" 
    41 #define IMDB_UNIQUE_SEARCH_XPATH                @"//a[@class='tn15more']/@href
     41#define IMDB_UNIQUE_SEARCH_XPATH                @"//a/@href[starts-with(.,'http://pro.imdb.com/title')]
    4242#define IMDB_RESULT_LINK_XPATH                  @"a/@href" 
    4343#define IMDB_POSTER_LINK_XPATH                  @"//ul/li/a/@href" 
     
    563563                                if(resultURL == nil) 
    564564                                        continue; 
    565                                 NSString *URLSubPath =[resultURL path] ; 
    566                                 unsigned int location = [URLSubPath rangeOfString:@"#"].location; 
     565                                NSString *URLSubPath =[resultURL path]; 
     566                                unsigned int location = [URLSubPath rangeOfString:@"/title/"].location; 
     567                                int count = 0; 
    567568                                if(location != NSNotFound) 
    568                                         URLSubPath = [URLSubPath substringToIndex:location]; 
    569                                 if([URLSubPath hasSuffix:@"/releaseinfo"]) 
    570                                 { 
    571                                         URLSubPath=[URLSubPath stringByReplacingAllOccurancesOf:@"/releaseinfo" withString:@""]; 
     569                                { 
     570                                        NSString *subStr = [URLSubPath substringFromIndex:location]; 
     571                                        count = [[subStr pathComponents] count]; 
     572                                } 
     573                                if(count == 3) 
     574                                { 
     575                                        URLSubPath=[URLSubPath stringByReplacingAllOccurancesOf:@"//pro." withString:@"//www."]; 
    572576                                        [ret addObject:[NSDictionary dictionaryWithObjectsAndKeys: 
    573                                                 resultTitle, MOVIE_TRAN_IMDB_NAME_KEY, 
    574                                                 URLSubPath, MOVIE_TRAN_IMDB_LINK_KEY, 
    575                                                 nil]]; 
    576                                         return ret ; 
     577                                                                       resultTitle, MOVIE_TRAN_IMDB_NAME_KEY, 
     578                                                                       URLSubPath, MOVIE_TRAN_IMDB_LINK_KEY, 
     579                                                                       nil]]; 
     580                                        return ret ;                                    
    577581                                } 
    578582                        }