def filmoteka(p): if p["filmoteka"] == "": data = login() if data: userid = get_userid(data) if userid: page = util.request(furl(userid + "filmoteka")) data = util.substr(page, '<select name="filter', "</select>") for m in re.finditer( '<option value="(?P<value>[^"]+)[^>]+>(?P<name>[^<]+)', data, re.DOTALL | re.IGNORECASE ): p["filmoteka"] = userid + "filmoteka/filtr-" + m.group("value") xbmcutil.add_dir(m.group("name"), p) xbmcplugin.endOfDirectory(int(sys.argv[1])) else: page = login(p["filmoteka"]) data = util.substr(page, '<table class="ui-table-list', "</table") results = [] for m in re.finditer( '<tr[^<]+<td>(?P<added>[^<]+)</td[^<]+<td[^<]+<a href="(?P<url>[^"]+)[^>]+>(?P<name>[^<]+)', data, re.DOTALL | re.IGNORECASE, ): results.append((m.group("url"), m.group("name"))) if preload(): return preload_items(results) add_items(results) xbmcplugin.endOfDirectory(int(sys.argv[1]))
def item(params): info = scrapper.get_info(params["item"]) xbmc_info = scrapper.xbmc_info(info) page = util.request(info["trailers_url"], headers={"Referer": BASE_URL}) data = util.substr(page, '<label for="frmfilterSelectForm-filter">', "</select>") xbmcutil.add_dir( __language__(30007), params, info["img"], infoLabels=xbmc_info, menuItems={__language__(30007): "Action(info)"} ) add_addon_search(30006, "plugin.video.online-files", info, "search") def_trailer = None for m in re.finditer('<option value="(?P<url>[^"]+)[^>]+>(?P<name>[^<]+)', data, re.DOTALL | re.IGNORECASE): url = info["url"] + "/videa/-filtr-" + m.group("url") trailer = util._create_plugin_url({"play": url}) if def_trailer == None: info["trailer"] = trailer scrapper.set_info(info) xbmc_info["Title"] = "%s - %s" % (info["title"], m.group("name")) xbmcutil.add_video( m.group("name"), {"play": url}, info["img"], infoLabels=xbmc_info, menuItems={__language__(30007): "Action(info)"}, ) xbmcplugin.endOfDirectory(int(sys.argv[1]))
def root(self): if 'search' in self.provider.capabilities(): params = self.params() params.update({'search-list':'#'}) xbmcutil.add_dir(xbmcutil.__lang__(30003),params,xbmcutil.icon('search.png')) xbmcutil.add_local_dir(xbmcutil.__lang__(30006),self.settings['downloads'],xbmcutil.icon('download.png')) self.list(self.provider.categories()) return xbmcplugin.endOfDirectory(int(sys.argv[1]))
def add_item(name, info, showing=None): xbmc_info = scrapper.xbmc_info(info) if not "0%" == info["percent"]: name += " " + info["percent"] menuItems = {__language__(30007): "Action(info)", __language__(30001): {"preload-refresh": ""}} if showing: menuItems[__language__(30025)] = {"show-cinema": showing} xbmcutil.add_dir(name, {"item": furl(info["url"])}, info["img"], infoLabels=xbmc_info, menuItems=menuItems)
def render_dir(self,item): params = self.params() params.update({'list':item['url']}) title = item['title'] img = None if 'img' in item.keys(): img = item['img'] if title.find('$') == 0: title = self.addon.getLocalizedString(int(title[1:])) xbmcutil.add_dir(title,params,img,infoLabels=self._extract_infolabels(item))
def dvd(params): if "year" in params.keys(): return dvd_list("dvd-a-bluray/rocne/?format=" + params["dvd"] + "&year=" + params["year"]) else: page = util.request(furl("dvd-a-bluray/rocne/?format=" + params["dvd"])) data = util.substr(page, 'id="frmfilter-year', "</select>") for m in re.finditer('<option value="(?P<value>[^"]+)[^>]+>(?P<name>[^<]+)', data, re.DOTALL | re.IGNORECASE): params["year"] = m.group("value") xbmcutil.add_dir(m.group("name"), params) xbmcplugin.endOfDirectory(int(sys.argv[1]))
def search_list(self): params = self.params() params.update({'search':'#'}) menuItems = self.params() xbmcutil.add_dir(xbmcutil.__lang__(30004),params,xbmcutil.icon('search.png')) for what in xbmcutil.search_list(self.cache): params['search'] = what menuItems['search-remove'] = what xbmcutil.add_dir(what,params,menuItems={xbmc.getLocalizedString(117):menuItems}) xbmcplugin.endOfDirectory(int(sys.argv[1]))
def search_list(self): params = self.params() params.update({'search':''}) menuItems = self.params() xbmcutil.add_search_item(xbmcutil.__lang__(30004), params, xbmcutil.icon('search.png')) for what in xbmcutil.get_searches(self.addon, self.provider.name): params = self.params() menuItems = self.params() params['search'] = what menuItems['search-remove'] = what xbmcutil.add_dir(what, params, menuItems={u'Remove':menuItems})
def _list(addon,history,key,value): params = {} menuItems = {} if key: params[key] = value menuItems[key] = value params['search'] = '#' xbmcutil.add_dir(xbmcutil.__lang__(30004),params,xbmcutil.icon('search.png')) for what in xbmcutil.get_searches(addon,history): params['search'] = what menuItems['search-remove'] = what xbmcutil.add_dir(what,params,menuItems={xbmc.getLocalizedString(117):menuItems}) xbmcplugin.endOfDirectory(int(sys.argv[1]))
def render_dir(self, item): params = self.params() params.update({'list':item['url']}) title = item['title'] img = None if 'img' in item.keys(): img = item['img'] title = self._localize(title) menuItems = {} if 'menu' in item.keys(): for ctxtitle, value in item['menu'].iteritems(): ctxtitle = self._localize(ctxtitle) menuItems[ctxtitle] = value xbmcutil.add_dir(title, params, img, infoLabels=self._extract_infolabels(item), menuItems=menuItems)
def artists(params): if not "type" in params.keys(): page = util.request(furl("tvurci/statistiky")) for m in re.finditer( '<div id="(?P<type>[^"]+)[^<]+<h2 class="header">(?P<name>[^<]+)', page, re.DOTALL | re.IGNORECASE ): xbmcutil.add_dir(m.group("name"), {"artists": "", "type": m.group("type")}, icon()) return xbmcplugin.endOfDirectory(int(sys.argv[1])) typ = params["type"] page = util.request(furl("tvurci/statistiky/?expand=" + typ)) data = util.substr(page, '<div id="' + typ + '"', '<div class="footer') results = [] if not "subtype" in params.keys(): for m in re.finditer('<h3 class="label">(?P<name>[^<]+)', data, re.DOTALL | re.IGNORECASE): results.append(m.group("name")) if len(results) > 0: index = 0 for name in results: params["subtype"] = str(index) index += 1 xbmcutil.add_dir(name, params, icon()) return xbmcplugin.endOfDirectory(int(sys.argv[1])) else: for m in re.finditer( '<li[^<]+<a href="(?P<url>[^"]+)[^>]+>(?P<name>[^<]+)</a>(?P<data>[^<]+)', data, re.DOTALL | re.IGNORECASE, ): results.append((m.group("name") + m.group("data"), m.group("url"))) else: subtype = int(params["subtype"]) index = 0 for m in re.finditer('<h3 class="label">(?P<name>[^<]+)', data, re.DOTALL | re.IGNORECASE): if index == subtype: subtype = m.group("name") break index += 1 data = util.substr(data, subtype, "</div>") for m in re.finditer( '<li[^<]+<a href="(?P<url>[^"]+)[^>]+>(?P<name>[^<]+)</a>(?P<data>[^<]+)', data, re.DOTALL | re.IGNORECASE ): results.append((m.group("name") + m.group("data"), m.group("url"))) for index, (name, url) in enumerate(results): info = scrapper._empty_info() info["url"] = url add_person("%i. %s" % (index + 1, name), info) return xbmcplugin.endOfDirectory(int(sys.argv[1]))
def _list(addon,history,key,value): params = {} menuItems = {} if key: params[key] = value menuItems[key] = value params['search'] = '' xbmcutil.add_search_item(xbmcutil.__lang__(30004),params,xbmcutil.icon('search.png')) for what in xbmcutil.get_searches(addon,history): params = {} menuItems={} if key: params[key] = value menuItems[key] = value params['search'] = what menuItems['search-remove'] = what xbmcutil.add_dir(what,params,menuItems={u"Remove":menuItems})
def search_list(self): params = self.params() params.update({'search':''}) xbmcutil.add_search_item(xbmcutil.__lang__(30004), params, xbmcutil.icon('search.png')) maximum = 10 try: maximum = int(self.settings['keep-searches']) except: pass for what in xbmcutil.get_searches(self.addon, self.provider.name, maximum): params = self.params() menuItems = self.params() menuItems2 = self.params() params['search'] = what menuItems['search-remove'] = what menuItems2['search-edit'] = what xbmcutil.add_dir(what, params, menuItems={u'Remove':menuItems,u'Edit':menuItems2})
def kino(params): if "kino-year" in params.keys() and "kino-country" in params.keys(): return kino_list("kino/prehled/?country=%s&year=%s" % (params["kino-country"], params["kino-year"])) if "kino-country" in params.keys(): data = util.request(furl("kino/prehled")) data = util.substr(data, 'id="frmfilter-year', "</select>") for m in re.finditer('<option value="(?P<value>[^"]+)[^>]+>(?P<name>[^<]+)', data, re.DOTALL | re.IGNORECASE): params["kino-year"] = m.group("value") xbmcutil.add_dir(m.group("name"), params) xbmcplugin.endOfDirectory(int(sys.argv[1])) else: data = util.request(furl("kino/prehled")) data = util.substr(data, 'id="frmfilter-country', "</select>") for m in re.finditer('<option value="(?P<value>[^"]+)[^>]+>(?P<name>[^<]+)', data, re.DOTALL | re.IGNORECASE): params["kino-country"] = m.group("value") xbmcutil.add_dir(m.group("name"), params) xbmcplugin.endOfDirectory(int(sys.argv[1]))
def root(self): searches = xbmcutil.get_searches(self.addon,self.provider.name) if len(searches) > 0: self.provider.info('Upgrading to new saved search storage...') for s in searches: self.provider.info('Moving item %s' % s) xbmcutil.search_add(self.cache,s,9999999) xbmcutil.delete_search_history(self.addon,self.provider.name) if 'search' in self.provider.capabilities(): params = self.params() params.update({'search-list':'#'}) xbmcutil.add_dir(xbmcutil.__lang__(30003),params,xbmcutil.icon('search.png')) if not '!download' in self.provider.capabilities(): xbmcutil.add_local_dir(xbmcutil.__lang__(30006),self.settings['downloads'],xbmcutil.icon('download.png')) self.list(self.provider.categories()) return xbmcplugin.endOfDirectory(int(sys.argv[1]))
def render_dir(self, item): params = self.params() params.update({'list': item['url']}) title = item['title'] img = None if 'img' in item.keys(): img = item['img'] title = self._localize(title) menuItems = {} if 'menu' in item.keys(): for ctxtitle, value in item['menu'].iteritems(): ctxtitle = self._localize(ctxtitle) menuItems[ctxtitle] = value xbmcutil.add_dir(title, params, img, infoLabels=self._extract_infolabels(item), menuItems=menuItems)
def _list(addon, history, key, value): params = {} menuItems = {} if key: params[key] = value menuItems[key] = value params['search'] = '' xbmcutil.add_search_item(xbmcutil.__lang__(30004), params, xbmcutil.icon('search.png')) for what in xbmcutil.get_searches(addon, history): params = {} menuItems = {} if key: params[key] = value menuItems[key] = value params['search'] = what menuItems['search-remove'] = what xbmcutil.add_dir(what, params, menuItems={u"Remove": menuItems})
def search_list(self): params = self.params() params.update({'search': ''}) xbmcutil.add_search_item(xbmcutil.__lang__(30004), params, xbmcutil.icon('search.png')) for what in xbmcutil.get_searches(self.addon, self.provider.name): params = self.params() menuItems = self.params() menuItems2 = self.params() params['search'] = what menuItems['search-remove'] = what menuItems2['search-edit'] = what xbmcutil.add_dir(what, params, menuItems={ u'Remove': menuItems, u'Edit': menuItems2 })
def root(self): searches = xbmcutil.get_searches(self.addon, self.provider.name) if len(searches) > 0: self.provider.info('Upgrading to new saved search storage...') for s in searches: self.provider.info('Moving item %s' % s) xbmcutil.search_add(self.cache, s, 9999999) xbmcutil.delete_search_history(self.addon, self.provider.name) if 'search' in self.provider.capabilities(): params = self.params() params.update({'search-list': '#'}) xbmcutil.add_dir(xbmcutil.__lang__(30003), params, xbmcutil.icon('search.png')) if not '!download' in self.provider.capabilities(): xbmcutil.add_local_dir(xbmcutil.__lang__(30006), self.settings['downloads'], xbmcutil.icon('download.png')) self.list(self.provider.categories()) return xbmcplugin.endOfDirectory(int(sys.argv[1]))
def render_dir(self,item): params = self.params() params.update({'list':item['url']}) title = item['title'] img = None if 'img' in item.keys(): img = item['img'] if title.find('$') == 0: try: title = self.addon.getLocalizedString(int(title[1:])) except: pass menuItems = {} if 'menu' in item.keys(): for ctxtitle, value in item['menu'].iteritems(): if ctxtitle.find('$') == 0: try: ctxtitle = self.addon.getLocalizedString(int(ctxtitle[1:])) except: pass menuItems[ctxtitle] = value xbmcutil.add_dir(title,params,img,infoLabels=self._extract_infolabels(item),menuItems=menuItems)
def render_dir(self, item): params = self.params() params.update({'list': item['url']}) title = item['title'] img = None if 'img' in item.keys(): img = item['img'] if title.find('$') == 0: try: title = self.addon.getLocalizedString(int(title[1:])) except: pass menuItems = {} if 'menu' in item.keys(): for ctxtitle, value in item['menu'].iteritems(): if ctxtitle.find('$') == 0: try: ctxtitle = self.addon.getLocalizedString(int(ctxtitle[1:])) except: pass menuItems[ctxtitle] = value xbmcutil.add_dir(title, params, img, infoLabels=self._extract_infolabels( item), menuItems=menuItems)
def top(params): if "top-select" in params.keys(): url = furl(params["top-select"] + "?show=complete") page = util.request(url) data = util.substr(page, '<table class="content', "</table>") results = [] for m in re.finditer("<tr>(?P<data>.+?)</tr>", data, re.DOTALL | re.IGNORECASE): item = m.group("data") base = re.search( '<td class="order">(?P<order>[^<]+).+?<a href="(?P<url>[^"]+)[^>]+>(?P<name>[^<]+)</a>', item, re.DOTALL | re.IGNORECASE, ) if base: name = "%s %s" % (base.group("order"), base.group("name")) for n in re.finditer("<span[^>]*>(?P<data>[^<]+)", item): name = "%s %s" % (name, n.group("data")) results.append((base.group("url"), name)) if preload(): preload_items(results) else: add_items(results) xbmcplugin.endOfDirectory(int(sys.argv[1])) else: page = util.request(furl("zebricky/")) data = util.substr(page, '<div class="navigation', "</div>") xbmcutil.add_dir( "Nejlepší filmy", {"top": "", "top-select": "zebricky/nejlepsi-filmy/"}, icon(), menuItems={__language__(30001): {"preload": "", "top": "", "top-select": "zebricky/nejlepsi-filmy/"}}, ) for m in re.finditer('<a href="(?P<url>[^"]+)[^>]+>(?P<name>[^<]+)', data, re.DOTALL | re.IGNORECASE): xbmcutil.add_dir(m.group("name"), {"top": "", "top-select": m.group("url")}, icon()) xbmcplugin.endOfDirectory(int(sys.argv[1]))
def search_list(self): params = self.params() params.update({'search': ''}) xbmcutil.add_search_item(xbmcutil.__lang__(30004), params, xbmcutil.icon('search.png')) maximum = 10 try: maximum = int(self.settings['keep-searches']) except: pass for what in xbmcutil.get_searches(self.addon, self.provider.name, maximum): params = self.params() menuItems = self.params() menuItems2 = self.params() params['search'] = what menuItems['search-remove'] = what menuItems2['search-edit'] = what xbmcutil.add_dir(what, params, menuItems={ u'Remove': menuItems, u'Edit': menuItems2 })
def list(self, items): params = self.params() for item in items: if item['type'] == 'dir': self.render_dir(item) elif item['type'] == 'next': params.update({'list': item['url']}) xbmcutil.add_dir(xbmcutil.__lang__(30007), params, xbmcutil.icon('next.png')) elif item['type'] == 'prev': params.update({'list': item['url']}) xbmcutil.add_dir(xbmcutil.__lang__(30008), params, xbmcutil.icon('prev.png')) elif item['type'] == 'new': params.update({'list': item['url']}) xbmcutil.add_dir(xbmcutil.__lang__(30012), params, xbmcutil.icon('new.png')) elif item['type'] == 'top': params.update({'list': item['url']}) xbmcutil.add_dir(xbmcutil.__lang__(30013), params, xbmcutil.icon('top.png')) elif item['type'] == 'video': self.render_video(item) else: self.render_default(item)
def add_addon_search(label, addon, info, action): xbmcutil.add_dir( __language__(label), {"search-plugin": "plugin://%s" % addon, "url": info["url"], "action": action}, xbmcaddon.Addon(addon).getAddonInfo("icon"), )
def root(): search.item({"s": "movie"}, label=xbmcutil.__lang__(30003) + " " + __language__(30017)) search.item({"s": "person"}, label=xbmcutil.__lang__(30003) + " " + __language__(30018)) xbmcutil.add_dir(__language__(30041), {"fav": ""}, icon()) xbmcutil.add_dir(__language__(30044), {"filmoteka": ""}, icon()) xbmcutil.add_dir("Kino", {"kino": ""}, icon()) xbmcutil.add_dir("Žebříčky", {"top": ""}, xbmcutil.icon("top.png")) xbmcutil.add_dir("Blu-ray", {"dvd": "bluray"}, icon()) xbmcutil.add_dir("Premiérová DVD", {"dvd": "dvd_retail"}, icon()) xbmcutil.add_dir("Levná DVD v trafikách a časopisech", {"dvd": "dvd_lite"}, icon()) xbmcutil.add_dir("Tvůrci", {"artists": ""}, icon()) xbmcplugin.endOfDirectory(int(sys.argv[1]))
def favourites(p): if p["fav"] == "": data = login() if data: userid = get_userid(data) if userid: xbmcutil.add_dir("Oblíbené filmy", {"fav": userid + "oblibene-filmy/"}, icon()) xbmcutil.add_dir("Oblíbené seriály", {"fav": userid + "oblibene-serialy/"}, icon()) xbmcutil.add_dir("Oblíbené pořady", {"fav": userid + "oblibene-porady/"}, icon()) xbmcutil.add_dir("Oblíbení herci", {"fav": userid + "oblibeni-herci/"}, icon()) xbmcutil.add_dir("Oblíbené herečky", {"fav": userid + "oblibene-herecky/"}, icon()) xbmcutil.add_dir("Oblíbení režiséři", {"fav": userid + "oblibeni-reziseri/"}, icon()) xbmcutil.add_dir("Oblíbení skladatelé", {"fav": userid + "oblibeni-skladatele/"}, icon()) return xbmcplugin.endOfDirectory(int(sys.argv[1])) data = login(p["fav"]) if not data: return xbmcplugin.endOfDirectory(int(sys.argv[1])) results = [] for m in re.finditer( '<h3 class="subject"><a href="(?P<url>[^"]+)[^>]+>(?P<name>[^<]+)', data, re.DOTALL | re.IGNORECASE ): results.append((m.group("url"), m.group("name"))) # we load items different way for persons if ( p["fav"].find("oblibeni-herci") > 0 or p["fav"].find("oblibene-herecky") > 0 or p["fav"].find("oblibeni-reziseri") > 0 or p["fav"].find("oblibeni-skladatele") > 0 ): for url, name in results: info = scrapper._empty_info() info["url"] = url add_person(name, info) return xbmcplugin.endOfDirectory(int(sys.argv[1])) if preload(): return preload_items(results) add_items(results) xbmcplugin.endOfDirectory(int(sys.argv[1]))
def add_person(name, info): xbmc_info = scrapper.xbmc_info(info) xbmcutil.add_dir(name, {"person": furl(info["url"])}, "DefaultArtist.png", infoLabels=xbmc_info)
def render_default(self, item): params = self.params() if item['type'] == 'top': params.update({'list': item['url']}) xbmcutil.add_dir(item['title'], params, xbmcutil.icon('top.png'))
def item(items={}, label=xbmcutil.__lang__(30003)): items['search-list'] = '#' xbmcutil.add_dir(label, items, xbmcutil.icon('search.png'))
def root(): search.item() for provider in providers.keys(): xbmcutil.add_dir(provider, {'cp': provider}, icon(provider)) return
def render_default(self, item): params = self.params() if item['type'] == 'top': params.update({'list':item['url']}) xbmcutil.add_dir(item['title'], params, xbmcutil.icon('top.png'))
def root(): search.item() xbmcutil.add_local_dir(xbmcutil.__lang__(30006),settings['downloads'],xbmcutil.icon('download.png')) for provider in providers.keys(): xbmcutil.add_dir(provider,{'cp':provider},icon(provider)) return xbmcplugin.endOfDirectory(int(sys.argv[1]))
def root(): search.item() for provider in providers.keys(): xbmcutil.add_dir(provider, {'cp':provider}, icon(provider)) return
def item(items={},label=xbmcutil.__lang__(30003)): items['search-list'] = '#' xbmcutil.add_dir(label,items,xbmcutil.icon('search.png'))