def start(params): try: href= urllib.unquote_plus(params['href']) except: href='/?view=detailed' cxz_data = cxz(AutErrorMessage=True) cxz_data.parse(href) if cxz_data.login : AddFolder('Избранное', 'Favourites') AddFolder('Поиск', 'SearchDlg') for section in cxz_data.category: AddFolder(section['title'], 'Cat', {'href':section['href']}) AddItem('_'*30+chr(10)+' ') if cxz_data.previous_link: AddFolder(clGreen%('< Страница '+str(cxz_data.pg)), '',{'href':cxz_data.previous_link}, property={'refresh':'1'}) GetInfoList = CreateCatItems(cxz_data, True) if cxz_data.next_link: AddFolder(clGreen%('Страница '+str(cxz_data.pg+2)+' >'), '',{'href':cxz_data.next_link}, property={'refresh':'1'}) upd = xbmc.getInfoLabel('ListItem.Property(refresh)')=='1' xbmcplugin.endOfDirectory(plugin_handle, updateListing=upd, cacheToDisc=False) if GetInfoList: GetMeta(GetInfoList)
def start(params): try: href = urllib.unquote_plus(params['href']) except: href = '/?view=detailed' cxz_data = cxz(AutErrorMessage=True) cxz_data.parse(href) if cxz_data.login: AddFolder('Избранное', 'Favourites') AddFolder('Поиск', 'SearchDlg') for section in cxz_data.category: AddFolder(section['title'], 'Cat', {'href': section['href']}) AddItem('_' * 30 + chr(10) + ' ') if cxz_data.previous_link: AddFolder(clGreen % ('< Страница ' + str(cxz_data.pg)), '', {'href': cxz_data.previous_link}, property={'refresh': '1'}) GetInfoList = CreateCatItems(cxz_data, True) if cxz_data.next_link: AddFolder(clGreen % ('Страница ' + str(cxz_data.pg + 2) + ' >'), '', {'href': cxz_data.next_link}, property={'refresh': '1'}) upd = xbmc.getInfoLabel('ListItem.Property(refresh)') == '1' xbmcplugin.endOfDirectory(plugin_handle, updateListing=upd, cacheToDisc=False) if GetInfoList: GetMeta(GetInfoList)
def Cat(params): cat_href = urllib.unquote_plus(params['href']) cxz_data = cxz() cxz_data.parse(cat_href) CacheToFile('cache').write(cxz_data.filterjs) flTitle = 'Фильтр : ' + cxz_data.group_selected.encode('UTF-8') AddItem('Сортировка : ' + cxz_data.sort_selected.encode('UTF-8'), 'SetSort', {'cathref': cat_href}, property={'refresh': '1'}) AddItem(flTitle, 'SetFilter', {'cathref': cat_href}, property={'refresh': '1'}) AddItem('_' * 30 + chr(10) + ' ') if cxz_data.previous_link: AddFolder(clGreen % ('< Страница ' + str(cxz_data.pg)), 'Cat', {'href': cxz_data.previous_link}, property={'refresh': '1'}) GetInfoList = CreateCatItems(cxz_data, False) if cxz_data.next_link: AddFolder(clGreen % ('Страница ' + str(cxz_data.pg + 2) + ' >'), 'Cat', {'href': cxz_data.next_link}, property={'refresh': '1'}) upd = xbmc.getInfoLabel('ListItem.Property(refresh)') == '1' xbmcplugin.endOfDirectory(plugin_handle, updateListing=upd, cacheToDisc=False) if GetInfoList: GetMeta(GetInfoList)
def _cxz(self, href): cxz_data = cxz() cxz_data.contententPage(href) res = self._search(str(cxz_data.contententPageInfo['title_origin']), str(cxz_data.contententPageInfo['year'])) cxz_data.contententPage(href) cxzInfo = cxz_data.contententPageInfo cxzInfo['kpid'] = res #TODO Время хранения информации для cxz return True, cxzInfo
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 Favourites_cat(params): cxz_data = cxz() items = cxz_data.favourites_category(params['page']) GetInfoList=[] for item in items: url ={'section':item['section'], 'subsection':item['subsection'], 'page':params['page'], 'curpage':'0'} if addon.getSetting('categorize') =='true': AddFolder(item['title'].encode('UTF-8'), 'Favourites_cont', url) else: rez = Favourites_cont(url) if rez: for i in rez: GetInfoList.append(i) xbmcplugin.endOfDirectory(plugin_handle) if GetInfoList: GetMeta(GetInfoList)
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 Content(params): ctitle=urllib.unquote(params['title']) href=urllib.unquote(params['href']) try: folder=params['rel'] except: folder='0' cxz_ = cxz() cxz_fm = cxz_.fileManager(href,folder) if folder == '0': try: xbmcaddon.Addon(id = 'plugin.video.torrenter') except: pass else: item = xbmcgui.ListItem('Передать в torrenter',) uri = '%s?%s' % ('plugin://plugin.video.torrenter/', urllib.urlencode({'action':'search','url':ctitle})) xbmcplugin.addDirectoryItem(int(sys.argv[1]), uri, item, isFolder=True) if (addon.getSetting('alt_if_block')=='true') or cxz_.isBlocked: try: AddFolder((clRed%'Некоторые файлы заблокированы ' if cxz_.isBlocked else '')+ 'Альтернативы', 'External_Search', {'plugin':'all', 'command':'Search','search':ctitle.split('/')[0]}) except: AddFolder((clRed%'Некоторые файлы заблокированы ' if cxz_.isBlocked else '')+ 'Альтернативы', 'External_Search', {'plugin':'all', 'command':'Search','search':ctitle.split('/')[0].encode('UTF-8')}) AddItem('_'*30+chr(10)+' ','') for item in cxz_fm: title = '[B]'+(item['lang'] if 'lang' in item else '')+item['title']+'[/B]' if 'filelist' in item['next']: AddFolder(title, 'Content_files', {'rel':item['parent'], 'href':href, 'title':ctitle, 'quality_list':item['quality_list']}) else: AddFolder(title, 'Content', {'rel':item['parent'], 'href':href, 'title':ctitle}) xbmcplugin.endOfDirectory(plugin_handle, cacheToDisc=False) addon.setSetting('quality', '0') addon.setSetting('VSFull', 'true' if addon.getSetting('VideoSourceB')=='false' else 'false')
def Cat(params): cat_href = urllib.unquote_plus(params['href']) cxz_data = cxz() cxz_data.parse(cat_href) CacheToFile('cache').write(cxz_data.filterjs) flTitle = 'Фильтр : ' +cxz_data.group_selected.encode('UTF-8') AddItem('Сортировка : '+cxz_data.sort_selected.encode('UTF-8'), 'SetSort', {'cathref':cat_href}, property={'refresh':'1'}) AddItem(flTitle,'SetFilter', {'cathref':cat_href}, property={'refresh':'1'}) AddItem('_'*30+chr(10)+' ') if cxz_data.previous_link: AddFolder(clGreen%('< Страница '+str(cxz_data.pg)), 'Cat',{'href':cxz_data.previous_link}, property={'refresh':'1'}) GetInfoList = CreateCatItems(cxz_data, False) if cxz_data.next_link: AddFolder(clGreen%('Страница '+str(cxz_data.pg+2)+' >'), 'Cat',{'href':cxz_data.next_link}, property={'refresh':'1'}) upd = xbmc.getInfoLabel('ListItem.Property(refresh)')=='1' xbmcplugin.endOfDirectory(plugin_handle, updateListing=upd, cacheToDisc=False) if GetInfoList: GetMeta(GetInfoList)
def AddToFavorite(params): href = urllib.unquote(params['href']) cxz_data = cxz() mess = cxz_data.add_to_favorite(href, params['mode2'], params['mode3']) xbmcMessage(mess.encode('UTF-8'), 7000)
def Content_files(params): ctitle = urllib.unquote(params['title']) href = urllib.unquote(params['href']) folder = params['rel'] quality_list = urllib.unquote(params['quality_list']) quality_list = quality_list.split(',') cur_quality = int(addon.getSetting('quality')) VSFull = (addon.getSetting('VSFull') == 'true') short_link = (addon.getSetting('short_link') == 'true') cxz_fm = cxz().fileManager(href, folder) if quality_list[0] != 'None': qSelectTitle = '' for i in range(0, len(quality_list)): if i == cur_quality: ii = clGreen % quality_list[i] else: ii = quality_list[i] qSelectTitle += ii + ' ' AddItem('Качество: ' + qSelectTitle, 'Content_files_refresh', {'max': len(quality_list)}) if VSFull: vsTitle = clGreen % 'Полный ' + 'Оптимизированный' else: vsTitle = 'Полный ' + clGreen % 'Оптимизированный' AddItem('Источник: ' + vsTitle, 'Content_files_refresh', {}) for item in cxz_fm: if 'qual' in item: qual = item['qual'] else: qual = quality_list[0] if (quality_list[0] != 'None') and (qual != quality_list[cur_quality]) and ( qual != quality_list[cur_quality] + 'p'): continue cmenu = { 'mode': 'download', 'href': item['href_dl'], 'title': item['title'] } ContextMenu = [(clAliceblue % ('cxz.to Скачать файл'), 'XBMC.RunPlugin(%s)' % uriencode(cmenu))] info = {'type': 'Video', 'title': ctitle} if '/serials/' in href or '/tvshow/' in href or '/cartoonserials/' in href: results = filename2match(item['title']) if results: info['tvshowtitle'] = ctitle info['title'] = ctitle info['season'] = results['season'] info['episode'] = results['episode'] #prop = {} #if VSFull or item['only_download']: sh_href_dl = item['href_dl'] if short_link: dl = re.compile('(\.\d+\.\d+\.\d+\.\d+)').findall(sh_href_dl) if dl: sh_href_dl = sh_href_dl.replace(dl[0], '') print sh_href_dl prop = {'IsPlayable': 'true'} AddItem( ('[only Full] ' if item['only_download'] and not VSFull else '') + item['title'] + ' ' + item['size'], 'Play', { 'href': item['href'], 'href_dl': sh_href_dl, 'only_download': str(item['only_download']) }, info=info, property=prop, cmItems=ContextMenu) xbmcplugin.endOfDirectory(plugin_handle)
def AddToFavorite(params): href = urllib.unquote(params['href']) cxz_data = cxz() mess = cxz_data.add_to_favorite(href, params['mode2'], params['mode3'] ) xbmcMessage(mess.encode('UTF-8'), 7000)
def Content_files(params): ctitle=urllib.unquote(params['title']) href=urllib.unquote(params['href']) folder=params['rel'] quality_list=urllib.unquote(params['quality_list']) quality_list = quality_list.split(',') cur_quality = int(addon.getSetting('quality')) VSFull = (addon.getSetting('VSFull')=='true') short_link = (addon.getSetting('short_link')=='true') cxz_fm = cxz().fileManager(href,folder) if quality_list[0]!='None': qSelectTitle = '' for i in range(0,len(quality_list)): if i == cur_quality: ii = clGreen%quality_list[i] else: ii = quality_list[i] qSelectTitle += ii+' ' AddItem('Качество: '+qSelectTitle, 'Content_files_refresh', {'max':len(quality_list)}) if VSFull: vsTitle = clGreen%'Полный '+'Оптимизированный' else: vsTitle = 'Полный '+clGreen%'Оптимизированный' AddItem('Источник: '+vsTitle, 'Content_files_refresh', {}) for item in cxz_fm: if 'qual' in item: qual = item['qual'] else: qual = quality_list[0] if (quality_list[0]!='None')and(qual != quality_list[cur_quality])and(qual != quality_list[cur_quality]+'p'): continue cmenu ={'mode' :'download', 'href':item['href_dl'], 'title':item['title']} ContextMenu = [(clAliceblue%('cxz.to Скачать файл'), 'XBMC.RunPlugin(%s)'%uriencode(cmenu))] info={'type':'Video','title':ctitle} if '/serials/' in href or '/tvshow/' in href or '/cartoonserials/' in href: results=filename2match(item['title']) if results: info['tvshowtitle']=ctitle info['title']=ctitle info['season']=results['season'] info['episode']=results['episode'] #prop = {} #if VSFull or item['only_download']: sh_href_dl = item['href_dl'] if short_link: dl = re.compile('(\.\d+\.\d+\.\d+\.\d+)').findall(sh_href_dl) if dl: sh_href_dl = sh_href_dl.replace(dl[0], '') print sh_href_dl prop={'IsPlayable':'true'} AddItem(('[only Full] ' if item['only_download'] and not VSFull else '')+item['title']+' '+item['size'],'Play',{'href':item['href'], 'href_dl':sh_href_dl, 'only_download':str(item['only_download'])}, info=info, property=prop, cmItems=ContextMenu) xbmcplugin.endOfDirectory(plugin_handle)