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 |
|
|
44 |
print '[TODIC]:'+str(url) |
print '[TODIC]:'+str(url) |
45 |
link = open_url(url) |
link = open_url(url) |
46 |
ty=re.compile('<meta type=\'(.+?)\'').findall(link) |
ty=re.compile('<meta type=\'(.+?)\'').findall(link) |
47 |
print '[TOD]'+str(ty[0]) |
print '[TODIC]'+str(ty[0]) |
48 |
|
|
49 |
|
if ty[0] == 'clipList': |
50 |
|
mode = '50' |
51 |
|
folder = False |
52 |
|
else: |
53 |
|
mode = '1' |
54 |
|
folder = True |
55 |
|
|
56 |
m=re.compile('<title>(.+?)</title><url>(.+?)</url><cover>(.+?)</cover>').findall(link) |
m=re.compile('<title>(.+?)</title><url>(.+?)</url><cover>(.+?)</cover>').findall(link) |
57 |
for name,url,thumb in m: |
l=len(m) |
58 |
if ty[0] == 'clipList': |
for name,url,thumb in m: |
|
mode = '50' |
|
|
folder = False |
|
|
else: |
|
|
mode = '2' |
|
|
folder = True |
|
|
|
|
59 |
listitem = xbmcgui.ListItem(label = name, iconImage = 'DefaultFolder.png', thumbnailImage = thumb) |
listitem = xbmcgui.ListItem(label = name, iconImage = 'DefaultFolder.png', thumbnailImage = thumb) |
60 |
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) |
61 |
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) |
62 |
xbmcplugin.endOfDirectory(int(sys.argv[1])) |
xbmcplugin.endOfDirectory(int(sys.argv[1])) |
63 |
|
|
|
def buildSubList(url,title): |
|
|
print '[TODIC]:'+str(url) |
|
|
link = open_url(url) |
|
|
m=re.compile('<title>(.+?)</title><url>(.+?)</url><cover>(.+?)</cover>').findall(link) |
|
|
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) |
|
|
xbmcplugin.endOfDirectory(int(sys.argv[1])) |
|
64 |
|
|
65 |
|
|
66 |
|
|
76 |
xbmc.Player(xbmc.PLAYER_CORE_AUTO).play(str(url), listitem) |
xbmc.Player(xbmc.PLAYER_CORE_AUTO).play(str(url), listitem) |
77 |
xbmc.sleep(200) |
xbmc.sleep(200) |
78 |
|
|
79 |
|
def search(): |
80 |
|
search = getUserInput("Todic Søgning") |
81 |
|
|
82 |
|
if (search != None and search != ""): |
83 |
|
url = __backend__ + "&action=search&search=" + urllib.quote_plus(search) |
84 |
|
|
85 |
|
#print "[TODIC] Search start: " + search |
86 |
|
#print "[TODIC] Search url: " + url |
87 |
|
|
88 |
|
buildList(url, "søgning") |
89 |
|
|
90 |
|
|
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
#=================================== Tool Box ======================================= |
95 |
|
# shows a more userfriendly notification |
96 |
|
def showMessage(heading, message): |
97 |
|
duration = 15*1000 |
98 |
|
xbmc.executebuiltin('XBMC.Notification("%s", "%s", %s)' % ( heading, message, duration) ) |
99 |
|
|
100 |
|
|
101 |
|
# raise a keyboard for user input |
102 |
|
def getUserInput(title = "Input", default="", hidden=False): |
103 |
|
result = None |
104 |
|
|
105 |
|
# Fix for when this functions is called with default=None |
106 |
|
if not default: |
107 |
|
default = "" |
108 |
|
|
109 |
|
keyboard = xbmc.Keyboard(default, title) |
110 |
|
keyboard.setHiddenInput(hidden) |
111 |
|
keyboard.doModal() |
112 |
|
|
113 |
|
if keyboard.isConfirmed(): |
114 |
|
result = keyboard.getText() |
115 |
|
|
116 |
|
return result |
117 |
|
|
118 |
|
|
119 |
def get_params(): |
def get_params(): |
120 |
param=[] |
param=[] |
165 |
#build list of movie starting letters |
#build list of movie starting letters |
166 |
buildList(url, name) |
buildList(url, name) |
167 |
|
|
168 |
elif mode == 2: |
elif mode == 10: |
169 |
#build list of series |
search() |
170 |
buildSubList(url, name) |
|
171 |
|
|
172 |
elif mode == 50: |
elif mode == 50: |
173 |
play_video(url, name) |
play_video(url, name) |
174 |
|
|
175 |
|
|
176 |
|
|
177 |
xbmcplugin.endOfDirectory(int(sys.argv[1])) |
# xbmcplugin.endOfDirectory(int(sys.argv[1])) |
178 |
|
|