def scrapper(self): kp = kinopoisk() self.progress = Progress('Загрузка MetaData...') while self.Scrapper_stack.len(): d = self.Scrapper_stack.pop() if isinstance(d, dict) and ('cxzto refresh container' in d.keys()): if (d['cxzto refresh container'] == xbmc.getInfoLabel( 'Container.FolderPath')): xbmc.executebuiltin('Container.Refresh') break self.progress.update(self.start_count, self.start_count - self.Scrapper_stack.len(), d['title']) #try: kp.GetInfo(d['href']) #except: # pass if xbmc.abortRequested: self.progress.clouse() return xbmc.sleep(50) self.progress.clouse()
def Favourites_cont(params): section = params['section'] subsection = params['subsection'] curpage= params['curpage'] page = params['page'] categorize = addon.getSetting('categorize') cxz_data = cxz() data = cxz_data.favourites_content(section, subsection, page, curpage) if (int(curpage)>0): url ={'section':section, 'subsection':subsection, 'page':page, 'curpage':str(int(curpage)-1)} AddFolder(clGreen%('< Страница '+str(int(curpage))), 'Favourites_cont', url, property={'refresh':'1'}) ItemNotInfo = [] for item in data['items']: kino_poisk = kinopoisk() kpInfo = kino_poisk.GetLocalInfo(str(item['href'])) if kpInfo and 'kinopoisk' in kpInfo: kpInfo = kpInfo['kinopoisk'] else: ItemNotInfo.append({'href':str(item['href']), 'title':str(item['title'].encode('UTF-8'))}) ContextMenu=[] if page!='recommended': cmenu={'mode' :'AddToFavorite', 'mode2' :page, 'mode3' :'del', 'href' :item['href']} ContextMenu = [(clAliceblue%('cxz.to Удалить Из Категории'), 'XBMC.RunPlugin(%s)'%uriencode(cmenu))] if not kpInfo: info ={'type':'video','year':item['year'],'title':item['title']} #info ={'type':'video','plot':cxz['plot'],'title':cxz['title'],'year':cxz['year']} else: info ={'type':'video','plot':kpInfo['plot'],'title':item['title'],'year':item['year'], 'studio':item['country'], 'writer':kpInfo['writer'],'genre':kpInfo['genre'], 'originaltitle':kpInfo['originaltitle']} if kpInfo['cast']: info['cast'] = kpInfo['cast'] AddFolder(item['title'].encode('UTF-8'), 'Content',{'href':item['href'], 'title':item['title'].encode('UTF-8')}, img=item['imgup'], ico=item['img'],info=info, cmItems=ContextMenu) if data['islast']=='false': url ={'section':section, 'subsection':subsection, 'page':page, 'curpage':str(int(curpage)+1)} AddFolder(clGreen%('Страница '+str(int(curpage)+2)+' >'), 'Favourites_cont', url, property={'refresh':'1'}) upd = xbmc.getInfoLabel('ListItem.Property(refresh)')=='1' if categorize == 'true': xbmcplugin.endOfDirectory(plugin_handle, updateListing=upd) if ItemNotInfo: xbmc.executeJSONRPC('{ "jsonrpc": "2.0", "method": "JSONRPC.NotifyAll", "params": {"sender": "%s", "message": "scrapper", "data":%s}, "id": 1 }'%(addon_name, json.dumps(ItemNotInfo))) else: return ItemNotInfo
def Search(params): search = urllib.unquote(params['search']) cxz_data = cxz() result = cxz_data.search('/search.aspx?search='+search+'&page='+params['page']) if result == None: dialog = xbmcgui.Dialog() if dialog.yesno('Поиск:', 'На cxz.to ничего не найдено. Искать на других сайтах?'): External_Search({'plugin':'all', 'command':'Search','search':search}) return ItemNotInfo = [] for item in result: kino_poisk = kinopoisk() kpInfo = kino_poisk.GetLocalInfo(str(item['href'])) if kpInfo and 'kinopoisk' in kpInfo: kpInfo = kpInfo['kinopoisk'] else: ItemNotInfo.append({'href':str(item['href']), 'title':str(item['title'].encode('UTF-8'))}) ctitle = titleConstruct(item, kpInfo, True) ContextMenu=[] if cxz_data.login: cmenu={'mode' :'AddToFavorite', 'mode2' :'favorites', 'mode3' :'add', 'href' :item['href']} cmenu1=cmenu.copy() cmenu1['mode2']='forlater' ContextMenu = [(clAliceblue%('cxz.to Добавить В Избранное'), 'XBMC.RunPlugin(%s)'%uriencode(cmenu)), (clAliceblue%('cxz.to Отложить на Будущее'), 'XBMC.RunPlugin(%s)'%uriencode(cmenu1))] if ItemNotInfo: info ={'type':'video','plot':item['plot'],'title':item['title']} #info ={'type':'video','plot':cxz['plot'],'title':cxz['title'],'year':cxz['year']} else: info ={'type':'video','plot':kpInfo['plot'],'title':item['title'],'year':item['year'], 'studio':item['country'], 'writer':kpInfo['writer'],'genre':kpInfo['genre'], 'originaltitle':kpInfo['originaltitle']} if kpInfo['cast']: info['cast'] = kpInfo['cast'] property={'fanart_image':item['imgup']} AddFolder(ctitle.encode('UTF-8'), 'Content', {'href':item['href'], 'title' :item['title'].encode('UTF-8')}, ico=item['img'], img=item['imgup'], info=info, property=property, cmItems=ContextMenu) xbmcplugin.endOfDirectory(plugin_handle) if ItemNotInfo: xbmc.executeJSONRPC('{ "jsonrpc": "2.0", "method": "JSONRPC.NotifyAll", "params": {"sender": "%s", "message": "scrapper", "data":%s}, "id": 1 }'%(addon_name, json.dumps(ItemNotInfo)))
def scrapper(self): kp = kinopoisk() self.progress = Progress("Загрузка MetaData...") while self.Scrapper_stack.len(): d = self.Scrapper_stack.pop() if isinstance(d, dict) and ("cxzto refresh container" in d.keys()): if d["cxzto refresh container"] == xbmc.getInfoLabel("Container.FolderPath"): xbmc.executebuiltin("Container.Refresh") break self.progress.update(self.start_count, self.start_count - self.Scrapper_stack.len(), d["title"]) # try: kp.GetInfo(d["href"]) # except: # pass if xbmc.abortRequested: self.progress.clouse() return xbmc.sleep(50) self.progress.clouse()
def CreateCatItems(cxz_data, mSerials=False): GetInfoList=[] for cxz in cxz_data.cxzInfo: kino_poisk = kinopoisk() kpInfo = kino_poisk.GetLocalInfo(str(cxz['href'])) if kpInfo and 'kinopoisk' in kpInfo: kpInfo = kpInfo['kinopoisk'] else: GetInfoList.append({'href':cxz['href'],'title':cxz['title']}) kpInfo = None ctitle = titleConstruct(cxz, kpInfo, mSerials) ContextMenu = [(clAliceblue%('cxz.to Информация'), 'XBMC.Action(Info)')] ContextMenu.append((clAliceblue%('cxz.to Похожие материалы'), 'XBMC.Action(Info)')) ContextMenu.append((clAliceblue%('cxz.to Персоны'), 'XBMC.Action(Info)')) if cxz_data.login: cmenu={'mode' :'AddToFavorite', 'mode2' :'favorites', 'mode3' :'add', 'href' :cxz['href']} cmenu1=cmenu.copy() cmenu1['mode2']='forlater' ContextMenu.append((clAliceblue%('cxz.to Добавить В Избранное'), 'XBMC.RunPlugin(%s)'%uriencode(cmenu))) ContextMenu.append((clAliceblue%('cxz.to Отложить на Будущее'), 'XBMC.RunPlugin(%s)'%uriencode(cmenu1))) if not kpInfo: info ={'type':'video','plot':cxz['plot'],'title':cxz['title'],'year':cxz['year'],'cast':cxz['cast'], 'studio':cxz['country']} else: info ={'type':'video','plot':kpInfo['plot'],'title':cxz['title'],'year':cxz['year'], 'studio':cxz['country'], 'writer':kpInfo['writer'],'genre':kpInfo['genre'], 'originaltitle':kpInfo['originaltitle']} if kpInfo['cast']: info['cast'] = kpInfo['cast'] property={'fanart_image':cxz['imgup']} AddFolder(ctitle.encode('UTF-8'), 'Content', {'href':cxz['href'], 'title':cxz['title'].encode('UTF-8')}, info=info, img=cxz['imgup'], ico=cxz['img'], cmItems=ContextMenu,property=property) if GetInfoList:return GetInfoList return False