also strip single quotes from titles. fixes #1050

This commit is contained in:
j 2012-09-30 12:14:33 +02:00
parent e0dd4d53b1
commit 1935b76b46

View file

@ -332,6 +332,8 @@ class Imdb(SiteParser):
def cleanup_title(title): def cleanup_title(title):
if title.startswith('"') and title.endswith('"'): if title.startswith('"') and title.endswith('"'):
title = title[1:-1] title = title[1:-1]
if title.startswith("'") and title.endswith("'"):
title = title[1:-1]
title = re.sub('\(\#[.\d]+\)', '', title) title = re.sub('\(\#[.\d]+\)', '', title)
return title.strip() return title.strip()
@ -386,12 +388,9 @@ class Imdb(SiteParser):
for rel, data, _ in self['connections']: for rel, data, _ in self['connections']:
#cc[unicode(rel)] = re.compile('<a href="/title/tt(\d{7})/">(.*?)</a>').findall(data) #cc[unicode(rel)] = re.compile('<a href="/title/tt(\d{7})/">(.*?)</a>').findall(data)
def get_conn(c): def get_conn(c):
title = c[1]
if title.startswith('"') and title.endswith('"'):
title = title[1:-1]
r = { r = {
'id': c[0], 'id': c[0],
'title': title, 'title': cleanup_title(c[1]),
} }
description = c[2].split('<br />') description = c[2].split('<br />')
if len(description) == 2: if len(description) == 2: