--- misc/xbmc/plugin.video.todic/default.py 2016/11/29 18:53:13 3157 +++ misc/xbmc/plugin.video.todic/default.py 2016/12/05 20:22:35 3163 @@ -3,7 +3,7 @@ ''' Todic plugin for XBMC - Version 0.1.2 + Version 0.1.5 ''' import sys @@ -102,7 +102,7 @@ def __init__(self, *args, **kwargs): # xbmc.Player.__init__(selv,*args,**kwargs) - xbmc.Player.__init__(self, xbmc.PLAYER_CORE_MPLAYER) + xbmc.Player.__init__(self) self.stopped = False self.started = False self.playingPosition = 0.0 @@ -246,12 +246,11 @@ entries = doc.getElementsByTagName("entry") l = len(entries) - description = '' + for entry in entries: name = getText(entry.getElementsByTagName("title")) url = getText(entry.getElementsByTagName("url")) thumb = getText(entry.getElementsByTagName("cover")) - description = getText(entry.getElementsByTagName("description")) playcount = getText(entry.getElementsByTagName("playcount")) @@ -262,22 +261,19 @@ # print "name:" + name # print "url:" + url # print "thumb:" + thumb -# print "description:" + description listitem = xbmcgui.ListItem( label=name, label2='test', iconImage='DefaultFolder.png', thumbnailImage=thumb) listitem.setProperty('Fanart_Image', fanartImage) if mode == '50': infoLabels = {} infoLabels['title'] = name - infoLabels['plot'] = description infoLabels['playcount'] = playcount listitem.setInfo('video', infoLabels) name = name.encode('UTF-8') - description = description.encode('UTF-8') u = sys.argv[0] + "?mode=" + urllib.quote(mode) + "&name=" + urllib.quote( - name) + "&url=" + urllib.quote(url) + "&description=" + urllib.quote(description) + name) + "&url=" + urllib.quote(url) xbmcplugin.addDirectoryItem( handle=int(sys.argv[1]), url=u, listitem=listitem, isFolder=folder, totalItems=l) @@ -285,19 +281,25 @@ xbmcplugin.endOfDirectory(int(sys.argv[1])) -def play_video(url, name, description): - param1 = parse_parameter_string(url) - 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")) ) +def play_video(url, name): + description = "" playPosition = 0 + savedPosition = 0 + try: + param1 = parse_parameter_string(url) + 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")) ) + description = getText(clipDetailsDoc.getElementsByTagName("description")) + except: + print "[Todic] Unexpected error:", sys.exc_info()[0] if (description == None or description == ""): if (savedPosition > 0): @@ -366,7 +368,7 @@ player.setSubtitles(subtitlesfile) print '[Todic] started subtitles' else: - player.disableSubtitles() + player.showSubtitles(False) if (position > 0): @@ -461,7 +463,6 @@ url = None name = None mode = None -description = None #print params @@ -478,10 +479,6 @@ mode = int(params["mode"]) except: pass -try: - description = urllib.unquote_plus(params["description"]) -except: - pass @@ -515,4 +512,4 @@ elif mode == 50: - play_video(url, name, description) + play_video(url, name)