def buildVideoLink(self, displayObject, mediathek, objectCount): if(displayObject.subTitle == "" or displayObject.subTitle == displayObject.title): title = transformHtmlCodes(displayObject.title); else: title = transformHtmlCodes(displayObject.title +" - "+ displayObject.subTitle); if displayObject.date is not None: title = "(%s) %s"%(time.strftime("%d.%m",displayObject.date),title); if displayObject.picture is not None: listItem=xbmcgui.ListItem(title, iconImage="DefaultFolder.png", thumbnailImage=displayObject.picture) else: listItem=xbmcgui.ListItem(title, iconImage="DefaultFolder.png") if(displayObject.isPlayable): if(displayObject.isPlayable == "PlayList"): link = displayObject.link[0] url = "%s?type=%s&action=openPlayList&link=%s" % (sys.argv[0],mediathek.name(), urllib.quote_plus(link.basePath)) listItem.setProperty('IsPlayable', 'true'); xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=listItem,isFolder=False,totalItems = objectCount) elif(displayObject.isPlayable == "JsonLink"): link = displayObject.link url = "%s?type=%s&action=openJsonLink&link=%s" % (sys.argv[0],mediathek.name(), urllib.quote_plus(link)) listItem.setProperty('IsPlayable', 'true'); listItem.setInfo("video", { "title": title, "plot": transformHtmlCodes(displayObject.description), "duration": displayObject.duration }) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=listItem,isFolder=False,totalItems = objectCount) else: self.log(displayObject.title); link = self.extractLink(displayObject.link); if(type(link).__name__ == "ComplexLink"): self.log("PlayPath:"+ link.playPath); listItem.setProperty("PlayPath", link.playPath); self.log("URL:"+ link.basePath); try: listItem.setInfo("video",{ "size": link.size, "date": time.strftime("%d.%m.%Y",displayObject.date), "year": int(time.strftime("%Y",displayObject.date)), "title": title, "plot": transformHtmlCodes(displayObject.description), "duration": displayObject.duration }); except: pass; listItem.setProperty('IsPlayable', 'true'); xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=link.basePath,listitem=listItem,isFolder=False,totalItems = objectCount) else: url = "%s?type=%s&action=openTopicPage&link=%s" % (sys.argv[0],mediathek.name(), urllib.quote_plus(displayObject.link)) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=listItem,isFolder=True,totalItems = objectCount)
def loadFromNode(self, rootNode, gui): self.gui = gui self.elements = [] self.title = transformHtmlCodes(rootNode.getAttribute('text')) self.picture = rootNode.getAttribute("image") for node in rootNode.childNodes: if node.hasChildNodes() and node.firstChild.tagName == "outline": element = OpmlFolder() element.loadFromNode(node, self.gui) else: element = FeedFactory.getFeedFromNode(node, self.gui) self.elements.append(element)
def loadFromNode(self, rootNode, gui): self.gui = gui; self.elements = []; self.title = transformHtmlCodes(rootNode.getAttribute('text')); self.picture = rootNode.getAttribute("image"); for node in rootNode.childNodes: if node.hasChildNodes() and node.firstChild.tagName == "outline": element = OpmlFolder(); element.loadFromNode(node, self.gui); else: element = FeedFactory.getFeedFromNode(node, self.gui) self.elements.append(element);
def loadFromNode(self, rootNode, gui): self.gui = gui; self.elements = []; self.title = transformHtmlCodes(rootNode.getAttribute('text')); try: self.picture = rootNode.getAttribute("image"); except: self.picture = ""; for node in rootNode.childNodes: try: if node.hasChildNodes() and node.firstChild.tagName == "outline": element = OpmlFolder(); element.loadFromNode(node, self.gui); else: element = FeedFactory.getFeedFromNode(node, self.gui) self.elements.append(element); except: self.gui.log("Something goes wrong while processing the node %s"%rootNode.getAttribute('text'));
def loadFromNode(self, rootNode, gui): self.gui = gui self.elements = [] self.title = transformHtmlCodes(rootNode.getAttribute('text')) try: self.picture = rootNode.getAttribute("image") except: self.picture = "" for node in rootNode.childNodes: try: if node.hasChildNodes( ) and node.firstChild.tagName == "outline": element = OpmlFolder() element.loadFromNode(node, self.gui) else: element = FeedFactory.getFeedFromNode(node, self.gui) self.elements.append(element) except: self.gui.log( "Something goes wrong while processing the node %s" % rootNode.getAttribute('text'))
def buildVideoLink(self, displayObject, mediathek, objectCount): if(displayObject.subTitle == "" or displayObject.subTitle == displayObject.title): title = transformHtmlCodes(displayObject.title); else: title = transformHtmlCodes(displayObject.title +" - "+ displayObject.subTitle); if displayObject.date is not None: title = "(%s) %s"%(time.strftime("%d.%m",displayObject.date),title); if displayObject.picture is not None: listItem=xbmcgui.ListItem(title, iconImage="DefaultFolder.png", thumbnailImage=displayObject.picture) else: listItem=xbmcgui.ListItem(title, iconImage="DefaultFolder.png") if(displayObject.isPlayable): if(displayObject.isPlayable == "PlayList"): link = displayObject.link[0] url = "%s?type=%s&action=openPlayList&link=%s" % (sys.argv[0],mediathek.name(), urllib.quote_plus(link.basePath)) self.log(url); xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=listItem,isFolder=True,totalItems = objectCount) else: self.log(displayObject.title); if(self.quality in displayObject.link): link = displayObject.link[self.quality]; else: selectedKey = -1; for key in displayObject.link.keys(): if(key < self.quality and key > selectedKey): selectedKey = key; if(selectedKey > -1): link = displayObject.link[selectedKey]; else: selectedKey = displayObject.link.keys()[0]; for key in displayObject.link.keys(): if(key < selectedKey): selectedKey = key; link = displayObject.link[selectedKey]; if(type(link).__name__ == "ComplexLink"): self.log("PlayPath:"+ link.playPath); listItem.setProperty("PlayPath", link.playPath); self.log("URL:"+ link.basePath); try: listItem.setInfo("video",{ "size": link.size, "date": time.strftime("%d.%m.%Y",displayObject.date), "year": int(time.strftime("%Y",displayObject.date)), "title": title, "plot": transformHtmlCodes(displayObject.description), "duration": displayObject.duration }); except: pass; listItem.setProperty('IsPlayable', 'true'); xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=link.basePath,listitem=listItem,isFolder=False,totalItems = objectCount) else: url = "%s?type=%s&action=openTopicPage&link=%s" % (sys.argv[0],mediathek.name(), urllib.quote_plus(displayObject.link)) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=listItem,isFolder=True,totalItems = objectCount)