5 |
|
|
6 |
import sys |
import sys |
7 |
import cgi as urlparse |
import cgi as urlparse |
8 |
|
import os |
9 |
|
|
10 |
|
|
11 |
import xbmc |
import xbmc |
12 |
import xbmcaddon |
import xbmcaddon |
18 |
__addon__ = xbmcaddon.Addon(id='plugin.video.todic') |
__addon__ = xbmcaddon.Addon(id='plugin.video.todic') |
19 |
__key__ = __addon__.getSetting('xbmckey').lower() |
__key__ = __addon__.getSetting('xbmckey').lower() |
20 |
__backend__ = "http://todic.dk/xbmc.php?xbmckey=" + __key__ |
__backend__ = "http://todic.dk/xbmc.php?xbmckey=" + __key__ |
21 |
|
fanartImage = os.path.join(__addon__.getAddonInfo('path'), 'fanart.jpg') |
22 |
|
|
23 |
def open_url(url): |
def open_url(url): |
24 |
req = urllib2.Request(url) |
req = urllib2.Request(url) |
28 |
return data |
return data |
29 |
|
|
30 |
def rootMenu(): |
def rootMenu(): |
|
link = open_url(__backend__) |
|
|
m=re.compile('<title>(.+?)</title><url>(.+?)</url>').findall(link) |
|
|
l = len(m) |
|
|
for name,url in m: |
|
|
listitem = xbmcgui.ListItem(label = name, iconImage = 'DefaultFolder.png', thumbnailImage = 'DefaultFolder.png') |
|
|
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) |
|
31 |
|
|
32 |
|
buildList(__backend__, "") # call default list |
33 |
|
|
34 |
|
# Adde xtra items to root menu |
35 |
listitem = xbmcgui.ListItem(label = "Søg film ...", iconImage = 'DefaultFolder.png', thumbnailImage = 'DefaultFolder.png') |
listitem = xbmcgui.ListItem(label = "Søg film ...", iconImage = 'DefaultFolder.png', thumbnailImage = 'DefaultFolder.png') |
36 |
u = sys.argv[0] + "?mode=10&name=" + urllib.quote_plus(name) |
listitem.setProperty('Fanart_Image', fanartImage) |
37 |
ok = xbmcplugin.addDirectoryItem(handle = int(sys.argv[1]), url = u, listitem = listitem, isFolder = True, totalItems = l) |
|
38 |
|
u = sys.argv[0] + "?mode=10&name=" |
39 |
|
ok = xbmcplugin.addDirectoryItem(handle = int(sys.argv[1]), url = u, listitem = listitem, isFolder = True) |
40 |
|
|
41 |
xbmcplugin.endOfDirectory(int(sys.argv[1])) |
xbmcplugin.endOfDirectory(int(sys.argv[1])) |
42 |
|
|
57 |
m=re.compile('<title>(.+?)</title><url>(.+?)</url><cover>(.+?)</cover><description>(.*)</description>').findall(link) |
m=re.compile('<title>(.+?)</title><url>(.+?)</url><cover>(.+?)</cover><description>(.*)</description>').findall(link) |
58 |
l=len(m) |
l=len(m) |
59 |
for name,url,thumb,description in m: |
for name,url,thumb,description in m: |
|
infoLabels = {} |
|
|
infoLabels['title'] = name |
|
|
infoLabels['plot'] = description |
|
60 |
|
|
61 |
listitem = xbmcgui.ListItem(label = name, label2='test', iconImage = 'DefaultFolder.png', thumbnailImage = thumb) |
listitem = xbmcgui.ListItem(label = name, label2='test', iconImage = 'DefaultFolder.png', thumbnailImage = thumb) |
62 |
listitem.setInfo('video', infoLabels) |
listitem.setProperty('Fanart_Image', fanartImage) |
63 |
|
if mode == '50': |
64 |
|
infoLabels = {} |
65 |
|
infoLabels['title'] = name |
66 |
|
infoLabels['plot'] = description |
67 |
|
listitem.setInfo('video', infoLabels) |
68 |
|
|
69 |
u = sys.argv[0] + "?mode=" + urllib.quote_plus(mode) + "&name=" + urllib.quote_plus(name) + "&url=" + urllib.quote_plus(url) |
u = sys.argv[0] + "?mode=" + urllib.quote_plus(mode) + "&name=" + urllib.quote_plus(name) + "&url=" + urllib.quote_plus(url) |
70 |
ok = xbmcplugin.addDirectoryItem(handle = int(sys.argv[1]), url = u, listitem = listitem, isFolder = folder, totalItems = l) |
ok = xbmcplugin.addDirectoryItem(handle = int(sys.argv[1]), url = u, listitem = listitem, isFolder = folder, totalItems = l) |
71 |
xbmcplugin.endOfDirectory(int(sys.argv[1])) |
xbmcplugin.endOfDirectory(int(sys.argv[1])) |