title_english

This commit is contained in:
j 2007-04-12 11:34:57 +00:00
parent 13d333f841
commit 0f738495f7

View file

@ -132,6 +132,16 @@ class IMDb:
parsed_value = m[0][0] parsed_value = m[0][0]
else: else:
parsed_value = '' parsed_value = ''
elif key == 'also_known_as':
parsed_value = ''
m = re.compile('(.*) \(International: English title').findall(value)
if m:
parsed_value = m[0]
else:
m = re.compile('(.*) \(USA').findall(value)
if m:
parsed_value = m[0]
parsed_value = parsed_value.split('<br />')[-1].split('(')[0].strip()
else: else:
print value print value
parsed_value = value parsed_value = value
@ -178,7 +188,7 @@ class IMDb:
data = data.replace('\n',' ') data = data.replace('\n',' ')
#some values #some values
keys = ('runtime', 'language', 'genre', 'country', 'tagline', 'plot_outline', 'tv_series') keys = ('runtime', 'language', 'genre', 'country', 'tagline', 'plot_outline', 'tv_series', 'also_known_as')
for key in keys: for key in keys:
IMDbDict[key] = '' IMDbDict[key] = ''
IMDbDict['runtime'] = 0 IMDbDict['runtime'] = 0
@ -191,6 +201,7 @@ class IMDb:
if key in keys: if key in keys:
IMDbDict[key] = self.parse_raw_value(key, raw_value) IMDbDict[key] = self.parse_raw_value(key, raw_value)
IMDbDict['title_english'] = IMDbDict.pop('also_known_as', IMDbDict['title'])
#is episode #is episode
IMDbDict['episode_of'] = IMDbDict.pop('tv_series', '') IMDbDict['episode_of'] = IMDbDict.pop('tv_series', '')