do empty posters, hand down more timeouts

This commit is contained in:
j 2011-11-01 13:04:13 +01:00
parent 6655864337
commit 2a7b70c576
2 changed files with 9 additions and 3 deletions

View file

@ -56,7 +56,10 @@ def getData(id, timeout=ox.cache.cache_timeout):
html_ = readUrlUnicode(result) html_ = readUrlUnicode(result)
result = findRe(html_, '<a href="http://www.criterion.com/films/%s.*?">(.*?)</a>' % id) result = findRe(html_, '<a href="http://www.criterion.com/films/%s.*?">(.*?)</a>' % id)
result = findRe(result, "src=\"(.*?)\"") result = findRe(result, "src=\"(.*?)\"")
data["posters"] = [result.replace("_w100", "")] if result:
data["posters"] = [result.replace("_w100", "")]
else:
data["posters"] = []
result = findRe(html, "<img alt=\"Film Still\" height=\"252\" src=\"(.*?)\"") result = findRe(html, "<img alt=\"Film Still\" height=\"252\" src=\"(.*?)\"")
if result: if result:
data["stills"] = [result] data["stills"] = [result]
@ -65,7 +68,10 @@ def getData(id, timeout=ox.cache.cache_timeout):
data["stills"] = filter(lambda x: x, [findRe(html, "\"thumbnailURL\", \"(.*?)\"")]) data["stills"] = filter(lambda x: x, [findRe(html, "\"thumbnailURL\", \"(.*?)\"")])
data["trailers"] = filter(lambda x: x, [findRe(html, "\"videoURL\", \"(.*?)\"")]) data["trailers"] = filter(lambda x: x, [findRe(html, "\"videoURL\", \"(.*?)\"")])
data['imdbId'] = imdb.getMovieId(data['title'], data['director'], data['year']) if timeout == ox.cache.cache_timeout:
timeout = -1
data['imdbId'] = imdb.getMovieId(data['title'],
data['director'], data['year'], timeout=timeout)
return data return data
def getIds(): def getIds():

View file

@ -531,7 +531,7 @@ def getMovieId(title, director='', year='', timeout=-1):
#print (title, director), ": ''," #print (title, director), ": '',"
#print google_query #print google_query
results = google.find(google_query) results = google.find(google_query, timeout=timeout)
if results: if results:
return findRe(results[0][1], 'title/tt(\d{7})') return findRe(results[0][1], 'title/tt(\d{7})')
#or nothing #or nothing