3 |
|
|
4 |
''' |
''' |
5 |
Todic plugin for XBMC |
Todic plugin for XBMC |
6 |
Version 0.1.2 |
Version 0.1.6 |
7 |
''' |
''' |
8 |
|
|
9 |
import sys |
import sys |
102 |
|
|
103 |
def __init__(self, *args, **kwargs): |
def __init__(self, *args, **kwargs): |
104 |
# xbmc.Player.__init__(selv,*args,**kwargs) |
# xbmc.Player.__init__(selv,*args,**kwargs) |
105 |
xbmc.Player.__init__(self, xbmc.PLAYER_CORE_MPLAYER) |
xbmc.Player.__init__(self) |
106 |
self.stopped = False |
self.stopped = False |
107 |
self.started = False |
self.started = False |
108 |
self.playingPosition = 0.0 |
self.playingPosition = 0.0 |
246 |
|
|
247 |
entries = doc.getElementsByTagName("entry") |
entries = doc.getElementsByTagName("entry") |
248 |
l = len(entries) |
l = len(entries) |
249 |
description = '' |
|
250 |
for entry in entries: |
for entry in entries: |
251 |
name = getText(entry.getElementsByTagName("title")) |
name = getText(entry.getElementsByTagName("title")) |
252 |
url = getText(entry.getElementsByTagName("url")) |
url = getText(entry.getElementsByTagName("url")) |
253 |
thumb = getText(entry.getElementsByTagName("cover")) |
thumb = getText(entry.getElementsByTagName("cover")) |
|
description = getText(entry.getElementsByTagName("description")) |
|
254 |
playcount = getText(entry.getElementsByTagName("playcount")) |
playcount = getText(entry.getElementsByTagName("playcount")) |
255 |
|
|
256 |
|
|
261 |
# print "name:" + name |
# print "name:" + name |
262 |
# print "url:" + url |
# print "url:" + url |
263 |
# print "thumb:" + thumb |
# print "thumb:" + thumb |
|
# print "description:" + description |
|
264 |
listitem = xbmcgui.ListItem( |
listitem = xbmcgui.ListItem( |
265 |
label=name, label2='test', iconImage='DefaultFolder.png', thumbnailImage=thumb) |
label=name, label2='test', iconImage='DefaultFolder.png', thumbnailImage=thumb) |
266 |
listitem.setProperty('Fanart_Image', fanartImage) |
listitem.setProperty('Fanart_Image', fanartImage) |
267 |
if mode == '50': |
if mode == '50': |
268 |
infoLabels = {} |
infoLabels = {} |
269 |
infoLabels['title'] = name |
infoLabels['title'] = name |
|
infoLabels['plot'] = description |
|
270 |
infoLabels['playcount'] = playcount |
infoLabels['playcount'] = playcount |
271 |
listitem.setInfo('video', infoLabels) |
listitem.setInfo('video', infoLabels) |
272 |
|
|
273 |
name = name.encode('UTF-8') |
name = name.encode('UTF-8') |
|
description = description.encode('UTF-8') |
|
274 |
|
|
275 |
u = sys.argv[0] + "?mode=" + urllib.quote(mode) + "&name=" + urllib.quote( |
u = sys.argv[0] + "?mode=" + urllib.quote(mode) + "&name=" + urllib.quote( |
276 |
name) + "&url=" + urllib.quote(url) + "&description=" + urllib.quote(description) |
name) + "&url=" + urllib.quote(url) |
277 |
xbmcplugin.addDirectoryItem( |
xbmcplugin.addDirectoryItem( |
278 |
handle=int(sys.argv[1]), url=u, listitem=listitem, isFolder=folder, totalItems=l) |
handle=int(sys.argv[1]), url=u, listitem=listitem, isFolder=folder, totalItems=l) |
279 |
|
|
281 |
xbmcplugin.endOfDirectory(int(sys.argv[1])) |
xbmcplugin.endOfDirectory(int(sys.argv[1])) |
282 |
|
|
283 |
|
|
284 |
def play_video(url, name, description): |
def play_video(url, name): |
285 |
param1 = parse_parameter_string(url) |
description = "" |
|
clipkey = param1["clipkey"] |
|
|
|
|
|
print "[Todic] ClipKey:" + clipkey |
|
|
detailurl = __backend__ + "&action=clipdetails&clipkey=" + clipkey |
|
|
print "[Todic] detailURL = " + detailurl |
|
|
|
|
|
xml = open_url(detailurl) |
|
|
|
|
|
clipDetailsDoc = parseString(xml) |
|
|
savedPosition = int( getText(clipDetailsDoc.getElementsByTagName("position")) ) |
|
286 |
playPosition = 0 |
playPosition = 0 |
287 |
|
savedPosition = 0 |
288 |
|
try: |
289 |
|
param1 = parse_parameter_string(url) |
290 |
|
clipkey = param1["clipkey"] |
291 |
|
|
292 |
|
print "[Todic] ClipKey:" + clipkey |
293 |
|
detailurl = __backend__ + "&action=clipdetails&clipkey=" + clipkey |
294 |
|
print "[Todic] detailURL = " + detailurl |
295 |
|
|
296 |
|
xml = open_url(detailurl) |
297 |
|
|
298 |
|
clipDetailsDoc = parseString(xml) |
299 |
|
savedPosition = int( getText(clipDetailsDoc.getElementsByTagName("position")) ) |
300 |
|
description = getText(clipDetailsDoc.getElementsByTagName("description")) |
301 |
|
except: |
302 |
|
print "[Todic] Unexpected error:", sys.exc_info()[0] |
303 |
|
|
304 |
if (description == None or description == ""): |
if (description == None or description == ""): |
305 |
if (savedPosition > 0): |
if (savedPosition > 0): |
350 |
listitem.setProperty('ResumeTime', '300') |
listitem.setProperty('ResumeTime', '300') |
351 |
listitem.setProperty('TotalTime', '3000') |
listitem.setProperty('TotalTime', '3000') |
352 |
|
|
353 |
player = TodicPlayer(xbmc.PLAYER_CORE_AUTO) |
player = TodicPlayer() |
354 |
player.play(str(url), listitem) |
player.play(str(url), listitem) |
355 |
|
|
356 |
# kan ikke loade subtitles hvis foerend playeren koerer |
# kan ikke loade subtitles hvis foerend playeren koerer |
368 |
player.setSubtitles(subtitlesfile) |
player.setSubtitles(subtitlesfile) |
369 |
print '[Todic] started subtitles' |
print '[Todic] started subtitles' |
370 |
else: |
else: |
371 |
player.disableSubtitles() |
player.showSubtitles(False) |
372 |
|
|
373 |
|
|
374 |
if (position > 0): |
if (position > 0): |
463 |
url = None |
url = None |
464 |
name = None |
name = None |
465 |
mode = None |
mode = None |
|
description = None |
|
466 |
|
|
467 |
|
|
468 |
#print params |
#print params |
479 |
mode = int(params["mode"]) |
mode = int(params["mode"]) |
480 |
except: |
except: |
481 |
pass |
pass |
|
try: |
|
|
description = urllib.unquote_plus(params["description"]) |
|
|
except: |
|
|
pass |
|
482 |
|
|
483 |
|
|
484 |
|
|
512 |
|
|
513 |
|
|
514 |
elif mode == 50: |
elif mode == 50: |
515 |
play_video(url, name, description) |
play_video(url, name) |