def get_channels(): """ :return: Returns list of all Channels :rtype : list of ChannelItem """ response = json(URL_CHANNEL_LIST.format(apiKey=API_KEY)) return [ChannelItem(channelJson) for channelJson in response['channels']]
def get_channels(): html = _html(HEADER_REFERER) channels = [ChannelItem(el=el) for el in (html.findAll("div", {"class": "div_channel"}))] # Extend Teledunet list with custom hardcoded list created by community channels.extend(__get_hardcoded_streams()) return channels
def get_channels(): html = _html(HEADER_REFERER) channel_divs = lambda soup: soup.findAll( "div", {"class": re.compile("div_channel")}) channels = [ChannelItem(el=el) for el in channel_divs(html)] # Extend Teledunet list with custom hardcoded list created by community channels.extend(__get_hardcoded_streams()) return channels
def get_channels(): loginname=selfAddon.getSetting( "teledunetTvLogin" ) _html(HEADER_REFERER) headers = { "Referer": HEADER_REFERER } html = _html(TELEDUNET_CHANNEL_PAGE,headers) # channel_divs = lambda soup : soup.findAll("div", { "class" : re.compile("div_channel") }) #print html channel_divs = lambda soup : soup.findAll("tr") #print channel_divs channels = [ChannelItem(el=el) for el in channel_divs(html)] # Extend Teledunet list with custom hardcoded list created by community channels.extend(__get_hardcoded_streams()) return channels
def __get_hardcoded_streams(): return [ChannelItem(json=json) for json in HARDCODED_STREAMS]
def get_channels(): #import pickle #import xbmc print 'get channels 1' loginname = selfAddon.getSetting("teledunetTvLogin") # login if not (loginname == None or loginname == ""): performLogin() print 'get channels 2' # _html(HEADER_REFERER) headers = {"Referer": HEADER_REFERER} html = _html(TELEDUNET_CHANNEL_PAGE, headers) print 'get channels 3' # retrieve idu idu = __get_idu(html) channel_divs = lambda soup: (soup.findAll('div', id=re.compile(r'channel_\d+'))) channel_divss = channel_divs(html) #xbmc.log(msg='Before divs count %d' % len(channel_divss), level=xbmc.LOGNOTICE) #xbmc.log(msg='After divs count %d' % len(channel_divss), level=xbmc.LOGNOTICE) #open(r'C:\Users\220554\logs\teledunet.html', 'wb').write(str(html)) #F = open(r'C:\Users\220554\logs\chans_divs', 'wb') #pickle.dump(channel_divss, F) #F.write(str(channel_divss)) channels = [ChannelItem(el=el) for el in channel_divss] print 'get channels 4' free_channels = [] # free_patt = re.compile(r'\(name_channel ?== ?"(.+?)"') free_patt = re.compile(r"free_channels='(.+)'") #free_patt = re.compile(r'^\s*[^/]\|?\|?\(name_channel ?== ?"(.+?)"', flags = re.M) # in the above pattern # ^ : begin of line # \s : This matches any whitespace character : [ \t\n\r\f\v] # [^/] : that does not contain / for commented line # \| : has | (twice) # has (name_channel == " with or without spaces # (.+?) : this is what we capture the channel name that is not commented out # flags = re.M sets the string to be multi-line # free_chans = free_patt.findall(str(html)) match = free_patt.search(str(html)) free_chans = match.group(1).split(',') free_chans.append('teledunet_tv') try: free_chans.remove('') free_chans.remove('') except: pass print free_chans for chan in channels: if chan.path in free_chans: chan.isFree = True free_channels.append(chan) # print '%s free chan'%chan.path else: # print chan.path chan.isFree = False return idu, channels