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 displayList(self): list = [] self["title"].setText(_("Select subtitles to download")) self["title"].show() tmpList = self.params.get('sub_list', []) try: for item in tmpList: printDBG(item) dItem = CDisplayListItem(name = item['title'], type=CDisplayListItem.TYPE_ARTICLE) dItem.privateData = item list.append( (dItem,) ) except: printExc() self["list"].setList(list) self["list"].show() self.setListMode(True)
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 = [] searchTypesOptions = [] # ustawione alfabetycznie #searchTypesOptions.append(("Filmy", "filmy")) #searchTypesOptions.append(("Seriale", "seriale")) 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 = [] 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 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, onetList): hostList = [] for onetItem in onetList: hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN if onetItem.name != 'playSelectedMovie': type = CDisplayListItem.TYPE_CATEGORY else: type = CDisplayListItem.TYPE_VIDEO hostItem = CDisplayListItem(name = onetItem.title, \ description = '', \ type = type, \ urlItems = hostLinks, \ urlSeparateRequest = 1, \ iconimage = onetItem.iconimage) hostList.append(hostItem) return hostList
def converItem(self, cItem): hostList = [] searchTypesOptions = [] # ustawione alfabetycznie searchTypesOptions.append(("Filmy", "filmy")) searchTypesOptions.append(("Seriale", "seriale")) searchTypesOptions.append(("Anime", "anime")) 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 = SeansikTV.DEFAULT_ICON return CDisplayListItem(name=title, description=description, type=type, urlItems=hostLinks, urlSeparateRequest=1, iconimage=icon, possibleTypesOfSearch=possibleTypesOfSearch)
def converItem(self, cItem): hostList = [] searchTypesOptions = [] # ustawione alfabetycznie searchTypesOptions.append((_("DATE"), "date")) searchTypesOptions.append((_("VIEWS"), "views")) searchTypesOptions.append((_("LIKES"), "likes")) searchTypesOptions.append((_("COMMENTS"), "comments")) 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 = [] # ustawione alfabetycznie 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 = [] 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 = cItem.get('title', '') description = clean_html(cItem.get('desc', '')) icon = self.host.getFullUrl(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((_("Songs"), "Songs")) searchTypesOptions.append((_("Playlists"), "Playlists")) searchTypesOptions.append((_("Albums"), "Albums")) 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 'more' == cItem['type']: type = CDisplayListItem.TYPE_MORE elif 'audio' == cItem['type']: type = CDisplayListItem.TYPE_AUDIO 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', '')) 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 = [] urlSeparateRequest = 0 type = CDisplayListItem.TYPE_UNKNOWN if cItem.type == CListItem.TYPE_CATEGORY: type = CDisplayListItem.TYPE_CATEGORY elif cItem.type == CListItem.TYPE_VIDEO: type = CDisplayListItem.TYPE_VIDEO hostLinks.append(CUrlItem('', cItem.videoUrl, 1)) elif cItem.type == CListItem.TYPE_VIDEO_RES: type = CDisplayListItem.TYPE_VIDEO hostLinks.append(CUrlItem('', cItem.videoUrl, 1)) urlSeparateRequest = 1 elif cItem.type == CListItem.TYPE_CHANNEL: type = CDisplayListItem.TYPE_VIDEO links = cItem.videoUrl if isinstance(links, list): for link in links: name = link[0] urls = link[1] if isinstance(urls, list): for url in urls: hostLinks.append(CUrlItem(name, url, 0)) else: hostLinks.append(CUrlItem(name, urls, 0)) else: hostLinks.append(CUrlItem('', links, 0)) hostItem = CDisplayListItem(name=cItem.title, description=cItem.description, type=type, urlItems=hostLinks, urlSeparateRequest=urlSeparateRequest, iconimage='') hostList.append(hostItem) return hostList
def convertList(self, cList): hostList = [] searchTypesOptions = [] # ustawione alfabetycznie #searchTypesOptions.append(("Wideo", "video")) #searchTypesOptions.append(("Serie", "series")) 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)) title = cItem.get('title', '') description = cItem.get('plot', '') description = clean_html( description.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 converItem(self, cItem): hostList = [] searchTypesOptions = [] # ustawione alfabetycznie 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 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))) title = cItem.get('title', '') description = cItem.get('desc', '') icon = cItem.get('icon', '') if icon == '': icon = self.DEFAULT_ICON return CDisplayListItem(name = title, description = description, type = type, urlItems = hostLinks, urlSeparateRequest = 0, iconimage = icon, possibleTypesOfSearch = possibleTypesOfSearch)
def listsItems(self, Index, url, name = ''): printDBG( 'Host listsItems begin' ) printDBG( 'Host listsItems url: '+url ) valTab = [] if name == 'main-menu': printDBG( 'Host listsItems begin name='+name ) #valTab.append(CDisplayListItem("Newest (HD-1080p)", "Newest (HD-1080p)", CDisplayListItem.TYPE_CATEGORY, ['http://trailers.apple.com/trailers/home/xml/newest_1080p.xml'], 'appletrailers-movies', '', None)) #valTab.append(CDisplayListItem("Current (HD-1080p)", "Current (HD-1080p)", CDisplayListItem.TYPE_CATEGORY, ['http://trailers.apple.com/trailers/home/xml/current_1080p.xml'], 'appletrailers-movies', '', None)) valTab.append(CDisplayListItem("Newest (HD-720p)", "Newest (HD-720p)", CDisplayListItem.TYPE_CATEGORY, ['http://trailers.apple.com/trailers/home/xml/newest_720p.xml'], 'appletrailers-movies', '', None)) valTab.append(CDisplayListItem("Current (HD-720p)", "Current (HD-720p)", CDisplayListItem.TYPE_CATEGORY, ['http://trailers.apple.com/trailers/home/xml/current_720p.xml'], 'appletrailers-movies', '', None)) valTab.append(CDisplayListItem("Newest (HD-480p)", "Newest (HD-480p)", CDisplayListItem.TYPE_CATEGORY, ['http://trailers.apple.com/trailers/home/xml/newest_480p.xml'], 'appletrailers-movies', '', None)) valTab.append(CDisplayListItem("Current (HD-480p)", "Current (HD-480p)", CDisplayListItem.TYPE_CATEGORY, ['http://trailers.apple.com/trailers/home/xml/current_480p.xml'], 'appletrailers-movies', '', None)) valTab.append(CDisplayListItem("Newest (SD)", "Newest (SD)", CDisplayListItem.TYPE_CATEGORY, ['http://trailers.apple.com/trailers/home/xml/newest.xml'], 'appletrailers-movies', '', None)) valTab.append(CDisplayListItem("Current (SD)", "Current (SD)", CDisplayListItem.TYPE_CATEGORY, ['http://trailers.apple.com/trailers/home/xml/current.xml'], 'appletrailers-movies', '', None)) printDBG( 'Host listsItems end' ) return valTab # ########## # if 'appletrailers-movies' == name: printDBG( 'Host listsItems begin name='+name ) self.MAIN_URL = 'http://trailers.apple.com' query_data = { 'url': url, 'use_host': False, 'use_cookie': False, 'use_post': False, 'return_data': True } try: data = self.cm.getURLRequestData(query_data) except: printDBG( 'Host listsItems query error' ) printDBG( 'Host listsItems query error url:'+url ) return valTab printDBG( 'Host listsItems data: '+data ) phMovies = re.findall('<movieinfo.*?<title>(.*?)</title>.*?<runtime>(.*?)</runtime>.*?<location>(.*?)</location>.*?<large filesize=".*?">(.*?)</large>', data, re.S) if phMovies: for (phTitle, phRuntime, phImage, phUrl) in phMovies: phUrl = urlparser.decorateUrl(phUrl, {'User-Agent':'QuickTime/7.6.2'}) printDBG( 'Host listsItems phTitle: ' +phTitle ) printDBG( 'Host listsItems phRuntime: ' +phRuntime ) printDBG( 'Host listsItems phImage: ' +phImage ) printDBG( 'Host listsItems phUrl: ' +phUrl ) valTab.append(CDisplayListItem(phTitle,'['+phRuntime+'] '+phTitle,CDisplayListItem.TYPE_VIDEO, [CUrlItem('', phUrl, 1)], 0, phImage, None)) printDBG( 'Host listsItems end' ) return valTab return valTab
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
def convertList(self, cList): hostList = [] for cItem in cList: hostLinks = [] description = cItem.description type = CDisplayListItem.TYPE_UNKNOWN if cItem.type == CListItem.TYPE_CATEGORY: type = CDisplayListItem.TYPE_CATEGORY elif cItem.type == CListItem.TYPE_VIDEO: type = CDisplayListItem.TYPE_VIDEO hostLinks.append(CUrlItem('', cItem.videoUrl, 1)) hostItem = CDisplayListItem(name=cItem.title, description=description, type=type, urlItems=hostLinks, urlSeparateRequest=0, iconimage='') hostList.append(hostItem) return hostList
def convertList(self, cList): hostList = [] searchTypesOptions = [] for cItem in cList: 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 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=[], urlSeparateRequest=1, iconimage=icon, possibleTypesOfSearch=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.get('search_item', False): type = CDisplayListItem.TYPE_SEARCH possibleTypesOfSearch = searchTypesOptions else: type = CDisplayListItem.TYPE_CATEGORY elif cItem['type'] == 'video': type = CDisplayListItem.TYPE_VIDEO elif cItem['type'] == 'more': type = CDisplayListItem.TYPE_MORE elif cItem['type'] == 'audio': 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 = [] # 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 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, weebList): hostList = [] for weebItem in weebList: hostLinks = [] type = CDisplayListItem.TYPE_UNKNOWN if weebItem.type == CListItem.TYPE_CATEGORY: type = CDisplayListItem.TYPE_CATEGORY elif weebItem.type == CListItem.TYPE_VIDEO: type = CDisplayListItem.TYPE_VIDEO else: type = CDisplayListItem.TYPE_SEARCH description = weebItem.plot hostItem = CDisplayListItem(name=weebItem.title, description=description, type=type, urlItems=hostLinks, urlSeparateRequest=1, iconimage=weebItem.iconimage) hostList.append(hostItem) return hostList
def converItem(self, cItem): hostList = [] 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 title = cItem.get('title', '') description = cItem.get('plot', '') icon = cItem.get('icon', '') return CDisplayListItem(name = title, description = description, type = type, urlItems = hostLinks, urlSeparateRequest = 1, iconimage = icon )
class Host: currList = [] Age = 6 UkryjAge = False # name description type urlItems urlSeparateRequest iconimage possibleTypesOfSearch MAIN_MENU = [CDisplayListItem('Kanały', 'Kanały', CDisplayListItem.TYPE_CATEGORY, ['http://tosiewytnie.pl/app/channellist?'], 0, '', None), \ #CDisplayListItem('Gatunki', 'Gatunki', CDisplayListItem.TYPE_CATEGORY, ['http://tosiewytnie.pl/app/genreslist?'], 0, '', None), \ CDisplayListItem('Polecane', 'Polecane', CDisplayListItem.TYPE_CATEGORY, ['http://tosiewytnie.pl/app/recommended?'], 1, '', None), \ CDisplayListItem('TOP100 Zawsze', 'TOP100 Zawsze', CDisplayListItem.TYPE_CATEGORY, ['http://tosiewytnie.pl/app/rankings?'], 1, '', None), \ CDisplayListItem('TOP100 Tygodnia', 'TOP100 Tygodnia', CDisplayListItem.TYPE_CATEGORY, ['http://tosiewytnie.pl/app/rankings?type=week'], 1, '', None), \ CDisplayListItem('TOP100 Miesiąca', 'TOP100 Miesiąca', CDisplayListItem.TYPE_CATEGORY, ['http://tosiewytnie.pl/app/rankings?type=month'], 1, '', None), \ ] def __init__(self): printDBG( 'Host __init__ begin' ) self.cm = pCommon.common() self.currList = [] self.Age = 6 self.UkryjAge = False printDBG( 'Host __init__ begin' ) def setCurrList(self, list): printDBG( 'Host setCurrList begin' ) self.currList = list printDBG( 'Host setCurrList begin' ) return def setAge(self, age): printDBG( 'Host setAge begin' ) self.Age = age printDBG( 'Host setAge end' ) return def setUkryjAge(self, UkryjAge): printDBG( 'Host setUkryjAge begin' ) self.UkryjAge = UkryjAge printDBG( 'Host setUkryjAge end' ) return def getInitList(self): printDBG( 'Host getInitList begin' ) self.currList = self.MAIN_MENU printDBG( 'Host getInitList end' ) return self.currList def getListForItem(self, Index = 0, refresh = 0, selItem = None): printDBG( 'Host getListForItem begin' ) valTab = [] if len(self.currList[Index].urlItems) == 0: return valTab valTab = self.listsItems(self.currList[Index].urlItems[0], self.currList[Index].urlSeparateRequest) self.currList = valTab printDBG( 'Host getListForItem end' ) return self.currList 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 __init__(self, session, params={}): # params: vk_title, movie_title printDBG("IPTVSubDownloaderWidget.__init__ desktop IPTV_VERSION[%s]\n" % (IPTVSubDownloaderWidget.IPTV_VERSION)) self.session = session path = GetSkinsDir(config.plugins.iptvplayer.skin.value) + "/subplaylist.xml" if os_path.exists(path): try: with open(path, "r") as f: self.skin = f.read() f.close() except Exception: printExc("Skin read error: " + path) Screen.__init__(self, session) self["key_red"] = StaticText(_("Cancel")) self["list"] = IPTVMainNavigatorList() self["list"].connectSelChanged(self.onSelectionChanged) self["statustext"] = Label("Loading...") self["actions"] = ActionMap(["IPTVPlayerListActions", "WizardActions", "DirectionActions", "ColorActions", "NumberActions"], { "red": self.red_pressed, "green": self.green_pressed, "yellow": self.yellow_pressed, "blue": self.blue_pressed, "ok": self.ok_pressed, "back": self.back_pressed, }, -1) self["headertext"] = Label() self["console"] = Label() self["sequencer"] = Label() try: for idx in range(5): spinnerName = "spinner" if idx: spinnerName += '_%d' % idx self[spinnerName] = Cover3() except Exception: printExc() self.spinnerPixmap = [LoadPixmap(GetIconDir('radio_button_on.png')), LoadPixmap(GetIconDir('radio_button_off.png'))] self.showHostsErrorMessage = True self.onClose.append(self.__onClose) #self.onLayoutFinish.append(self.onStart) self.onShow.append(self.onStart) #Defs self.params = dict(params) self.params['discover_info'] = self.discoverInfoFromTitle() self.params['movie_url'] = strwithmeta(self.params.get('movie_url', '')) self.params['url_params'] = self.params['movie_url'].meta self.movieTitle = self.params['discover_info']['movie_title'] self.workThread = None self.host = None self.hostName = '' self.nextSelIndex = 0 self.currSelIndex = 0 self.prevSelList = [] self.categoryList = [] self.currList = [] self.currItem = CDisplayListItem() self.visible = True ################################################################# # Inits for Proxy Queue ################################################################# # register function in main Queue if None == asynccall.gMainFunctionsQueueTab[1]: asynccall.gMainFunctionsQueueTab[1] = asynccall.CFunctionProxyQueue(self.session) asynccall.gMainFunctionsQueueTab[1].clearQueue() asynccall.gMainFunctionsQueueTab[1].setProcFun(self.doProcessProxyQueueItem) #main Queue self.mainTimer = eTimer() self.mainTimer_conn = eConnectCallback(self.mainTimer.timeout, self.processProxyQueue) # every 100ms Proxy Queue will be checked self.mainTimer_interval = 100 self.mainTimer.start(self.mainTimer_interval, True) # spinner timer self.spinnerTimer = eTimer() self.spinnerTimer_conn = eConnectCallback(self.spinnerTimer.timeout, self.updateSpinner) self.spinnerTimer_interval = 200 self.spinnerEnabled = False ################################################################# self.downloadedSubItems = []
def listSubtitlesProviders(self): printDBG("IPTVSubDownloaderWidget.listSubtitlesProviders") subProvidersList = [] napisy24pl = {'title': "Napisy24.pl", 'sub_provider': 'napisy24pl'} openSubtitles = {'title': "OpenSubtitles.org API", 'sub_provider': 'opensubtitlesorg'} openSubtitles2 = {'title': "OpenSubtitles.org WWW", 'sub_provider': 'opensubtitlesorg2'} openSubtitles3 = {'title': "OpenSubtitles.org REST", 'sub_provider': 'opensubtitlesorg3'} napiprojektpl = {'title': "Napiprojekt.pl", 'sub_provider': 'napiprojektpl'} podnapisinet = {'title': "Podnapisi.net", 'sub_provider': 'podnapisinet'} titlovi = {'title': "Titlovi.com", 'sub_provider': 'titlovicom'} subscene = {'title': "Subscene.com", 'sub_provider': 'subscenecom'} youtube = {'title': "Youtube.com", 'sub_provider': 'youtubecom'} popcornsubtitles = {'title': "PopcornSubtitles.com", 'sub_provider': 'popcornsubtitles'} subtitlesgr = {'title': "Subtitles.gr", 'sub_provider': 'subtitlesgr'} prijevodi = {'title': "Prijevodi-Online.org", 'sub_provider': 'prijevodi'} subsro = {'title': "Subs.ro", 'sub_provider': 'subsro'} defaultLang = GetDefaultLang() if 'youtube_id' in self.params['url_params'] and '' != self.params['url_params']['youtube_id']: subProvidersList.append(youtube) if 'popcornsubtitles_url' in self.params['url_params'] and '' != self.params['url_params']['popcornsubtitles_url']: subProvidersList.append(popcornsubtitles) if 'hr' == defaultLang: subProvidersList.append(prijevodi) if 'el' == defaultLang: subProvidersList.append(subtitlesgr) if 'ro' == defaultLang: subProvidersList.append(subsro) if 'pl' == defaultLang: subProvidersList.append(napisy24pl) if IsSubtitlesParserExtensionCanBeUsed(): subProvidersList.append(napiprojektpl) subProvidersList.append(openSubtitles2) subProvidersList.append(openSubtitles3) subProvidersList.append(openSubtitles) subProvidersList.append(podnapisinet) subProvidersList.append(titlovi) subProvidersList.append(subscene) if 'pl' != defaultLang: subProvidersList.append(napisy24pl) if IsSubtitlesParserExtensionCanBeUsed(): subProvidersList.append(napiprojektpl) if 'el' != defaultLang: subProvidersList.append(subtitlesgr) if 'hr' != defaultLang: subProvidersList.append(prijevodi) if 'ro' != defaultLang: subProvidersList.append(subsro) 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 listsItems(self, Index, url, name=''): printDBG('Host listsItems begin') printDBG('Host listsItems url: ' + url) valTab = [] # ########## # if name == 'main-menu': printDBG('Host listsItems begin name=' + name) self.MAIN_URL = 'http://scs.pl' valTab.append( CDisplayListItem("Seriale wg. kategorii" + self.konto, 'http://scs.pl/seriale.html', CDisplayListItem.TYPE_CATEGORY, ['http://scs.pl/seriale.html'], 'seriale-kategorie', '', None)) valTab.append( CDisplayListItem("Seriale alfabetycznie", 'http://scs.pl/seriale.html', CDisplayListItem.TYPE_CATEGORY, ['http://scs.pl/seriale.html'], 'seriale-abc', '', None)) valTab.append( CDisplayListItem( "Ostatnio aktualizowane seriale", 'http://scs.pl/ostatnio_aktualizowane_seriale.html', CDisplayListItem.TYPE_CATEGORY, ['http://scs.pl/ostatnio_aktualizowane_seriale.html'], 'seriale-last', '', None)) valTab.append( CDisplayListItem('Szukaj', 'Szukaj', CDisplayListItem.TYPE_SEARCH, ['http://scs.pl/serial,szukaj.html'], 'search', '', None)) valTab.append( CDisplayListItem('Historia wyszukiwania', 'Historia wyszukiwania', CDisplayListItem.TYPE_CATEGORY, [''], 'history', '', None)) printDBG('Host listsItems end') return valTab # ########## # if 'zaloguj' == name: printDBG('Host listsItems begin name=' + name) if config.plugins.iptvplayer.scserialePREMIUM.value: url = 'http://scs.pl/logowanie.html' try: data = self.cm.getURLRequestData( { 'url': url, 'use_host': True, 'host': self.HOST, 'use_cookie': True, 'save_cookie': True, 'load_cookie': False, 'cookiefile': self.COOKIEFILE, 'use_post': True, 'return_data': True }, { 'email': config.plugins.iptvplayer.scseriale_login.value, 'password': config.plugins.iptvplayer.scseriale_password.value }) except: printDBG('Host listsItems query error') printDBG('Host listsItems query error url:' + url) printDBG( 'Host listsItems query error: Uzywam Player z limitami' ) data = None if data: self.PREMIUM = True printDBG('Host listsItems: chyba zalogowano do premium...') url = 'http://scs.pl/premium.html' try: data = self.cm.getURLRequestData({ 'url': url, 'use_host': True, 'host': self.HOST, 'use_cookie': True, 'save_cookie': False, 'load_cookie': True, 'cookiefile': self.COOKIEFILE, 'use_post': False, 'return_data': True }) printDBG('Host listsItems data: ' + data) parse = re.search( 'Konto premium ważne do(.*?)".*?;(.*?)<', data, re.S) if parse: self.konto = ' - Twoje konto: ' + parse.group( 2) + parse.group(1) else: self.konto = '' except: printDBG( 'Host listsItems: blad pobrania danych o koncie premium' ) if '' == self.konto: self.exSession.open( MessageBox, 'Problem z zalogowaniem użytkownika \n"%s" jako VIP.' % config.plugins.iptvplayer.scseriale_login.value, type=MessageBox.TYPE_INFO, timeout=10) printDBG('Host listsItems end') return self.PREMIUM # ########## # if 'history' == name: printDBG('Host listsItems begin name=' + name) for histItem in self.history.getHistoryList(): valTab.append( CDisplayListItem(histItem['pattern'], 'Szukaj ', CDisplayListItem.TYPE_CATEGORY, [histItem['pattern'], histItem['type']], 'search', '', None)) printDBG('Host listsItems end') return valTab # ########## # if 'search' == name: printDBG('Host listsItems begin name=' + name) pattern = url if Index == -1: self.history.addHistoryItem(pattern, 'seriale') url = 'http://scs.pl/serial,szukaj.html' postdata = {'search': pattern} try: data = self.cm.getURLRequestData( { 'url': url, 'use_host': False, 'use_cookie': False, 'use_post': True, 'return_data': True }, postdata) except: printDBG('Host listsItems query error') printDBG('Host listsItems query error url:' + url) return valTab #printDBG( 'Host listsItems data: '+data ) match = re.findall( '<div class="img_box"><a href="(.*?)">.*?<img src="(.*?)" alt="(.*?)"', data, re.S) if len(match) > 0: for i in range(len(match)): phImage = match[i][1] phUrl = self.MAIN_URL + '/' + match[i][0] phTitle = match[i][2] printDBG('Host listsItems phImage: ' + phImage) printDBG('Host listsItems phUrl: ' + phUrl) printDBG('Host listsItems phTitle: ' + phTitle) valTab.append( CDisplayListItem(phTitle, phTitle, CDisplayListItem.TYPE_CATEGORY, [phUrl], 'seriale-sezony', phImage, None)) printDBG('Host listsItems end') return valTab # ########## # if 'seriale-last' == name: printDBG('Host listsItems begin name=' + name) try: data = self.cm.getURLRequestData({ 'url': url, 'use_host': False, 'use_cookie': False, 'use_post': False, 'return_data': True }) except: printDBG('Host listsItems query error') printDBG('Host listsItems query error url:' + url) return valTab #printDBG( 'Host listsItems data: '+data ) match = re.compile( 'online">(.+?)</a></div></div><span class="newest_ep" id=".+?">Ostatnio dodany:<br/><a href="odcinek,(.+?),(.+?),(.+?),(.+?).html">' ).findall(data) if len(match) > 0: for i in range(len(match)): phImage = 'http://static.scs.pl/static/serials/' + match[ i][1].replace('.html', '.jpg') + '.jpg' phTitleS = match[i][1] phTitle = match[i][0] + ' - ' + match[i][ 4] + ' - ' + match[i][2].capitalize().replace( '-', ' ') phUrlS = self.MAIN_URL + '/serial,' + match[i][0] phUrl = self.MAIN_URL + '/odcinek,' + match[i][ 1] + ',' + match[i][2] + ',' + match[i][ 3] + ',' + match[i][4] + '.html' printDBG('Host listsItems phImage: ' + phImage) printDBG('Host listsItems phUrl: ' + phUrl) printDBG('Host listsItems phTitle: ' + phTitle) valTab.append( CDisplayListItem(phTitleS, phTitleS, CDisplayListItem.TYPE_CATEGORY, [phUrlS], 'seriale-sezony', phImage, None)) valTab.append( CDisplayListItem(phTitle, phTitle, CDisplayListItem.TYPE_VIDEO, [CUrlItem('', phUrl, 1)], 0, phImage, None)) printDBG('Host listsItems end') return valTab if 'seriale-kategorie' == name: printDBG('Host listsItems begin name=' + name) try: data = self.cm.getURLRequestData({ 'url': url, 'use_host': False, 'use_cookie': False, 'use_post': False, 'return_data': True }) except: printDBG('Host listsItems query error') printDBG('Host listsItems query error url:' + url) return valTab #printDBG( 'Host listsItems data: '+data ) phMovies = re.findall( '<span class="title1">(.*?)</span>(.*?)<.*?href="(.*?)"', data, re.S) if phMovies: for (phTitle, phCount, phUrl) in phMovies: printDBG('Host listsItems phTitle: ' + phTitle) printDBG('Host listsItems phCount: ' + phCount) printDBG('Host listsItems phUrl: ' + phUrl) valTab.append( CDisplayListItem(phTitle + phCount, phTitle, CDisplayListItem.TYPE_CATEGORY, [self.MAIN_URL + '/' + phUrl], 'seriale-kategoria', '', None)) printDBG('Host listsItems end') return valTab if 'seriale-kategoria' == name: printDBG('Host listsItems begin name=' + name) try: data = self.cm.getURLRequestData({ 'url': url, 'use_host': False, 'use_cookie': False, 'use_post': False, 'return_data': True }) except: printDBG('Host listsItems query error') printDBG('Host listsItems query error url:' + url) return valTab #printDBG( 'Host listsItems data: '+data ) match = re.compile( 'class="serial_green" href="serial,(.+?)">(.+?)</a><br/>' ).findall(data) if len(match) > 0: for i in range(len(match)): phImage = 'http://static.scs.pl/static/serials/' + match[ i][0].replace('.html', '.jpg') phTitle = match[i][1] phUrl = self.MAIN_URL + '/serial,' + match[i][0] printDBG('Host listsItems phImage: ' + phImage) printDBG('Host listsItems phUrl: ' + phUrl) printDBG('Host listsItems phTitle: ' + phTitle) valTab.append( CDisplayListItem(phTitle, phTitle, CDisplayListItem.TYPE_CATEGORY, [phUrl], 'seriale-sezony', phImage, None)) printDBG('Host listsItems end') return valTab if 'seriale-abc' == name: printDBG('Host listsItems begin name=' + name) abcTab = self.cm.makeABCList() for i in range(len(abcTab)): phTitle = abcTab[i] valTab.append( CDisplayListItem(phTitle, phTitle, CDisplayListItem.TYPE_CATEGORY, [url, phTitle], 'seriale-alfabet', '', None)) printDBG('Host listsItems end') return valTab if 'seriale-alfabet' == name: printDBG('Host listsItems begin name=' + name) try: data = self.cm.getURLRequestData({ 'url': url, 'use_host': False, 'use_cookie': False, 'use_post': False, 'return_data': True }) except: printDBG('Host listsItems query error') printDBG('Host listsItems query error url:' + url) return valTab #printDBG( 'Host listsItems data: '+data ) letter = self.currList[Index].urlItems[1] match = re.compile( ' <a class="serial_green" href="serial,(.+?)">(.+?)</a><br/>' ).findall(data) if len(match) > 0: for i in range(len(match)): addItem = False if letter == '0 - 9' and (ord(match[i][1][0]) < 65 or ord(match[i][1][0]) > 91): addItem = True if (letter == match[i][1][0].upper()): addItem = True if (addItem): phImage = 'http://static.scs.pl/static/serials/' + match[ i][0].replace('.html', '.jpg') phTitle = match[i][1] phUrl = self.MAIN_URL + '/serial,' + match[i][0] printDBG('Host listsItems phImage: ' + phImage) printDBG('Host listsItems phUrl: ' + phUrl) printDBG('Host listsItems phTitle: ' + phTitle) valTab.append( CDisplayListItem(phTitle, phTitle, CDisplayListItem.TYPE_CATEGORY, [phUrl], 'seriale-sezony', phImage, None)) printDBG('Host listsItems end') return valTab if 'seriale-sezony' == name: printDBG('Host listsItems begin name=' + name) try: data = self.cm.getURLRequestData({ 'url': url, 'use_host': False, 'use_cookie': False, 'use_post': False, 'return_data': True }) except: printDBG('Host listsItems query error') printDBG('Host listsItems query error url:' + url) return valTab #printDBG( 'Host listsItems data: '+data ) phMovies = re.compile( '<meta itemprop="seasonNumber" content="(.+?)">').findall(data) if phMovies: phImage = url.replace( self.MAIN_URL + '/serial,', 'http://static.scs.pl/static/serials/').replace( '.html', '.jpg') printDBG('Host listsItems phImage: ' + phImage) for (phTitle) in phMovies: printDBG('Host listsItems phTitle: ' + phTitle) valTab.append( CDisplayListItem('Sezon ' + phTitle, 'Sezon ' + phTitle, CDisplayListItem.TYPE_CATEGORY, [url, phTitle], 'seriale-odcinki', phImage, None)) printDBG('Host listsItems end') return valTab if 'seriale-odcinki' == name: printDBG('Host listsItems begin name=' + name) try: data = self.cm.getURLRequestData({ 'url': url, 'use_host': False, 'use_cookie': False, 'use_post': False, 'return_data': True }) except: printDBG('Host listsItems query error') printDBG('Host listsItems query error url:' + url) return valTab #printDBG( 'Host listsItems data: '+data ) sezon = self.currList[Index].urlItems[1] r = re.compile( '<meta itemprop="seasonNumber" content="' + sezon + '">(.+?)</ul></div>', re.DOTALL).findall(data) if not r: return [] phMovies = re.compile( 'itemprop="episodeNumber">(.+?)<.+?class="aLink " href="(odcinek,.+?,.+?,.+?,.+?.html)"><span itemprop="name">(.+?)</span></a>' ).findall(r[0]) if phMovies: phImage = url.replace( self.MAIN_URL + '/serial,', 'http://static.scs.pl/static/serials/').replace( '.html', '.jpg') serial = url.replace(self.MAIN_URL + '/serial,', '').replace('.html', '') printDBG('Host listsItems phImage: ' + phImage) for (phEpizod, phUrl, phName) in phMovies: printDBG('Host listsItems phEpizod: ' + phEpizod) printDBG('Host listsItems phUrl: ' + phUrl) phTitle = '%s S%sE%s - %s' % (serial, sezon, phEpizod, phName) printDBG('Host listsItems phTitle: ' + phTitle) valTab.append( CDisplayListItem( phTitle, phTitle, CDisplayListItem.TYPE_CATEGORY, [self.MAIN_URL + '/' + phUrl, phTitle], 'seriale-odcinki-wersje', phImage, None)) printDBG('Host listsItems end') return valTab if 'seriale-odcinki-wersje' == name: printDBG('Host listsItems begin name=' + name) try: data = self.cm.getURLRequestData({ 'url': url, 'use_host': False, 'use_cookie': False, 'use_post': False, 'return_data': True }) except: printDBG('Host listsItems query error') printDBG('Host listsItems query error url:' + url) return valTab #printDBG( 'Host listsItems data: '+data ) parse = re.search('Wersje:(.*?)Kopie:', data, re.S) if not parse: return [] phMovies = re.findall('<a href="(.+?)">(.+?)<', parse.group(1), re.S) if phMovies: phImage = url.replace( self.MAIN_URL + '/serial,', 'http://static.scs.pl/static/serials/').replace( '.html', '.jpg') printDBG('Host listsItems phImage: ' + phImage) for (phUrl, phWersja) in phMovies: printDBG('Host listsItems phUrl: ' + phUrl) printDBG('Host listsItems phWersja: ' + phWersja) valTab.append( CDisplayListItem(phWersja, phWersja, CDisplayListItem.TYPE_CATEGORY, [self.MAIN_URL + '/' + phUrl], 'seriale-odcinki-kopie', phImage, None)) printDBG('Host listsItems end') return valTab if 'seriale-odcinki-kopie' == name: printDBG('Host listsItems begin name=' + name) try: data = self.cm.getURLRequestData({ 'url': url, 'use_host': False, 'use_cookie': False, 'use_post': False, 'return_data': True }) except: printDBG('Host listsItems query error') printDBG('Host listsItems query error url:' + url) return valTab #printDBG( 'Host listsItems data: '+data ) parse = re.search('class="mirrors"(.*?)class="switch"', data, re.S) if not parse: return [] phMovies = re.findall( '= "(.+?)"; ccc.+?;.+?"(.+?)";.+?"(.+?)";.+?"(.+?)";', parse.group(1), re.S) if phMovies: for (phUrl, phTime, phUser, phComment) in phMovies: printDBG('Host listsItems phUrl: ' + phUrl) printDBG('Host listsItems phTime: ' + phTime) printDBG('Host listsItems phUser: '******' ' + phUser, phTime + ' ' + phUser + ' ' + phComment, CDisplayListItem.TYPE_VIDEO, [CUrlItem('', phUrl, 1)], 0, '', None)) printDBG('Host listsItems end') return valTab return valTab
def listsItems(self, Index, url, name=''): printDBG('Host listsItems begin') printDBG('Host listsItems url[%r] ' % url) valTab = [] if name == 'main-menu': printDBG('Host listsItems begin name=' + name) valTab.append( CDisplayListItem( 'Episodes', 'http://player.dancetrippin.tv/#dj', CDisplayListItem.TYPE_CATEGORY, ['http://player.dancetrippin.tv/video/list/dj/'], 'episodes', '', None)) valTab.append( CDisplayListItem( 'Sol sessions', 'http://player.dancetrippin.tv/#sol', CDisplayListItem.TYPE_CATEGORY, ['http://player.dancetrippin.tv/video/list/sol/'], 'episodes', '', None)) valTab.append( CDisplayListItem( 'Other videos', 'http://player.dancetrippin.tv/#other', CDisplayListItem.TYPE_CATEGORY, ['http://player.dancetrippin.tv/video/list/other/'], 'episodes', '', None)) valTab.append( CDisplayListItem( 'Ibiza Global Radio', 'http://player.dancetrippin.tv/#igr', CDisplayListItem.TYPE_CATEGORY, ['http://player.dancetrippin.tv/video/list/igr/'], 'episodes', '', None)) return valTab # ########## # if 'episodes' == name: printDBG('Host listsItems begin name=' + name) self.MAIN_URL = 'http://player.dancetrippin.tv' try: data = self.cm.getURLRequestData({ 'url': url, 'use_host': False, 'use_cookie': False, 'use_post': False, 'return_data': True }) except: printExc('Host listsItems query error url[%r]' % url) return valTab #printDBG( 'Host listsItems data: '+data ) result = simplejson.loads(data) if result: for item in result: ''' printDBG( 'Host listsItems number: '+str(item["number"]) ) printDBG( 'Host listsItems title: '+str(item["title"]) ) printDBG( 'Host listsItems venue: '+str(item["venue"]) ) printDBG( 'Host listsItems location: '+str(item["location"]) ) printDBG( 'Host listsItems party: '+str(item["party"]) ) printDBG( 'Host listsItems description: '+str(item["description"]) ) printDBG( 'Host listsItems dj: '+str(item["dj"]) ) ''' if self.getStr(item["image"]) <> "": phImage = 'http://www.dancetrippin.tv/media/' + self.getStr( item["image"]) else: phImage = "http://player.dancetrippin.tv/media/static/img/system/default_video.png" #printDBG( 'Host listsItems phImage: '+phImage ) phUrl = self.MAIN_URL + '/video/' + self.getStr( item["slug"]) + '/' #printDBG( 'Host listsItems phUrl: '+phUrl ) desc = '[' + self.getStr( item["venue"]) + '][' + self.getStr( item["dj"]) + '][' + self.getStr( item["location"]) + '][' + self.getStr( item["party"]) + '][' + self.getStr( item["description"]) desc = clean_html(desc.decode("utf-8")).encode("utf-8") valTab.append( CDisplayListItem( self.getStr(item["number"]) + ' ' + self.getStr(item["title"]), desc, CDisplayListItem.TYPE_VIDEO, [ CUrlItem('HIGH', phUrl + '?q=hd', 1), CUrlItem('MEDIUM', phUrl + '?q=sd', 1) ], 0, phImage, None)) printDBG('Host listsItems end') return valTab return valTab
def listsItems(self, Index, url, name=''): printDBG('Host listsItems begin') printDBG('Host listsItems url: ' + url) valTab = [] if name == 'main-menu': printDBG('Host listsItems begin name=' + name) self.MAIN_URL = 'http://zalukaj.tv' valTab.append( CDisplayListItem('Filmy ' + self.konto, 'http://zalukaj.tv', CDisplayListItem.TYPE_CATEGORY, ['http://zalukaj.tv/'], 'filmy', '', None)) valTab.append( CDisplayListItem('Seriale', 'http://zalukaj.tv/seriale', CDisplayListItem.TYPE_CATEGORY, ['http://zalukaj.tv/seriale'], 'seriale', '', None)) valTab.append( CDisplayListItem('Szukaj', 'Szukaj filmów', CDisplayListItem.TYPE_SEARCH, ['http://szukaj.zalukaj.tv/szukaj'], 'seriale', '', None)) valTab.append( CDisplayListItem('Historia wyszukiwania', 'Historia wyszukiwania', CDisplayListItem.TYPE_CATEGORY, ['http://zalukaj.tv/seriale'], 'history', '', None)) printDBG('Host listsItems end') return valTab # ########## # if 'history' == name: printDBG('Host listsItems begin name=' + name) for histItem in self.history.getHistoryList(): valTab.append( CDisplayListItem(histItem['pattern'], 'Szukaj ', CDisplayListItem.TYPE_CATEGORY, [histItem['pattern'], histItem['type']], 'search', '', None)) printDBG('Host listsItems end') return valTab # ########## # if 'search' == name: printDBG('Host listsItems begin name=' + name) pattern = url if Index == -1: self.history.addHistoryItem(pattern, 'video') url = 'http://k.zalukaj.tv/szukaj' try: data = self.cm.getURLRequestData( { 'url': url, 'use_host': False, 'use_cookie': False, 'use_post': True, 'return_data': True }, {'searchinput': pattern}) except: printDBG('Host listsItems query error') printDBG('Host listsItems query error url:' + url) return valTab #printDBG( 'Host listsItems data: '+data ) phMovies = re.findall( 'class="tivief4".*?src="(.*?)".*?<a href="(.*?)".*?title="(.*?)".*?div style.*?">(.*?)<.*?class="few_more">(.*?)<', data, re.S) if phMovies: for (phImage, phUrl, phTitle, phDescr, phMore) in phMovies: printDBG('Host listsItems phImage: ' + phImage) printDBG('Host listsItems phUrl: ' + phUrl) printDBG('Host listsItems phTitle: ' + phTitle) printDBG('Host listsItems phDescr: ' + phDescr) printDBG('Host listsItems phMore: ' + phMore) valTab.append( CDisplayListItem(phTitle, phMore + ' | ' + decodeHtml(phDescr), CDisplayListItem.TYPE_VIDEO, [CUrlItem('', phUrl, 1)], 0, phImage, None)) printDBG('Host listsItems end') return valTab # ########## # if 'seriale' == name: printDBG('Host listsItems begin name=' + name) self.MAIN_URL = 'http://zalukaj.tv' try: data = self.cm.getURLRequestData({ 'url': url, 'use_host': False, 'use_cookie': False, 'use_post': False, 'return_data': True }) except: printDBG('Host listsItems query error') printDBG('Host listsItems query error url:' + url) return valTab #printDBG( 'Host listsItems data: '+data ) parse = re.search('<div id="two"(.*?)</table>', data, re.S) if not parse: return '' phMovies = re.findall( '<td class="wef32f"><a href="(.*?)" title="(.*?)"', parse.group(1), re.S) if phMovies: for (phUrl, phTitle) in phMovies: printDBG('Host listsItems phUrl: ' + phUrl) printDBG('Host listsItems phTitle: ' + phTitle) valTab.append( CDisplayListItem(phTitle, phTitle, CDisplayListItem.TYPE_CATEGORY, [self.fullUrl(phUrl)], 'seriale-sezony', '', None)) valTab.insert( 0, CDisplayListItem('--Ostatnio zaktualizowane seriale--', 'Ostatnio zaktualizowane seriale', CDisplayListItem.TYPE_CATEGORY, ['http://zalukaj.tv/seriale'], 'seriale-last', '', None)) printDBG('Host listsItems end') return valTab if 'seriale-last' == name: printDBG('Host listsItems begin name=' + name) self.MAIN_URL = 'http://zalukaj.tv' try: data = self.cm.getURLRequestData({ 'url': url, 'use_host': False, 'use_cookie': False, 'use_post': False, 'return_data': True }) except: printDBG('Host listsItems query error') printDBG('Host listsItems query error url:' + url) return valTab #printDBG( 'Host listsItems data: '+data ) phMovies = re.findall( '<div class="latest tooltip".*?href="(.*?)" title="(.*?)".*?src="(.*?)"', data, re.S) if phMovies: for (phUrl, phTitle, phImage) in phMovies: printDBG('Host listsItems phUrl: ' + phUrl) printDBG('Host listsItems phTitle: ' + phTitle) printDBG('Host listsItems phImage: ' + phImage) valTab.append( CDisplayListItem(phTitle, phTitle, CDisplayListItem.TYPE_CATEGORY, [self.fullUrl(phUrl)], 'seriale-sezon', phImage, None)) printDBG('Host listsItems end') return valTab if 'seriale-sezony' == name: printDBG('Host listsItems begin name=' + name) self.MAIN_URL = 'http://zalukaj.tv' try: data = self.cm.getURLRequestData({ 'url': url, 'use_host': False, 'use_cookie': False, 'use_post': False, 'return_data': True }) except: printDBG('Host listsItems query error') printDBG('Host listsItems query error url:' + url) return valTab #printDBG( 'Host listsItems data: '+data ) phImage = '' parse = re.search('<div id="sezony".*?img src="(.*?)"', data, re.S) if parse: phImage = parse.group(1) printDBG('Host listsItems phImage: ' + phImage) phMovies = re.findall('<a class="sezon" href="(.*?)".*?>(.*?)<', data, re.S) if phMovies: for (phUrl, phTitle) in phMovies: printDBG('Host listsItems phUrl: ' + phUrl) printDBG('Host listsItems phTitle: ' + phTitle) valTab.append( CDisplayListItem(phTitle, phTitle, CDisplayListItem.TYPE_CATEGORY, [self.fullUrl(phUrl)], 'seriale-sezon', phImage, None)) printDBG('Host listsItems end') return valTab if 'seriale-sezon' == name: printDBG('Host listsItems begin name=' + name) self.MAIN_URL = 'http://zalukaj.tv' try: data = self.cm.getURLRequestData({ 'url': url, 'use_host': False, 'use_cookie': False, 'use_post': False, 'return_data': True }) except: printDBG('Host listsItems query error') printDBG('Host listsItems query error url:' + url) return valTab #printDBG( 'Host listsItems data: '+data ) phImage = '' parse = re.search('<img src="(.*?)"', data, re.S) if parse: phImage = parse.group(1) printDBG('Host listsItems phImage: ' + phImage) phMovies = re.findall( 'id="sezony".*?>(.*?)<.*?href="(.*?)" title="(.*?)"', data, re.S) if phMovies: for (phEpisode, phUrl, phTitle) in phMovies: printDBG('Host listsItems phEpizod: ' + phEpisode) printDBG('Host listsItems phUrl: ' + phUrl) printDBG('Host listsItems phTitle: ' + phTitle) valTab.append( CDisplayListItem( phEpisode + ' - ' + phTitle, phTitle, CDisplayListItem.TYPE_VIDEO, [CUrlItem('', self.fullUrl(phUrl), 1)], 0, phImage, None)) printDBG('Host listsItems end') return valTab if 'filmy' == name: printDBG('Host listsItems begin name=' + name) self.MAIN_URL = 'http://zalukaj.tv' try: data = self.cm.getURLRequestData({ 'url': url, 'use_host': False, 'use_cookie': False, 'use_post': False, 'return_data': True }) except: printDBG('Host listsItems query error') printDBG('Host listsItems query error url:' + url) return valTab #printDBG( 'Host listsItems data: '+data ) sts, parse = CParsingHelper.getDataBeetwenMarkers( data, '<table id="one"', '</table>', False) phMovies = re.findall( '<td class="wef32f"><a href="([^"]+?)">([^<]+?)</a>', parse, re.S) if phMovies: for (phUrl, phTitle) in phMovies: printDBG('Host listsItems phUrl: ' + phUrl) printDBG('Host listsItems phTitle: ' + phTitle) valTab.append( CDisplayListItem(phTitle, phTitle, CDisplayListItem.TYPE_CATEGORY, [self.fullUrl(phUrl)], 'filmy-clip', '', None)) #valTab.insert(0,CDisplayListItem('--Najpopularniejsze--', 'Najpopularniejsze wyswietlenia-miesiac', CDisplayListItem.TYPE_CATEGORY, ['http://zalukaj.tv/#wyswietlenia-miesiac'], 'filmy-last', '', None)) #valTab.insert(0,CDisplayListItem('--Ostatnio oglądane--', 'Ostatnio oglądane', CDisplayListItem.TYPE_CATEGORY, ['http://zalukaj.tv/#lastseen'], 'filmy-last', '', None)) valTab.insert( 0, CDisplayListItem('--Ostatnio dodane--', 'Ostatnio dodane', CDisplayListItem.TYPE_CATEGORY, ['http://zalukaj.tv'], 'filmy-last', '', None)) printDBG('Host listsItems end') return valTab if 'filmy-clip' == name: printDBG('Host listsItems begin name=' + name) self.MAIN_URL = 'http://zalukaj.tv' try: data = self.cm.getURLRequestData({ 'url': url, 'use_host': False, 'use_cookie': False, 'use_post': False, 'return_data': True }) except: printDBG('Host listsItems query error') printDBG('Host listsItems query error url:' + url) return valTab #printDBG( 'Host listsItems data: '+data ) phMovies = re.findall( 'background-image:url(.*?);"><p><span>(.*?)</span>.*?<h3><a href="(.*?)".*?">(.*?)<.*?">(.*?)<.*?class="few_more">(.*?)<', data, re.S) if phMovies: for (phImage, phRok, phUrl, phTitle, phDescr, phMore) in phMovies: printDBG('Host listsItems phImage: ' + phImage) printDBG('Host listsItems phRok: ' + phRok) printDBG('Host listsItems phUrl: ' + phUrl) printDBG('Host listsItems phTitle: ' + phTitle) printDBG('Host listsItems phDescr: ' + phDescr) printDBG('Host listsItems phMore: ' + phMore) valTab.append( CDisplayListItem( phTitle, phRok + ' | ' + phMore + ' | ' + decodeHtml(phDescr), CDisplayListItem.TYPE_VIDEO, [CUrlItem('', phUrl, 1)], 0, phImage[1:-1], None)) match = re.findall('class="pc_current">.*?href="(.*?)">(.*?)<', data, re.S) if match: phUrl = match[-1][0] phTitle = match[-1][1] valTab.append( CDisplayListItem('Strona ' + phTitle, 'Strona: ' + phUrl, CDisplayListItem.TYPE_CATEGORY, [self.fullUrl(phUrl)], name, '', None)) printDBG('Host listsItems end') return valTab if 'filmy-last' == name: printDBG('Host listsItems begin name=' + name) self.MAIN_URL = 'http://zalukaj.tv' try: data = self.cm.getURLRequestData({ 'url': url, 'use_host': False, 'use_cookie': False, 'use_post': False, 'return_data': True }) except: printDBG('Host listsItems query error') printDBG('Host listsItems query error url:' + url) return valTab #printDBG( 'Host listsItems data: '+data ) phMovies = re.findall( 'class="tivief4".*?src="(.*?)".*?<h3><a href="(.*?)".*?">(.*?)<.*?">(.*?)<.*?class="few_more">(.*?)<', data, re.S) if phMovies: for (phImage, phUrl, phTitle, phDescr, phMore) in phMovies: printDBG('Host listsItems phImage: ' + phImage) printDBG('Host listsItems phUrl: ' + phUrl) printDBG('Host listsItems phTitle: ' + phTitle) printDBG('Host listsItems phDescr: ' + phDescr) printDBG('Host listsItems phMore: ' + phMore) valTab.append( CDisplayListItem( phTitle, phMore + ' | ' + decodeHtml(phDescr), CDisplayListItem.TYPE_VIDEO, [CUrlItem('', self.fullUrl(phUrl), 1)], 0, phImage, None)) printDBG('Host listsItems end') return valTab return valTab