def __init__(self, url, cached=True): if cached: xml = run_hook("get_xml", url) else: xml = run_hook("get_xml_uncached", url) if not xml: if url.endswith(".xml") or url.startswith("http"): try: xml = requests.get(url).content except Exception as e: xml = None koding.dolog("error: " + repr(e)) koding.dolog("url: " + repr(url)) koding.dolog("#####################") else: xml = url if xml: self.xml = xml self.content = "" self.list = JenList.list_pattern.findall(xml) info = JenItem(xml.split('<item>')[0].split('<dir>')[0]) intro = info.get("intro", "") if intro: import resources.lib.sources as sources sources.get_sources(intro) self.playlister = info.get('poster', '0') self.list_image = replace_url(info.get("animated_thumbnail", "")) if not self.list_image: self.list_image = replace_url( info.get('thumbnail', ADDON.getAddonInfo('icon'))) self.list_fanart = replace_url(info.get("animated_fanart", "")) if not self.list_fanart: self.list_fanart = replace_url(info.get('fanart', "0")) if self.list_fanart == "0": theme = xbmcaddon.Addon().getSetting('theme') if theme and theme != 'DEFAULT' and theme != 'none': self.list_fanart = self.set_theme(theme) else: self.list_fanart = xbmcaddon.Addon().getAddonInfo('fanart') self.metadata = {} else: self.list = []
# -*- coding: utf-8 -*-