def displayList(self): list = [] if ":groups:" == self.menu: groups = self.favourites.getGroups() for item in groups: dItem = CDisplayListItem(name=item['title'], type=CDisplayListItem.TYPE_CATEGORY) dItem.privateData = item['group_id'] list.append((dItem, )) else: if not self.loadGroupItems(self.menu): return sts, items = self.favourites.getGroupItems(self.menu) if not sts: self.session.open(MessageBox, self.favourites.getLastError(), type=MessageBox.TYPE_ERROR, timeout=10) return for idx in range(len(items)): item = items[idx] dItem = CDisplayListItem(name=item.name, type=item.type) dItem.privateData = idx list.append((dItem, )) self["list"].setList(list)
def convertList(self, cList): hostList = [] for cItem in cList: hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN if cItem['type'] == 'category': type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] == 'video': type = CDisplayListItem.TYPE_VIDEO url = cItem.get('url', '') if url.endswith(".jpeg") or url.endswith( ".jpg") or url.endswith(".png"): type = CDisplayListItem.TYPE_PICTURE else: type = CDisplayListItem.TYPE_VIDEO if '' != url: hostLinks.append(CUrlItem("Link", url, 1)) title = self.host._cleanHtmlStr(cItem.get('title', '')) description = self.host._cleanHtmlStr(cItem.get('desc', '')) icon = self.host._cleanHtmlStr(cItem.get('icon', '')) hostItem = CDisplayListItem(name=title, description=description, type=type, urlItems=hostLinks, urlSeparateRequest=1, iconimage=icon, possibleTypesOfSearch=[]) hostList.append(hostItem) return hostList
def converItem(self, cItem): hostList = [] searchTypesOptions = [] hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN possibleTypesOfSearch = None if cItem['type'] == 'category': if cItem['title'] == 'Wyszukaj': type = CDisplayListItem.TYPE_SEARCH possibleTypesOfSearch = searchTypesOptions else: type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] == 'video': type = CDisplayListItem.TYPE_VIDEO url = cItem.get('url', '') if '' != url: hostLinks.append(CUrlItem("Link", url, 1)) title = cItem.get('title', '') description = clean_html(cItem.get('desc', '')) icon = cItem.get('icon', '') return CDisplayListItem(name = title, description = description, type = type, urlItems = hostLinks, urlSeparateRequest = 1, iconimage = icon, possibleTypesOfSearch = possibleTypesOfSearch)
def converItem(self, cItem): hostList = [] searchTypesOptions = [] hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN possibleTypesOfSearch = None if 'category' == cItem['type']: if cItem.get('search_item', False): type = CDisplayListItem.TYPE_SEARCH possibleTypesOfSearch = searchTypesOptions else: type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] == 'video': type = CDisplayListItem.TYPE_VIDEO elif 'more' == cItem['type']: type = CDisplayListItem.TYPE_MORE elif 'audio' == cItem['type']: type = CDisplayListItem.TYPE_AUDIO if type in [CDisplayListItem.TYPE_AUDIO, CDisplayListItem.TYPE_VIDEO]: url = cItem.get('url', '') if '' != url: hostLinks.append(CUrlItem('Link', url, 1)) title = cItem.get('title', '') description = cItem.get('desc', '') icon = cItem.get('icon', '') return CDisplayListItem(name=title, description=description, type=type, urlItems=hostLinks, urlSeparateRequest=1, iconimage=icon, possibleTypesOfSearch=possibleTypesOfSearch)
def convertList(self, cList): hostList = [] searchTypesOptions = [] for cItem in cList: hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN possibleTypesOfSearch = None if 'category' == cItem['type']: if cItem.get('search_item', False): type = CDisplayListItem.TYPE_SEARCH possibleTypesOfSearch = searchTypesOptions else: type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] == 'video': type = CDisplayListItem.TYPE_VIDEO url = cItem.get('url', '') if '' != url: hostLinks.append(CUrlItem("Link", url, 0)) title = cItem.get('title', '') description = self.host.cleanHtmlStr(cItem.get('desc', '')) icon = cItem.get('icon', '') hostItem = CDisplayListItem(name = title, description = description, type = type, urlItems = hostLinks, urlSeparateRequest = 1, iconimage = icon, possibleTypesOfSearch = possibleTypesOfSearch) hostList.append(hostItem) return hostList
def converItem(self, cItem): searchTypesOptions = [] # ustawione alfabetycznie hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN possibleTypesOfSearch = None if cItem['type'] == 'category': if cItem['title'] == 'Wyszukaj': type = CDisplayListItem.TYPE_SEARCH possibleTypesOfSearch = searchTypesOptions else: type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] == 'video': type = CDisplayListItem.TYPE_VIDEO urls = cItem.get('urls', []) for urlItem in urls: hostLinks.append(CUrlItem(urlItem['name'], urlItem['url'], 0)) title = clean_html(cItem.get('title', '')) description = clean_html(cItem.get('plot', '')) icon = cItem.get('icon', '') hostItem = CDisplayListItem( name=title, description=description, type=type, urlItems=hostLinks, urlSeparateRequest=0, iconimage=icon, possibleTypesOfSearch=possibleTypesOfSearch) return hostItem
def converItem(self, cItem): hostList = [] searchTypesOptions = [] # ustawione alfabetycznie #searchTypesOptions.append(("Seriale", "seriale")) searchTypesOptions.append(("Filmy", "filmy")) searchTypesOptions.append(("Seriale", "seriale")) hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN possibleTypesOfSearch = None if cItem['type'] == 'category': if cItem['title'] == 'Wyszukaj': type = CDisplayListItem.TYPE_SEARCH possibleTypesOfSearch = searchTypesOptions else: type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] == 'video': type = CDisplayListItem.TYPE_VIDEO url = cItem.get('url', '') if '' != url: hostLinks.append(CUrlItem("Link", url, 1)) title = self.host.cleanHtmlStr(cItem.get('title', '')) description = cItem.get('plot', '') description = self.host.cleanHtmlStr(description) icon = cItem.get('icon', '') return CDisplayListItem(name=title, description=description, type=type, urlItems=hostLinks, urlSeparateRequest=1, iconimage=icon, possibleTypesOfSearch=possibleTypesOfSearch)
def displayList(self, activeIdx=0): list = [] tmpList = self.stackList[-1]['list'] type = self.stackList[-1]['type'] iconType = CDisplayListItem.TYPE_CATEGORY if type == 'movie': self["title"].setText(_("Select movie")) if type == 'episode': self["title"].setText(_("Select episode")) elif type == "lang": self["title"].setText(_("Select language")) elif type == "sub": iconType = CDisplayListItem.TYPE_ARTICLE self["title"].setText(_("Select subtitles to download")) self["title"].show() for item in tmpList: dItem = CDisplayListItem(name=clean_html(item['title']), type=iconType) dItem.privateData = item['private_data'] list.append((dItem, )) self["list"].setList(list) self["list"].show() try: self["list"].moveToIndex(activeIdx) except: pass self.setListMode(True)
def convertList(self, cList): hostList = [] for cItem in cList: hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN if cItem['type'] == 'category': if cItem['title'] == 'Wyszukaj': type = CDisplayListItem.TYPE_SEARCH else: type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] == 'video': type = CDisplayListItem.TYPE_VIDEO page = cItem.get('page', '') if '' != page: hostLinks.append(CUrlItem("Link", page, 1)) title = cItem.get('title', '') description = cItem.get('plot', '') icon = cItem.get('icon', '') hostItem = CDisplayListItem(name = title, description = description, type = type, urlItems = hostLinks, urlSeparateRequest = 1, iconimage = icon ) hostList.append(hostItem) return hostList
def converItem(self, cItem): hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN possibleTypesOfSearch = None if cItem['type'] == 'category': if cItem['title'] == 'Wyszukaj': type = CDisplayListItem.TYPE_SEARCH else: type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] == 'video': type = CDisplayListItem.TYPE_VIDEO elif 'audio' == cItem['type']: type = CDisplayListItem.TYPE_AUDIO elif 'picture' == cItem['type']: type = CDisplayListItem.TYPE_PICTURE if type in [CDisplayListItem.TYPE_AUDIO, CDisplayListItem.TYPE_VIDEO, CDisplayListItem.TYPE_PICTURE]: url = cItem.get('url', '') if '' != url: hostLinks.append(CUrlItem("Link", url, 1)) title = clean_html( cItem.get('title', '') ) description = clean_html( cItem.get('plot', '') ) icon = cItem.get('icon', '') return CDisplayListItem(name = title, description = description, type = type, urlItems = hostLinks, urlSeparateRequest = 1, iconimage = icon, possibleTypesOfSearch = possibleTypesOfSearch)
def convertList(self, cList): hostList = [] searchTypesOptions = [] # ustawione alfabetycznie for cItem in cList: hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN possibleTypesOfSearch = None if cItem['type'] == 'dir': if cItem['title'] == 'Wyszukaj': type = CDisplayListItem.TYPE_SEARCH possibleTypesOfSearch = searchTypesOptions else: type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] == 'video': type = CDisplayListItem.TYPE_VIDEO title = '' if 'title' in cItem: title = cItem['title'] description = '' if 'plot' in cItem: description = cItem['plot'] icon = '' if 'icon' in cItem: icon = cItem['icon'] hostItem = CDisplayListItem(name = title, description = description, type = type, urlItems = hostLinks, urlSeparateRequest = 1, iconimage = icon, possibleTypesOfSearch = possibleTypesOfSearch) hostList.append(hostItem) return hostList
def convertList(self, cList): hostList = [] searchTypesOptions = [] for cItem in cList: hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN possibleTypesOfSearch = None if cItem['type'] == 'category': if cItem['title'] == 'Wyszukaj': type = CDisplayListItem.TYPE_SEARCH possibleTypesOfSearch = searchTypesOptions else: type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] == 'video': type = CDisplayListItem.TYPE_VIDEO url = cItem.get('url', '') if self._isPicture(url): type = CDisplayListItem.TYPE_PICTURE else: type = CDisplayListItem.TYPE_VIDEO if '' != url: hostLinks.append(CUrlItem('Link', url, 1)) title = cItem.get('title', '') description = ph.clean_html(cItem.get('desc', '')) icon = cItem.get('icon', '') hostItem = CDisplayListItem(name=title, description=description, type=type, urlItems=hostLinks, urlSeparateRequest=1, iconimage=icon, possibleTypesOfSearch=possibleTypesOfSearch) hostList.append(hostItem) return hostList
def converItem(self, cItem): hostList = [] hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN url = '' desc = '' if cItem['type'] in ['category']: if cItem.get('title', '') == 'Wyszukaj': type = CDisplayListItem.TYPE_SEARCH else: type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] == 'video': type = CDisplayListItem.TYPE_VIDEO url = cItem.get('page', '') hostLinks.append(CUrlItem('', url, 0)) name = cItem.get('title', '') icon = cItem.get('icon', '') desc = ' ' + cItem.get('page', '') return CDisplayListItem(name=name, description=desc, type=type, urlItems=hostLinks, urlSeparateRequest=1, iconimage=icon, possibleTypesOfSearch=[])
def converItem(self, cItem): hostList = [] searchTypesOptions = self.host.SEARCH_TYPES hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN possibleTypesOfSearch = None if cItem['type'] == 'category': if cItem.get('search_item', False): type = CDisplayListItem.TYPE_SEARCH possibleTypesOfSearch = searchTypesOptions else: type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] == 'video': type = CDisplayListItem.TYPE_VIDEO url = cItem.get('url', '') if '' != url: hostLinks.append(CUrlItem("Link", url, 1)) title = cItem.get('title', '') description = cItem.get('plot', '') if '' == description: description = cItem.get('time', '') + ' | ' + cItem.get('desc', '') icon = cItem.get('icon', '') if icon == '': icon = self.DEFAULT_ICON return CDisplayListItem(name=title, description=description, type=type, urlItems=hostLinks, urlSeparateRequest=1, iconimage=icon, possibleTypesOfSearch=possibleTypesOfSearch)
def getInitialList(self): self.nexSelIndex = 0 self.prevSelList = [] self.categoryList = [] self.currList = [] self.currItem = CDisplayListItem() self["headertext"].setText(self.getCategoryPath()) self.requestListFromHost('Initial')
def listsItems(self, url, clip = True): printDBG( 'Host listsItems begin' ) valTab = [] query_data = {'url': url, 'use_host': False, 'use_cookie': False, 'use_post': False, 'return_data': True} try: printDBG( 'Host listsItems begin query' ) data = self.cm.getURLRequestData(query_data) printDBG( 'Host listsItems begin json' ) result = json.loads(data) except: printDBG( 'Host listsItems ERROR' ) return valTab if clip: printDBG('Host listsItems clip') for item in result['clips']: minimalAge = 0 minimalAge = item['minimalAge'] printDBG('Host listsItems clip Age') printDBG('Host listsItems clip Age minimal') printDBG(str(minimalAge)) printDBG('Host listsItems clip Age host') printDBG(str(self.Age)) printDBG('Host listsItems clip Age ==') if self.Age >= minimalAge: printDBG('Host listsItems clip Age ok') valTab.append(CDisplayListItem(item['title'].encode('UTF-8'), '[minimalAge: '+str(minimalAge)+' ] '+item['description'].encode('UTF-8'), CDisplayListItem.TYPE_VIDEO, [CUrlItem('', item['clipUrl'].encode('UTF-8'), 0)], 0, item['thumbnail'].encode('UTF-8'), None)) else: printDBG('Host listsItems clip Age nok') if self.UkryjAge: printDBG('Host listsItems clip Age nok ukryj') else: printDBG('Host listsItems clip Age nok noukryj') valTab.append(CDisplayListItem(item['title'].encode('UTF-8'), '[minimalAge: '+str(minimalAge)+' ] '+item['description'].encode('UTF-8'), CDisplayListItem.TYPE_VIDEO, [], 0, item['thumbnail'].encode('UTF-8'), None)) if result['page'] != result['pageCount']: valTab.append(CDisplayListItem('nextpage', 'Następna strona', CDisplayListItem.TYPE_CATEGORY, [url + "&page=" + str(result['page']+1)], 1, '', None)) printDBG( 'Host listsItems clip end' ) return valTab else: printDBG('Host listsItems clip else') for item in result: if item['name'] != 'Najnowsze' and item['name'] != 'Wszystkie': valTab.append(CDisplayListItem(item['name'].encode('UTF-8'), item['description'].encode('UTF-8'), CDisplayListItem.TYPE_CATEGORY, ['http://tosiewytnie.pl/app/cliplist?nid='+str(item['nid'])], 1, item['logo'], None)) return valTab
def listSubtitlesProviders(self): printDBG("IPTVSubDownloaderWidget.listSubtitlesProviders") subProvidersList = [] napisy24pl = {'title': _("Napisy24.pl"), 'sub_provider': 'napisy24pl'} openSubtitles = { 'title': _("OpenSubtitles.org"), 'sub_provider': 'opensubtitlesorg' } napiprojektpl = { 'title': _("Napiprojekt.pl"), 'sub_provider': 'napiprojektpl' } titlovi = {'title': _("Titlovi.com"), 'sub_provider': 'titlovicom'} subscene = {'title': _("Subscene.com"), 'sub_provider': 'subscenecom'} youtube = {'title': _("Youtube.com"), 'sub_provider': 'youtubecom'} if 'youtube_id' in self.params['url_params'] and '' != self.params[ 'url_params']['youtube_id']: subProvidersList.append(youtube) if 'pl' == GetDefaultLang(): subProvidersList.append(napisy24pl) if IsSubtitlesParserExtensionCanBeUsed(): subProvidersList.append(napiprojektpl) subProvidersList.append(openSubtitles) subProvidersList.append(titlovi) subProvidersList.append(subscene) if 'pl' != GetDefaultLang(): subProvidersList.append(napisy24pl) if IsSubtitlesParserExtensionCanBeUsed(): subProvidersList.append(napiprojektpl) self.currList = [] for item in subProvidersList: params = CDisplayListItem(item['title'], item.get('desc', ''), CDisplayListItem.TYPE_SUB_PROVIDER) params.privateData = {'sub_provider': item['sub_provider']} self.currList.append(params) idx = 0 selIndex = 0 for idx in range(len(self.currList)): if self.hostName == self.currList[idx].privateData['sub_provider']: selIndex = idx break self["list"].setList([(x, ) for x in self.currList]) #restor previus selection if len(self.currList) > selIndex: self["list"].moveToIndex(selIndex) self.changeBottomPanel() self["headertext"].setText(self.getCategoryPath()) self["statustext"].setText("") self["list"].show()
def convertList(self, cList): hostList = [] possibleTypesOfSearch = [] for cItem in cList: hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN if cItem['type'] in ['main', 'sub', 'subSub', 'subSubPage']: type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] == 'video': type = CDisplayListItem.TYPE_VIDEO videoID = '' if 'url' in cItem: url = cItem['url'] hostLinks.append(CUrlItem('', url, 0)) elif cItem['type'] == 'search': type = CDisplayListItem.TYPE_SEARCH name = ' ' if 'name' in cItem: name = cItem['name'] opis = '' if 'opis' in cItem: opis = cItem['opis'] ilosc = '' if 'ilosc' in cItem: ilosc = '(' + cItem['ilosc'] + ')' ico = '' if 'ico' in cItem: ico = cItem['ico'] if ico == '': ico = 'http://mamrodzine.pl/wp-content/uploads/2011/06/logo_transparent.png' hostItem = CDisplayListItem( name=name + ' ' + ilosc, description=opis, type=type, urlItems=hostLinks, urlSeparateRequest=1, iconimage=ico, possibleTypesOfSearch=possibleTypesOfSearch) hostList.append(hostItem) # end for return hostList #host = Spryciarze() #host.getMainCategory() #host.getVideoList('http://kulinaria.spryciarze.pl/kategorie/dania-miesne') #host.getVideoLinks('58763')
def converItem(self, cItem): type = CDisplayListItem.TYPE_UNKNOWN if 'category' == cItem['type']: type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] == 'subtitle': type = CDisplayListItem.TYPE_SUBTITLE elif 'more' == cItem['type']: type = CDisplayListItem.TYPE_MORE title = cItem.get('title', '') description = cItem.get('desc', '') return CDisplayListItem(name=title, description=description, type=type)
def displayList(self): list = [] self["title"].setText(_("Select subtitles to download")) self["title"].show() tmpList = self.params.get('sub_list', []) for item in tmpList: dItem = CDisplayListItem(name=item['title'], type=CDisplayListItem.TYPE_ARTICLE) dItem.privateData = item list.append((dItem, )) self["list"].setList(list) self["list"].show() self.setListMode(True)
def convertList(self, cList): hostList = [] searchTypesOptions = [] # ustawione alfabetycznie searchTypesOptions.append((_("Games"), "games")) searchTypesOptions.append((_("Channles"), "streams")) for cItem in cList: hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN possibleTypesOfSearch = None if 'category' == cItem['type']: if cItem.get('search_item', False): type = CDisplayListItem.TYPE_SEARCH possibleTypesOfSearch = searchTypesOptions else: type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] == 'video': type = CDisplayListItem.TYPE_VIDEO elif 'more' == cItem['type']: type = CDisplayListItem.TYPE_MORE elif 'audio' == cItem['type']: type = CDisplayListItem.TYPE_AUDIO if type in [ CDisplayListItem.TYPE_AUDIO, CDisplayListItem.TYPE_VIDEO ]: url = cItem.get('url', '') if '' != url: hostLinks.append(CUrlItem("Link", url, 1)) title = self.host._getStr(cItem.get('title', '')) description = self.host._getStr(cItem.get('desc', '')).strip() icon = self.host._getStr(cItem.get('icon', '')) if '' == icon: icon = self.host.DEFAULT_ICON_URL hostItem = CDisplayListItem( name=title, description=description, type=type, urlItems=hostLinks, urlSeparateRequest=1, iconimage=icon, possibleTypesOfSearch=possibleTypesOfSearch) hostList.append(hostItem) return hostList
def converItem(self, cItem): hostList = [] searchTypesOptions = [] # ustawione alfabetycznie searchTypesOptions.append((_("Movies"), "movies")) searchTypesOptions.append((_("Music"), "music")) hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN possibleTypesOfSearch = None if 'category' == cItem['type']: if cItem.get('search_item', False): type = CDisplayListItem.TYPE_SEARCH possibleTypesOfSearch = searchTypesOptions else: type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] == 'video': type = CDisplayListItem.TYPE_VIDEO elif 'more' == cItem['type']: type = CDisplayListItem.TYPE_MORE elif 'audio' == cItem['type']: type = CDisplayListItem.TYPE_AUDIO elif 'picture' == cItem['type']: type = CDisplayListItem.TYPE_PICTURE urlSeparateRequest = 1 if type in [ CDisplayListItem.TYPE_AUDIO, CDisplayListItem.TYPE_VIDEO, CDisplayListItem.TYPE_PICTURE ]: url = cItem.get('url', '') if '' != url: hostLinks.append( CUrlItem("Link", url, cItem.get('need_resolve', 0))) if type == CDisplayListItem.TYPE_PICTURE: urlSeparateRequest = 0 title = cItem.get('title', '') description = cItem.get('desc', '') icon = cItem.get('icon', '') if icon == '': icon = self.host.getDefaultIcon() return CDisplayListItem(name=title, description=description, type=type, urlItems=hostLinks, urlSeparateRequest=urlSeparateRequest, iconimage=icon, possibleTypesOfSearch=possibleTypesOfSearch)
def convertList(self, cList): hostList = [] searchTypesOptions = [] # ustawione alfabetycznie #searchTypesOptions.append(("Filmy", "filmy")) #searchTypesOptions.append(("Seriale","seriale")) for cItem in cList: hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN possibleTypesOfSearch = None if 'category' == cItem['type']: if cItem.get('search_item', False): type = CDisplayListItem.TYPE_SEARCH possibleTypesOfSearch = searchTypesOptions else: type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] == 'video': type = CDisplayListItem.TYPE_VIDEO elif 'more' == cItem['type']: type = CDisplayListItem.TYPE_MORE elif 'audio' == cItem['type']: type = CDisplayListItem.TYPE_AUDIO if type in [ CDisplayListItem.TYPE_AUDIO, CDisplayListItem.TYPE_VIDEO ]: url = cItem.get('url', '') if '' != url: hostLinks.append(CUrlItem("Link", url, 1)) title = self.host.cleanHtmlStr(cItem.get('title', '')) description = self.host.cleanHtmlStr(cItem.get('desc', '')) icon = self.host.cleanHtmlStr(cItem.get('icon', '')) hostItem = CDisplayListItem( name=title, description=description, type=type, urlItems=hostLinks, urlSeparateRequest=1, iconimage=icon, possibleTypesOfSearch=possibleTypesOfSearch) hostList.append(hostItem) return hostList
def convertList(self, cList): hostList = [] searchTypesOptions = [] # ustawione alfabetycznie #searchTypesOptions.append(("Seriale", "seriale")) searchTypesOptions.append(("Filmy", "filmy")) for cItem in cList: hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN possibleTypesOfSearch = None if cItem['type'] == 'category': if cItem['title'] == 'Wyszukaj': type = CDisplayListItem.TYPE_SEARCH possibleTypesOfSearch = searchTypesOptions else: type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] == 'video': type = CDisplayListItem.TYPE_VIDEO url = cItem.get('url', '') if '' != url: hostLinks.append(CUrlItem("Link", url, 1)) elif cItem['type'] == 'article': type = CDisplayListItem.TYPE_ARTICLE url = cItem.get('url', '') if '' != url: hostLinks.append(CUrlItem("Link", url, 1)) title = clean_html(cItem.get('title', '').decode("utf-8")).encode("utf-8") description = clean_html(cItem.get( 'plot', '').decode("utf-8")).encode("utf-8") icon = cItem.get('icon', '') hostItem = CDisplayListItem( name=title, description=description, type=type, urlItems=hostLinks, urlSeparateRequest=1, iconimage=icon, possibleTypesOfSearch=possibleTypesOfSearch) hostList.append(hostItem) return hostList
def convertList(self, cList): hostList = [] searchTypesOptions = [] # ustawione alfabetycznie searchTypesOptions.append(("Zdjęcia", "images")) searchTypesOptions.append(("Wideo", "video")) searchTypesOptions.append(("Audio", "music")) for cItem in cList: hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN possibleTypesOfSearch = None if cItem['type'] == 'category': if cItem['title'] == 'Wyszukaj': type = CDisplayListItem.TYPE_SEARCH possibleTypesOfSearch = searchTypesOptions else: type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] in ['audio', 'video', 'picture']: if 'video' == cItem['type']: type = CDisplayListItem.TYPE_VIDEO elif 'audio' == cItem['type']: type = CDisplayListItem.TYPE_AUDIO else: type = CDisplayListItem.TYPE_PICTURE url = cItem.get('url', '') if '' != url: hostLinks.append(CUrlItem("Link", url, 1)) title = cItem.get('title', '') description = clean_html(cItem.get('desc', '')) + clean_html( cItem.get('plot', '')) icon = cItem.get('icon', '') hostItem = CDisplayListItem( name=title, description=description, type=type, urlItems=hostLinks, urlSeparateRequest=1, iconimage=icon, possibleTypesOfSearch=possibleTypesOfSearch) hostList.append(hostItem) return hostList
def convertList(self, cList): hostList = [] possibleTypesOfSearch = [] for cItem in cList: hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN url = '' desc = '' sepReq = 0 if cItem['type'] in [ 'main_item', 'sub_item', 'sub_item', 'sub_jitem', 'page', 'app_cat' ]: type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] in ['video', 'app_video']: type = CDisplayListItem.TYPE_VIDEO url = cItem['url'] hostLinks.append(CUrlItem('', url, 0)) elif cItem['type'] == 'app_search': type = CDisplayListItem.TYPE_SEARCH name = '' if 'name' in cItem: name = cItem['name'] ico = '' if 'ico' in cItem: ico = cItem['ico'] desc = ' ' if 'desc' in cItem: desc = cItem['desc'] hostItem = CDisplayListItem( name=name, description=desc, type=type, urlItems=hostLinks, urlSeparateRequest=1, iconimage=ico, possibleTypesOfSearch=possibleTypesOfSearch) hostList.append(hostItem) # end for return hostList
def converItem(self, cItem): hostList = [] searchTypesOptions = [] # ustawione alfabetycznie #searchTypesOptions.append((_("Movies"), "movie")) #searchTypesOptions.append((_("TV Shows"), "series")) hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN possibleTypesOfSearch = None if 'category' == cItem['type']: if cItem.get('search_item', False): type = CDisplayListItem.TYPE_SEARCH possibleTypesOfSearch = searchTypesOptions else: type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] == 'video': type = CDisplayListItem.TYPE_VIDEO elif 'more' == cItem['type']: type = CDisplayListItem.TYPE_MORE elif 'audio' == cItem['type']: type = CDisplayListItem.TYPE_AUDIO if type in [CDisplayListItem.TYPE_AUDIO, CDisplayListItem.TYPE_VIDEO]: url = cItem.get('url', '') if '' != url: hostLinks.append(CUrlItem("Link", url, 1)) title = cItem.get('title', '') description = cItem.get('desc', '') icon = cItem.get('icon', '') if icon == '': icon = self.host.DEFAULT_ICON_URL isGoodForFavourites = cItem.get('good_for_fav', False) return CDisplayListItem(name=title, description=description, type=type, urlItems=hostLinks, urlSeparateRequest=1, iconimage=icon, possibleTypesOfSearch=possibleTypesOfSearch, isGoodForFavourites=isGoodForFavourites)
def convertTVPList(self, tvpList): hostList = [] for tvpItem in tvpList: type = CDisplayListItem.TYPE_UNKNOWN if tvpItem.type == CItemList.TYPE_CATEGORY: type = CDisplayListItem.TYPE_CATEGORY else: type = CDisplayListItem.TYPE_VIDEO hostItem = CDisplayListItem(name=tvpItem.name, description=tvpItem.description, type=type, urlItems=[], urlSeparateRequest=1, iconimage=tvpItem.iconimage) hostList.append(hostItem) return hostList
def convertList(self, cList): hostList = [] searchTypesOptions = [] # ustawione alfabetycznie searchTypesOptions.append(("MUSIC", "MUSIC")) #searchTypesOptions.append(("TV", "TV")) searchTypesOptions.append(("FILM", "FILM")) #searchTypesOptions.append(("CHANNEL", "CHANNEL")) searchTypesOptions.append(("COMMUNITY", "COMMUNITY")) for cItem in cList: hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN possibleTypesOfSearch = None if cItem['type'] == 'category': if cItem.get('search_item', False): type = CDisplayListItem.TYPE_SEARCH possibleTypesOfSearch = searchTypesOptions else: type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] == 'video': type = CDisplayListItem.TYPE_VIDEO url = cItem.get('url', '') if '' != url: hostLinks.append(CUrlItem("Link", url, 1)) title = cItem.get('title', '') description = clean_html(cItem.get('desc', '')) + clean_html( cItem.get('plot', '')) icon = cItem.get('icon', '') hostItem = CDisplayListItem( name=title, description=description, type=type, urlItems=hostLinks, urlSeparateRequest=1, iconimage=icon, possibleTypesOfSearch=possibleTypesOfSearch) hostList.append(hostItem) return hostList
def convertList(self, cList): hostList = [] for cItem in cList: hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN if cItem['type'] == 'category': if cItem['title'] == 'Wyszukaj': type = CDisplayListItem.TYPE_SEARCH else: type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] == 'video': type = CDisplayListItem.TYPE_VIDEO page = cItem.get('page', '') if '' != page: hostLinks.append(CUrlItem("Link", page, 1)) title = cItem.get('title', '') icon = cItem.get('icon', '') # prepar description descTab = ((cItem.get('duration', ''), '|', ''), (cItem.get('gatunek', ''), '|', ''), (cItem.get('plot', ''), '|\t', '')) description = '' for descItem in descTab: if '' != descItem[0]: description += descItem[1] + descItem[0] + descItem[2] hostItem = CDisplayListItem( name=unescapeHTML(title.decode("utf-8")).encode("utf-8"), description=unescapeHTML( description.decode("utf-8")).encode("utf-8"), type=type, urlItems=hostLinks, urlSeparateRequest=1, iconimage=icon) hostList.append(hostItem) return hostList