normalizeTitle

This commit is contained in:
j 2007-08-10 12:19:11 +00:00
commit 50e9f3e819
2 changed files with 904 additions and 4 deletions

View file

@ -15,6 +15,7 @@ from utils import stripTags, htmldecode
import utils
import chardet
import imdbpy_utils
cache_base = "/var/cache/scrapeit/cache/"
@ -183,18 +184,18 @@ class IMDb:
title = title.replace(t, '')
if title.find(u'\xa0') > -1:
title = title[:title.find(u'\xa0')]
title = title.strip()
title = imdbpy_utils.normalizeTitle(title.strip())
if title.startswith('"') and title.endswith('"'):
title = title[1:-1]
title = imdbpy_utils.normalizeTitle(title[1:-1])
elif title.startswith('"') and title.find('"',1) > 0 and \
title.find('"',1) == title.rfind('"'):
se = re.compile("Season (\d*), Episode (\d*)\)").findall(data)
if se:
se = se[0]
se = ' (S%02dE%02d)' % (int(se[0]), int(se[1]))
title = title[1:title.rfind('"')] + se + title[title.rfind('"')+1:]
title = imdbpy_utils.normalizeTitle(title[1:title.rfind('"')]) + se + title[title.rfind('"')+1:]
else:
title = title[1:title.rfind('"')] + ':' + title[title.rfind('"')+1:]
title = imdbpy_utils.normalizeTitle(title[1:title.rfind('"')]) + ':' + title[title.rfind('"')+1:]
return title
def parseYear(self):