3 |
|
|
4 |
''' |
''' |
5 |
Todic plugin for XBMC |
Todic plugin for XBMC |
6 |
Version 0.1.2 |
Version 1.7 |
7 |
''' |
''' |
8 |
|
|
9 |
import sys |
import sys |
24 |
|
|
25 |
__addon__ = xbmcaddon.Addon(id='plugin.video.todic') |
__addon__ = xbmcaddon.Addon(id='plugin.video.todic') |
26 |
__key__ = __addon__.getSetting('xbmckey').lower() |
__key__ = __addon__.getSetting('xbmckey').lower() |
27 |
|
__entrypoint__ = __addon__.getSetting('entrypoint').lower() |
28 |
__backend__ = "https://todic.dk/xbmc.php?xbmckey=" + __key__ |
__backend__ = "https://todic.dk/xbmc.php?xbmckey=" + __key__ |
29 |
|
|
30 |
|
if __entrypoint__ == "alternative": |
31 |
|
__backend__ = "https://alt.todic.dk/xbmc.php?xbmckey=" + __key__ |
32 |
|
|
33 |
|
if __entrypoint__ == "testing": |
34 |
|
__backend__ = "https://todic.dk/xbmc-beta.php?xbmckey=" + __key__ |
35 |
|
|
36 |
|
|
37 |
|
|
38 |
fanartImage = os.path.join(__addon__.getAddonInfo('path'), 'movie_bg_blur.jpg') |
fanartImage = os.path.join(__addon__.getAddonInfo('path'), 'movie_bg_blur.jpg') |
39 |
datapath = xbmc.translatePath( |
datapath = xbmc.translatePath( |
40 |
'special://profile/addon_data/plugin.video.todic/') |
'special://profile/addon_data/plugin.video.todic/') |
112 |
|
|
113 |
def __init__(self, *args, **kwargs): |
def __init__(self, *args, **kwargs): |
114 |
# xbmc.Player.__init__(selv,*args,**kwargs) |
# xbmc.Player.__init__(selv,*args,**kwargs) |
115 |
xbmc.Player.__init__(self, xbmc.PLAYER_CORE_MPLAYER) |
xbmc.Player.__init__(self) |
116 |
self.stopped = False |
self.stopped = False |
117 |
self.started = False |
self.started = False |
118 |
self.playingPosition = 0.0 |
self.playingPosition = 0.0 |
256 |
|
|
257 |
entries = doc.getElementsByTagName("entry") |
entries = doc.getElementsByTagName("entry") |
258 |
l = len(entries) |
l = len(entries) |
259 |
description = '' |
|
260 |
for entry in entries: |
for entry in entries: |
261 |
name = getText(entry.getElementsByTagName("title")) |
name = getText(entry.getElementsByTagName("title")) |
262 |
url = getText(entry.getElementsByTagName("url")) |
url = getText(entry.getElementsByTagName("url")) |
263 |
thumb = getText(entry.getElementsByTagName("cover")) |
thumb = getText(entry.getElementsByTagName("cover")) |
|
description = getText(entry.getElementsByTagName("description")) |
|
264 |
playcount = getText(entry.getElementsByTagName("playcount")) |
playcount = getText(entry.getElementsByTagName("playcount")) |
265 |
|
|
266 |
|
|
271 |
# print "name:" + name |
# print "name:" + name |
272 |
# print "url:" + url |
# print "url:" + url |
273 |
# print "thumb:" + thumb |
# print "thumb:" + thumb |
|
# print "description:" + description |
|
274 |
listitem = xbmcgui.ListItem( |
listitem = xbmcgui.ListItem( |
275 |
label=name, label2='test', iconImage='DefaultFolder.png', thumbnailImage=thumb) |
label=name, label2='test', iconImage='DefaultFolder.png', thumbnailImage=thumb) |
276 |
listitem.setProperty('Fanart_Image', fanartImage) |
listitem.setProperty('Fanart_Image', fanartImage) |
277 |
if mode == '50': |
if mode == '50': |
278 |
infoLabels = {} |
infoLabels = {} |
279 |
infoLabels['title'] = name |
infoLabels['title'] = name |
|
infoLabels['plot'] = description |
|
280 |
infoLabels['playcount'] = playcount |
infoLabels['playcount'] = playcount |
281 |
listitem.setInfo('video', infoLabels) |
listitem.setInfo('video', infoLabels) |
282 |
|
|
283 |
name = name.encode('UTF-8') |
name = name.encode('UTF-8') |
|
description = description.encode('UTF-8') |
|
284 |
|
|
285 |
u = sys.argv[0] + "?mode=" + urllib.quote(mode) + "&name=" + urllib.quote( |
u = sys.argv[0] + "?mode=" + urllib.quote(mode) + "&name=" + urllib.quote( |
286 |
name) + "&url=" + urllib.quote(url) + "&description=" + urllib.quote(description) |
name) + "&url=" + urllib.quote(url) |
287 |
xbmcplugin.addDirectoryItem( |
xbmcplugin.addDirectoryItem( |
288 |
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) |
289 |
|
|
291 |
xbmcplugin.endOfDirectory(int(sys.argv[1])) |
xbmcplugin.endOfDirectory(int(sys.argv[1])) |
292 |
|
|
293 |
|
|
294 |
def play_video(url, name, description): |
def play_video(url, name): |
295 |
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")) ) |
|
296 |
playPosition = 0 |
playPosition = 0 |
297 |
|
savedPosition = 0 |
298 |
|
try: |
299 |
|
param1 = parse_parameter_string(url) |
300 |
|
clipkey = param1["clipkey"] |
301 |
|
|
302 |
|
print "[Todic] ClipKey:" + clipkey |
303 |
|
detailurl = __backend__ + "&action=clipdetails&clipkey=" + clipkey |
304 |
|
print "[Todic] detailURL = " + detailurl |
305 |
|
|
306 |
|
xml = open_url(detailurl) |
307 |
|
|
308 |
|
clipDetailsDoc = parseString(xml) |
309 |
|
savedPosition = int( getText(clipDetailsDoc.getElementsByTagName("position")) ) |
310 |
|
description = getText(clipDetailsDoc.getElementsByTagName("description")) |
311 |
|
except: |
312 |
|
print "[Todic] Unexpected error:", sys.exc_info()[0] |
313 |
|
|
314 |
if (description == None or description == ""): |
if (description == None or description == ""): |
315 |
if (savedPosition > 0): |
if (savedPosition > 0): |
360 |
listitem.setProperty('ResumeTime', '300') |
listitem.setProperty('ResumeTime', '300') |
361 |
listitem.setProperty('TotalTime', '3000') |
listitem.setProperty('TotalTime', '3000') |
362 |
|
|
363 |
player = TodicPlayer(xbmc.PLAYER_CORE_AUTO) |
player = TodicPlayer() |
364 |
player.play(str(url), listitem) |
player.play(str(url), listitem) |
365 |
|
|
366 |
# kan ikke loade subtitles hvis foerend playeren koerer |
# kan ikke loade subtitles hvis foerend playeren koerer |
378 |
player.setSubtitles(subtitlesfile) |
player.setSubtitles(subtitlesfile) |
379 |
print '[Todic] started subtitles' |
print '[Todic] started subtitles' |
380 |
else: |
else: |
381 |
player.disableSubtitles() |
player.showSubtitles(False) |
382 |
|
|
383 |
|
|
384 |
if (position > 0): |
if (position > 0): |
473 |
url = None |
url = None |
474 |
name = None |
name = None |
475 |
mode = None |
mode = None |
|
description = None |
|
476 |
|
|
477 |
|
|
478 |
#print params |
#print params |
489 |
mode = int(params["mode"]) |
mode = int(params["mode"]) |
490 |
except: |
except: |
491 |
pass |
pass |
|
try: |
|
|
description = urllib.unquote_plus(params["description"]) |
|
|
except: |
|
|
pass |
|
492 |
|
|
493 |
|
|
494 |
|
|
522 |
|
|
523 |
|
|
524 |
elif mode == 50: |
elif mode == 50: |
525 |
play_video(url, name, description) |
play_video(url, name) |