27 |
def rootMenu(): |
def rootMenu(): |
28 |
link = open_url(__backend__) |
link = open_url(__backend__) |
29 |
m=re.compile('<title>(.+?)</title><url>(.+?)</url>').findall(link) |
m=re.compile('<title>(.+?)</title><url>(.+?)</url>').findall(link) |
30 |
|
l = len(m) |
31 |
for name,url in m: |
for name,url in m: |
32 |
listitem = xbmcgui.ListItem(label = name, iconImage = 'DefaultFolder.png', thumbnailImage = 'DefaultFolder.png') |
listitem = xbmcgui.ListItem(label = name, iconImage = 'DefaultFolder.png', thumbnailImage = 'DefaultFolder.png') |
33 |
u = sys.argv[0] + "?mode=1&name=" + urllib.quote_plus(name) + "&url=" + urllib.quote_plus(url) |
u = sys.argv[0] + "?mode=1&name=" + urllib.quote_plus(name) + "&url=" + urllib.quote_plus(url) |
34 |
ok = xbmcplugin.addDirectoryItem(handle = int(sys.argv[1]), url = u, listitem = listitem, isFolder = True) |
ok = xbmcplugin.addDirectoryItem(handle = int(sys.argv[1]), url = u, listitem = listitem, isFolder = True, totalItems = l) |
35 |
|
|
36 |
|
listitem = xbmcgui.ListItem(label = "Søg film ...", iconImage = 'DefaultFolder.png', thumbnailImage = 'DefaultFolder.png') |
37 |
|
u = sys.argv[0] + "?mode=10&name=" + urllib.quote_plus(name) |
38 |
|
ok = xbmcplugin.addDirectoryItem(handle = int(sys.argv[1]), url = u, listitem = listitem, isFolder = True, totalItems = l) |
39 |
|
|
40 |
xbmcplugin.endOfDirectory(int(sys.argv[1])) |
xbmcplugin.endOfDirectory(int(sys.argv[1])) |
41 |
|
|
42 |
|
|
46 |
ty=re.compile('<meta type=\'(.+?)\'').findall(link) |
ty=re.compile('<meta type=\'(.+?)\'').findall(link) |
47 |
print '[TOD]'+str(ty[0]) |
print '[TOD]'+str(ty[0]) |
48 |
m=re.compile('<title>(.+?)</title><url>(.+?)</url><cover>(.+?)</cover>').findall(link) |
m=re.compile('<title>(.+?)</title><url>(.+?)</url><cover>(.+?)</cover>').findall(link) |
49 |
|
l=len(m) |
50 |
for name,url,thumb in m: |
for name,url,thumb in m: |
51 |
if ty[0] == 'clipList': |
if ty[0] == 'clipList': |
52 |
mode = '50' |
mode = '50' |
57 |
|
|
58 |
listitem = xbmcgui.ListItem(label = name, iconImage = 'DefaultFolder.png', thumbnailImage = thumb) |
listitem = xbmcgui.ListItem(label = name, iconImage = 'DefaultFolder.png', thumbnailImage = thumb) |
59 |
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) |
60 |
ok = xbmcplugin.addDirectoryItem(handle = int(sys.argv[1]), url = u, listitem = listitem, isFolder = folder) |
ok = xbmcplugin.addDirectoryItem(handle = int(sys.argv[1]), url = u, listitem = listitem, isFolder = folder, totalItems = l) |
61 |
xbmcplugin.endOfDirectory(int(sys.argv[1])) |
xbmcplugin.endOfDirectory(int(sys.argv[1])) |
62 |
|
|
63 |
def buildSubList(url,title): |
def buildSubList(url,title): |
64 |
print '[TODIC]:'+str(url) |
print '[TODIC]:'+str(url) |
65 |
link = open_url(url) |
link = open_url(url) |
66 |
m=re.compile('<title>(.+?)</title><url>(.+?)</url><cover>(.+?)</cover>').findall(link) |
m=re.compile('<title>(.+?)</title><url>(.+?)</url><cover>(.+?)</cover>').findall(link) |
67 |
|
l = len(m) |
68 |
for name,url,thumb in m: |
for name,url,thumb in m: |
69 |
listitem = xbmcgui.ListItem(label = name, iconImage = 'DefaultFolder.png', thumbnailImage = thumb) |
listitem = xbmcgui.ListItem(label = name, iconImage = 'DefaultFolder.png', thumbnailImage = thumb) |
70 |
u = sys.argv[0] + "?mode=50&name=" + urllib.quote_plus(name) + "&url=" + urllib.quote_plus(url) |
u = sys.argv[0] + "?mode=50&name=" + urllib.quote_plus(name) + "&url=" + urllib.quote_plus(url) |
71 |
ok = xbmcplugin.addDirectoryItem(handle = int(sys.argv[1]), url = u, listitem = listitem, isFolder = False) |
ok = xbmcplugin.addDirectoryItem(handle = int(sys.argv[1]), url = u, listitem = listitem, isFolder = False, totalItems = l) |
72 |
xbmcplugin.endOfDirectory(int(sys.argv[1])) |
xbmcplugin.endOfDirectory(int(sys.argv[1])) |
73 |
|
|
74 |
|
|
85 |
xbmc.Player(xbmc.PLAYER_CORE_AUTO).play(str(url), listitem) |
xbmc.Player(xbmc.PLAYER_CORE_AUTO).play(str(url), listitem) |
86 |
xbmc.sleep(200) |
xbmc.sleep(200) |
87 |
|
|
88 |
|
def search(): |
89 |
|
search = getUserInput("Todic Søgning") |
90 |
|
|
91 |
|
if (search != None and search != ""): |
92 |
|
url = __backend__ + "&action=search&search=" + urllib.quote_plus(search) |
93 |
|
|
94 |
|
#print "[TODIC] Search start: " + search |
95 |
|
#print "[TODIC] Search url: " + url |
96 |
|
|
97 |
|
buildSubList(url, "søgning") |
98 |
|
|
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
|
103 |
|
#=================================== Tool Box ======================================= |
104 |
|
# shows a more userfriendly notification |
105 |
|
def showMessage(heading, message): |
106 |
|
duration = 15*1000 |
107 |
|
xbmc.executebuiltin('XBMC.Notification("%s", "%s", %s)' % ( heading, message, duration) ) |
108 |
|
|
109 |
|
|
110 |
|
# raise a keyboard for user input |
111 |
|
def getUserInput(title = "Input", default="", hidden=False): |
112 |
|
result = None |
113 |
|
|
114 |
|
# Fix for when this functions is called with default=None |
115 |
|
if not default: |
116 |
|
default = "" |
117 |
|
|
118 |
|
keyboard = xbmc.Keyboard(default, title) |
119 |
|
keyboard.setHiddenInput(hidden) |
120 |
|
keyboard.doModal() |
121 |
|
|
122 |
|
if keyboard.isConfirmed(): |
123 |
|
result = keyboard.getText() |
124 |
|
|
125 |
|
return result |
126 |
|
|
127 |
|
|
128 |
def get_params(): |
def get_params(): |
129 |
param=[] |
param=[] |
178 |
#build list of series |
#build list of series |
179 |
buildSubList(url, name) |
buildSubList(url, name) |
180 |
|
|
181 |
|
elif mode == 10: |
182 |
|
search() |
183 |
|
|
184 |
|
|
185 |
elif mode == 50: |
elif mode == 50: |
186 |
play_video(url, name) |
play_video(url, name) |
187 |
|
|
188 |
|
|
189 |
|
|
190 |
xbmcplugin.endOfDirectory(int(sys.argv[1])) |
# xbmcplugin.endOfDirectory(int(sys.argv[1])) |
191 |
|
|