From cb8ebbe74aa82185ca513192fd468fd0f56c27f5 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Thu, 3 Nov 2011 11:21:49 +0100 Subject: [PATCH] some static id mapping --- ox/web/impawards.py | 215 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 214 insertions(+), 1 deletion(-) diff --git a/ox/web/impawards.py b/ox/web/impawards.py index 28dac82..c475d65 100644 --- a/ox/web/impawards.py +++ b/ox/web/impawards.py @@ -6,7 +6,6 @@ from ox.cache import readUrlUnicode from ox.html import stripTags from ox.text import findRe -import imdb def getData(id): ''' @@ -24,6 +23,8 @@ def getData(id): } html = readUrlUnicode(data['url']) data['imdbId'] = findRe(html, 'imdb.com/title/tt(\d{7})') + if not data['imdbId']: + data['imdbId'] = _id_map.get(id, '') data['title'] = stripTags(findRe(html, '
(.*?) \(')) data['year'] = findRe(html, '\((.*?)\)') data['posters'] = [] @@ -44,6 +45,7 @@ def getData(id): else: poster = 'http://www.impawards.com/%s/%s' % (data['year'], findRe(html, '