poster urls
This commit is contained in:
parent
80385abcd0
commit
d82353a186
1 changed files with 11 additions and 1 deletions
|
@ -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]
|
||||
|
|
Loading…
Reference in a new issue