2011-01-09, 01:08
for my plugin, the site i am scraping for movies (MOVIEINDEX) provides imdb links, so i made a tiny imdb scraper to get poster (Get_Meta):
the problem is that this gives me a massive waiting time for directory to load as it scrapes all the relevant imdb pages....
is there a way to have the imdb scraping and icon adding going on as in the backgroung as i am browsing the movie directory?
(similiar to the Apple Trailers plugin)
PHP Code:
def MOVIEINDEX(url):
link=GetURL(url)
match=re.compile('<a name=i id=(.+?)></a><img class=star><a href=/(.+?)>(.+?)<br>').findall(link)
for imdb,url,name in match:
name=CLEANUP(name)
addDir(name,iceurl+url,100,'')
Get_Meta(name,imdb)
def Get_Meta(name,url):
url='http://www.imdb.com/title/tt'+url
req = urllib2.Request(url)
req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
response = urllib2.urlopen(req)
link=response.read()
response.close()
get_meta=re.compile('id="img_primary">.+?<img src="(.+?)\n.+?Poster"', re.DOTALL).findall(link)
for imgurl in get_meta:
listitem = xbmcgui.ListItem(name)
listitem.setThumbnailImage(imgurl)
the problem is that this gives me a massive waiting time for directory to load as it scrapes all the relevant imdb pages....
is there a way to have the imdb scraping and icon adding going on as in the backgroung as i am browsing the movie directory?
(similiar to the Apple Trailers plugin)