poster urls

This commit is contained in:
j 2010-07-19 12:05:01 +02:00
parent 80385abcd0
commit d82353a186

View file

@ -9,6 +9,7 @@ import time
import ox
from ox import findRe, stripTags
from ox.normalize import normalizeTitle, normalizeImdbId
from ox.cache import readUrl
from siteparser import SiteParser
import google
@ -108,7 +109,7 @@ class Imdb(SiteParser):
'poster_id': {
'page': 'combined',
're': '/primary-photo/media/rm(.*?)/tt',
'type': 'list'
'type': 'string'
},
'poster_ids': {
'page': 'posters',
@ -261,6 +262,15 @@ def getMovieId(title, director='', year=''):
return url[28:35]
return ''
def getMoviePoster(imdbId):
info = ImdbCombined(imdbId)
if 'poster_id' in info:
url = "http://www.imdb.com/rg/action-box-title/primary-photo/media/rm%s/tt%s" % (info['poster_id'], imdbId)
data = readUrl(url)
poster = findRe(data, 'img id="primary-img".*?src="(.*?)"')
return poster
return ''
def guess(title, director='', timeout=google.DEFAULT_TIMEOUT):
#FIXME: proper file -> title
title = title.split('-')[0]