--- misc/xbmc/plugin.video.todic/default.py 2011/11/28 19:02:04 1640 +++ misc/xbmc/plugin.video.todic/default.py 2011/12/04 14:40:44 1648 @@ -5,6 +5,8 @@ import sys import cgi as urlparse +import os + import xbmc import xbmcaddon @@ -16,6 +18,7 @@ __addon__ = xbmcaddon.Addon(id='plugin.video.todic') __key__ = __addon__.getSetting('xbmckey').lower() __backend__ = "http://todic.dk/xbmc.php?xbmckey=" + __key__ +fanartImage = os.path.join(__addon__.getAddonInfo('path'), 'fanart.jpg') def open_url(url): req = urllib2.Request(url) @@ -30,10 +33,14 @@ l = len(m) for name,url in m: listitem = xbmcgui.ListItem(label = name, iconImage = 'DefaultFolder.png', thumbnailImage = 'DefaultFolder.png') + listitem.setProperty('Fanart_Image', fanartImage) + u = sys.argv[0] + "?mode=1&name=" + urllib.quote_plus(name) + "&url=" + urllib.quote_plus(url) ok = xbmcplugin.addDirectoryItem(handle = int(sys.argv[1]), url = u, listitem = listitem, isFolder = True, totalItems = l) listitem = xbmcgui.ListItem(label = "Søg film ...", iconImage = 'DefaultFolder.png', thumbnailImage = 'DefaultFolder.png') + listitem.setProperty('Fanart_Image', fanartImage) + u = sys.argv[0] + "?mode=10&name=" + urllib.quote_plus(name) ok = xbmcplugin.addDirectoryItem(handle = int(sys.argv[1]), url = u, listitem = listitem, isFolder = True, totalItems = l) @@ -44,32 +51,30 @@ print '[TODIC]:'+str(url) link = open_url(url) ty=re.compile('(.+?)(.+?)(.+?)').findall(link) + print '[TODIC]'+str(ty[0]) + + if ty[0] == 'clipList': + mode = '50' + folder = False + else: + mode = '1' + folder = True + + m=re.compile('(.+?)(.+?)(.+?)(.*)').findall(link) l=len(m) - for name,url,thumb in m: - if ty[0] == 'clipList': - mode = '50' - folder = False - else: - mode = '2' - folder = True - - listitem = xbmcgui.ListItem(label = name, iconImage = 'DefaultFolder.png', thumbnailImage = thumb) + for name,url,thumb,description in m: + infoLabels = {} + infoLabels['title'] = name + infoLabels['plot'] = description + + listitem = xbmcgui.ListItem(label = name, label2='test', iconImage = 'DefaultFolder.png', thumbnailImage = thumb) + listitem.setInfo('video', infoLabels) + listitem.setProperty('Fanart_Image', fanartImage) + u = sys.argv[0] + "?mode=" + urllib.quote_plus(mode) + "&name=" + urllib.quote_plus(name) + "&url=" + urllib.quote_plus(url) ok = xbmcplugin.addDirectoryItem(handle = int(sys.argv[1]), url = u, listitem = listitem, isFolder = folder, totalItems = l) xbmcplugin.endOfDirectory(int(sys.argv[1])) -def buildSubList(url,title): - print '[TODIC]:'+str(url) - link = open_url(url) - m=re.compile('(.+?)(.+?)(.+?)').findall(link) - l = len(m) - for name,url,thumb in m: - listitem = xbmcgui.ListItem(label = name, iconImage = 'DefaultFolder.png', thumbnailImage = thumb) - u = sys.argv[0] + "?mode=50&name=" + urllib.quote_plus(name) + "&url=" + urllib.quote_plus(url) - ok = xbmcplugin.addDirectoryItem(handle = int(sys.argv[1]), url = u, listitem = listitem, isFolder = False, totalItems = l) - xbmcplugin.endOfDirectory(int(sys.argv[1])) @@ -94,7 +99,7 @@ #print "[TODIC] Search start: " + search #print "[TODIC] Search url: " + url - buildSubList(url, "søgning") + buildList(url, "søgning") @@ -174,10 +179,6 @@ #build list of movie starting letters buildList(url, name) -elif mode == 2: - #build list of series - buildSubList(url, name) - elif mode == 10: search()