Kodi Community Forum

Full Version: SImple Scraper Items inside Folder
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,
I have set up a local server with a web page showing the movie image and a src for the mp4 file
so i wrote a scraper following some tutorials.
every thing works ok im able to see the fanart and the icon and the movie plays with out any problem
But I have totally fail to put the movie links inside the folder. My final goal is to have
4 category English Spanish French German (folders) and inside each folder putting the link to the movies.
I think I have not grasp the concept of directory hierarchy.
Any help will be apreciated this is the code.

Thank You

def addDir(name,url,mode,iconimage):
u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name)
ok=True
liz=xbmcgui.ListItem(name, "DefaultFolder.png", iconimage)
liz.setInfo( type="Video", infoLabels={ "Title": name } )
ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=True)
return ok

addon_handle = int(sys.argv[1])
xbmcplugin.setContent(addon_handle, 'movies')

addDir('English Movies','',1,'')

url='http://192.168.2.64/index.php'

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()
match_video=re.compile("<a href='(.+?)'>").findall(link)
match_image=re.compile("<img src='(.+?)' alt='' />").findall(link)
match_name=re.compile("<a href='http://192.168.2.64/videos/(.+?).mp4'>").findall(link)
match_title=re.compile("<p>(.+?)</p>").findall(link)


for i in xrange(0, len(match_video)):
url = match_video[i]
li = xbmcgui.ListItem(match_title[i], iconImage=match_image[i])
fanart = "http://192.168.2.64/images/fanart/" + match_name[i] + "_fanart.jpg"
li.setProperty('fanart_image', fanart)
xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li)

xbmcplugin.endOfDirectory(addon_handle)