Esempio n. 1
0
def ChannelsMenu(url):
    oc = ObjectContainer(title2=SITETITLE)

    html = HTML.ElementFromURL(url)

    for item in html.xpath("//table[@class='tborder']//tbody/tr"):
        try:
            # Channel title
            channel = item.xpath(
                "./td[@class='alt1Active']/div[1]/a/strong/text()")[0]
            # Channel link
            link = item.xpath("./td[@class='alt1Active']/div[1]/a/@href")[0]
            if link.startswith("http") == False:
                link = SITEURL + link
        except:
            continue

        try:
            image = common.GetThumb(channel.lower())
        except:
            continue

        if channel.lower() in common.GetSupportedChannels():
            oc.add(
                DirectoryObject(key=Callback(ShowsMenu,
                                             url=link,
                                             title=channel),
                                title=channel,
                                thumb=image))

    # If there are no channels, warn the user
    if len(oc) == 0:
        return ObjectContainer(header=SITETITLE, message=L('ChannelWarning'))

    return oc
Esempio n. 2
0
def ChannelsMenu(url):
	oc = ObjectContainer(title2=SITETITLE)

	html = HTML.ElementFromURL(url)


	for item in html.xpath("//ul[@rel='Main Menu']//li//a"):
		try:
			# Channel title
			channel = item.xpath("text()")[0]

			# Channel link
			link = item.xpath("@href")[0]
			if link.startswith("http") == False:
				link = SITEURL + link
			
			#Log("Channel Link: " + link)
		except:
			continue

		try:
			image = common.GetThumb(channel.lower())
		except:
			continue

		if channel.lower() in common.GetSupportedChannels():
			oc.add(DirectoryObject(key=Callback(ShowsMenu, url=link, title=channel), title=channel, thumb=image))
		
	# If there are no channels, warn the user
	if len(oc) == 0:
		return ObjectContainer(header=SITETITLE, message=L('ChannelWarning'))

	return oc