regex first, fixes #1058
This commit is contained in:
parent
102365eb8e
commit
7fe62b5ce3
1 changed files with 22 additions and 21 deletions
|
@ -288,6 +288,7 @@ class Imdb(SiteParser):
|
||||||
isinstance(self['alternativeTitles'][0], basestring):
|
isinstance(self['alternativeTitles'][0], basestring):
|
||||||
self['alternativeTitles'] = [self['alternativeTitles']]
|
self['alternativeTitles'] = [self['alternativeTitles']]
|
||||||
|
|
||||||
|
types = {}
|
||||||
for t in self.get('alternativeTitles', []):
|
for t in self.get('alternativeTitles', []):
|
||||||
for type in t[1].split('/'):
|
for type in t[1].split('/'):
|
||||||
type = type.strip()
|
type = type.strip()
|
||||||
|
@ -304,27 +305,27 @@ class Imdb(SiteParser):
|
||||||
if key in type:
|
if key in type:
|
||||||
stop_word = True
|
stop_word = True
|
||||||
break
|
break
|
||||||
if stop_word:
|
if not stop_word:
|
||||||
continue
|
types[type] = t[0]
|
||||||
for regexp in (
|
|
||||||
"^.+ \(imdb display title\) \(English title\)$",
|
for regexp in (
|
||||||
"^International \(English title\)$",
|
"^.+ \(imdb display title\) \(English title\)$",
|
||||||
"^.+ \(English title\)$",
|
"^International \(English title\)$",
|
||||||
"^International \(.+\) \(English title\)$",
|
"^.+ \(English title\)$",
|
||||||
"^.+ \(.+\) \(English title\)$",
|
"^International \(.+\) \(English title\)$",
|
||||||
"^USA$",
|
"^.+ \(.+\) \(English title\)$",
|
||||||
"^UK$",
|
"^USA$",
|
||||||
"^USA \(imdb display title\)$",
|
"^UK$",
|
||||||
"^UK \(imdb display title\)$",
|
"^USA \(imdb display title\)$",
|
||||||
"^USA \(.+\)$",
|
"^UK \(imdb display title\)$",
|
||||||
"^UK \(.+\)$",
|
"^USA \(.+\)$",
|
||||||
"^Australia \(.+\)$",
|
"^UK \(.+\)$",
|
||||||
"^International \(.+ title\)$",
|
"^Australia \(.+\)$",
|
||||||
):
|
"^International \(.+ title\)$",
|
||||||
if re.compile(regexp).findall(type):
|
):
|
||||||
self['internationalTitle'] = t[0]
|
for type in types:
|
||||||
break
|
if re.compile(regexp).findall(type):
|
||||||
if 'internationalTitle' in self:
|
self['internationalTitle'] = types[type]
|
||||||
break
|
break
|
||||||
if 'internationalTitle' in self:
|
if 'internationalTitle' in self:
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in a new issue