Example #1
0
def mainPage():
    page = helper.load_page(baseLink + "/videos")

    heroCats = re.compile(
        "<ul id=\"hero_cats\">(.*?</ul><ul id=\"more_cats\">.*?)</ul>",
        re.DOTALL).search(page).group(1)

    items = re.compile(
        "<a href=\"(/videos/category/(.*?))\" class=\".*?\"><span>(.*?)</span></a>"
    ).finditer(heroCats)

    helper.addDirectoryItem("All", {
        "channel": thisChannel,
        "action": "showCategory",
        "link": "/videos"
    })

    for category in items:
        catName = category.group(3)
        catLink = category.group(1)
        catImg = baseLink + "/assets/icons/cats/" + category.group(2).replace(
            "+", "_") + "_normal.png"
        helper.addDirectoryItem(catName, {
            "channel": thisChannel,
            "action": "showCategory",
            "link": catLink
        }, catImg)

    helper.endOfDirectory()
Example #2
0
def showVideos(link):
    link = urllib.unquote(link)
    page = helper.load_page(link)
    extractShowMoreButton = re.compile(
        "<a href=\"(.*?)\" class=\"lite-button\">")
    extractSections = extractSection.findall(page)
    if len(extractSections) == 1:
        showVideosSection(link, extractSections[0][0])
        return False
    else:
        for section in extractSections:
            sectionLink = link
            sectionTitle = section[0]
            sectionHtml = section[1]
            showMoreButton = extractShowMoreButton.search(sectionHtml)
            sectionLinkSection = sectionTitle
            if showMoreButton is not None:
                sectionLink = baseLink + showMoreButton.group(1)
                sectionLinkSection = "/"
            helper.addDirectoryItem(
                sectionTitle, {
                    "channel": thisChannel,
                    "action": "showVideosSection",
                    "link": sectionLink,
                    "section": sectionLinkSection
                }, "")

    helper.endOfDirectory()
def showVideos(feedUrl):
    feed = helper.load_page(urllib.unquote(feedUrl))

    media = helper.extractMrss(feed)

    for video in media:
        parameters = {
            "channel": thisChannel,
            "action": "playVideo",
            "link": video['url']
        }
        helper.addDirectoryItem(video['title'],
                                parameters,
                                video['img'],
                                False,
                                duration=video['duration'],
                                plot=video['plot'])

    #Next page
    extractNextPage = re.compile(
        "<atom:link rel=\"next\" href=\"(.*)\" />").search(feed)
    if extractNextPage is not None:
        helper.addDirectoryItem(
            "Show more", {
                "channel": thisChannel,
                "action": "showVideos",
                "link": extractNextPage.group(1)
            }, "")

    helper.endOfDirectory()
def mainPage():
    page = helper.load_page(baseLink)
    extractShow = re.compile(
        "<a href=\"(.*?)\" target=\"_self\"><img src=\"(.*?)\".*?alt=\"Watch (.*?) on KidMango.com!\" /></a>"
    )

    for show in extractShow.finditer(page):
        link = show.group(1).replace("comtinpo", "com/tinpo")
        print link
        page = urllib.urlopen(link)
        if page.getcode() != 404:
            page = page.read()
            extractContentId = re.compile("contentId : '([0-9]*)',").search(
                page)
            if extractContentId is not None:
                contentId = extractContentId.group(1)
                feedUrl = "http://cms.springboard.gorillanation.com/xml_feeds_advanced/index/891/rss1/" + contentId + "/"
                helper.addDirectoryItem(
                    show.group(3), {
                        "channel": thisChannel,
                        "action": "showVideos",
                        "link": feedUrl
                    }, show.group(2))

    helper.endOfDirectory()
def subPageXml(link, action="videoPage"):
    if action == "videoPage":
        nextAction = "subPageXml"
        isFolder = True
    elif action == "playVideo":
        nextAction = "videoPageXml"
        isFolder = False

    xmlPage = helper.load_page(link)
    xmlDom = minidom.parseString(xmlPage)
    for sprite in xmlDom.getElementsByTagName("sprite"):
        if sprite.getAttribute("class") == "com.disney.disneyjunior.classes.sprites.TileAsset video":
            menu_name = sprite.getElementsByTagName("text")[0].firstChild.data
            menu_name = helper.removeTags(menu_name)
            menu_link = sprite.getElementsByTagName("a")[0].getAttribute("href")
            menu_img = sprite.getElementsByTagName("img")[0].getAttribute("src")
            parameters = {"channel":thisChannel, "action":action, "link":menu_link}
            helper.addDirectoryItem(menu_name,parameters,menu_img,folder=isFolder)
    
    menuNode = xmlDom.getElementById("next")
    for a in xmlDom.getElementsByTagName("a"):
        if a.getAttribute("id") == "next":
            parameters = {"channel":thisChannel, "action":nextAction, "link":a.getAttribute("href")}
            helper.addDirectoryItem("Next page",parameters)
    
    helper.endOfDirectory()
def showSubMenu(level1=-1):
    page = helper.load_page(baseLink)
    mainMenu = extractMenu(page)

    if level1 == -1:
        menu = mainMenu
    else:
        menu = mainMenu[int(level1)]['children']

    counter = 0
    for menuItem in menu:
        menu_name = menuItem['name']

        menu_link = menuItem['link']
        if len(menuItem['children']):
            helper.addDirectoryItem(menuItem['name'], {
                "channel": thisChannel,
                "action": "showSubMenu",
                "link": counter
            })
        else:
            helper.addDirectoryItem(menuItem['name'], {
                "channel": thisChannel,
                "action": "showVideos",
                "link": menu_link
            })
        counter = counter + 1

    helper.endOfDirectory()
def showVideos(link):
    link = urllib.unquote(link)
    page = helper.load_page(link)
    extractShowMoreButton = re.compile('<a href="(.*?)" class="lite-button">')
    extractSections = extractSection.findall(page)
    if len(extractSections) == 1:
        showVideosSection(link, extractSections[0][0])
        return False
    else:
        for section in extractSections:
            sectionLink = link
            sectionTitle = section[0]
            sectionHtml = section[1]
            showMoreButton = extractShowMoreButton.search(sectionHtml)
            sectionLinkSection = sectionTitle
            if showMoreButton is not None:
                sectionLink = baseLink + showMoreButton.group(1)
                sectionLinkSection = "/"
            helper.addDirectoryItem(
                sectionTitle,
                {
                    "channel": thisChannel,
                    "action": "showVideosSection",
                    "link": sectionLink,
                    "section": sectionLinkSection,
                },
                "",
            )

    helper.endOfDirectory()
def mainPage():
    menu_link = "http://disney.go.com/disneyjunior/data/tilePack?id=1815104&maxAmount=12&index=0"
    helper.addDirectoryItem("By Character", {
        "channel": thisChannel,
        "action": "subPageXml",
        "link": menu_link
    })

    menu_link = "http://disney.go.com/disneyjunior/data/tilePack?id=1815106&maxAmount=12&index=0"
    helper.addDirectoryItem("Full Episodes", {
        "channel": thisChannel,
        "action": "videoPageXml",
        "link": menu_link
    })

    menu_link = "http://disney.go.com/disneyjunior/data/tilePack?id=1815107&maxAmount=12&index=0"
    helper.addDirectoryItem("Short Videos", {
        "channel": thisChannel,
        "action": "videoPageXml",
        "link": menu_link
    })

    menu_link = "http://disney.go.com/disneyjunior/data/tilePack?id=1815108&maxAmount=12&index=0"
    helper.addDirectoryItem("Music Videos", {
        "channel": thisChannel,
        "action": "videoPageXml",
        "link": menu_link
    })

    helper.endOfDirectory()
Example #9
0
def showVideosSection(link, section):
    link = urllib.unquote(link)
    showSection = urllib.unquote_plus(section)
    
    page = helper.load_page(link)
    
    extractVideo = re.compile("<section class=\".*?\">.*?<img src=\"(.*?)\".*?<a href=\"(.*?)\" class=\"title\">(.*?)</a>.*?<p>(.*?)</p>.*?<span class=\"content-item-short-description\">(.*?)</span>.*?</section>", re.DOTALL)

    sectionHtml = "";
    
    if showSection != "":
        extractSections = extractSection.finditer(page)
        for section in extractSections:
            sectionTitle = section.group(1)
            if sectionTitle == showSection:
                sectionHtml = section.group(2)
    else:
        sectionHtml = page

    for video in extractVideo.finditer(sectionHtml):
        videoTitle = video.group(3) + " (" + video.group(4).strip() + ")"
        videoImg = baseLink + video.group(1)
        videoLink = baseLink + video.group(2)
        videoPlot = video.group(5)
        helper.addDirectoryItem(videoTitle, {"channel":thisChannel, "action":"playVideo", "link":videoLink}, videoImg, False,plot=videoPlot)

    helper.endOfDirectory()
def mainPage():
	for channel in channels:
		enabled = xbmcplugin.getSetting(thisPlugin,'channel_'+channel[1])
		if enabled == "true":
			print enabled
			channelPic = os.path.join(addonpath,'resources','images',channel[1]+'.png')
			helper.addDirectoryItem(channel[0],{"channel":channel[1]}, channelPic)
	helper.endOfDirectory()
Example #11
0
def videoPageXml(link, start, showName):
    xmlPage = helper.load_page(link)
    xmlDom = minidom.parseString(xmlPage)
    for release in xmlDom.getElementsByTagName("Release"):
        titles = release.getElementsByTagName("title")
        menu_name = release.getElementsByTagName("title")[len(titles) -
                                                          1].firstChild.data
        clip = ""
        for customData in release.getElementsByTagName("CustomDataElement"):
            if customData.getElementsByTagName(
                    "title")[0].firstChild.data == "Episode_Title":
                if customData.getElementsByTagName(
                        "value")[0].firstChild is not None:
                    menu_name = customData.getElementsByTagName(
                        "value")[0].firstChild.data
            if customData.getElementsByTagName(
                    "title")[0].firstChild.data == "IsClip":
                if customData.getElementsByTagName(
                        "value")[0].firstChild.data == "true":
                    clip = " (Clip)"
        menu_name = menu_name + clip
        menu_link = release.getElementsByTagName("URL")[0].firstChild.data
        menu_img = ""
        if release.getElementsByTagName(
                "thumbnailURL")[0].firstChild is not None:
            menu_img = release.getElementsByTagName(
                "thumbnailURL")[0].firstChild.data
        menu_duration = str(
            int(release.getElementsByTagName("length")[0].firstChild.data) /
            1000 / 60)
        parameters = {
            "channel": thisChannel,
            "action": "playVideo",
            "link": menu_link
        }
        helper.addDirectoryItem(menu_name,
                                parameters,
                                menu_img,
                                folder=False,
                                duration=menu_duration)

    total_count = int(
        xmlDom.getElementsByTagName("totalCount")[0].firstChild.data)
    if int(start) + 20 < total_count:
        menu_link = videoPageLink % (str(int(start) + 20),
                                     str(int(start) + 40), showName, affiliate,
                                     player, playerQuery)
        parameters = {
            "channel": thisChannel,
            "action": "videoPageXml",
            "link": menu_link,
            "start": str(int(start) + 20),
            "name": showName
        }
        helper.addDirectoryItem("Show more", parameters)
    helper.endOfDirectory()
Example #12
0
def showVideos(id):
    feedLink = releasesFeedLink+id
    page = helper.load_page(feedLink)
    data = json.loads(page)
    for releaseItem in data['items']:
        length = str(int(releaseItem['length'])/1000/60)
        parameters = {"channel":thisChannel, "action" : "playVideo", "link": releaseItem['URL']}
        helper.addDirectoryItem(releaseItem['title'], parameters, releaseItem['thumbnailURL'],False,duration=length)
    
    helper.endOfDirectory()
def mainPage():
    for channel in channels:
        enabled = xbmcplugin.getSetting(thisPlugin, 'channel_' + channel[1])
        if enabled == "true":
            print enabled
            channelPic = os.path.join(addonpath, 'resources', 'images',
                                      channel[1] + '.png')
            helper.addDirectoryItem(channel[0], {"channel": channel[1]},
                                    channelPic)
    helper.endOfDirectory()
def mainPage():
    menu_link = mainPageLink % ("Show", customBoolean)
    helper.addDirectoryItem("Shows", {"channel": thisChannel, "action": "subPageXml", "link": menu_link})

    menu_link = mainPageLink % ("Channel", customBoolean)
    helper.addDirectoryItem("Channels", {"channel": thisChannel, "action": "subPageXml", "link": menu_link})

    menu_link = ""
    helper.addDirectoryItem("New", {"channel": thisChannel, "action": "videoPageXml", "link": menu_link})

    helper.endOfDirectory()
def showVideos(link):
    link ="http://media.treehousetv.com/videos.ashx?c="+urllib.unquote(link)
    page = helper.load_page(link)
    data = json.loads(page)
        
    for video in data:
        menu_link = video["Id"]
        menu_name = video["Name"]
        menu_img = video["ThumbnailURL"]
        parameters = {"channel":thisChannel,"action":"playVideo","link":menu_link}
        helper.addDirectoryItem(menu_name, parameters, menu_img, folder=False)

    helper.endOfDirectory()
def mainPage():
    page = helper.load_page(apiLink%("kids-video-landing"))
    
    data = json.loads(page)
    items = data['config']['promos'][0]['items']

    for category in items:
        catName = helper.removeHtmlSpecialChars(category['title'])
        catLink = apiLink%(category['urlAlias'])
        catImg =  baseLink+category['thumbnail'];
        helper.addDirectoryItem(catName, {"channel":thisChannel,"action":"showCategory","link":catLink}, catImg)

    helper.endOfDirectory()
Example #17
0
def mainPage():
    helper.addDirectoryItem(
        "Videos", {
            "channel": thisChannel,
            "action": "showVideos",
            "link": baseLink + "videos"
        }, "")
    helper.addDirectoryItem("Shows", {
        "channel": thisChannel,
        "action": "showShows",
        "link": baseLink + "shows"
    }, "")
    helper.endOfDirectory()
Example #18
0
def showSubMenu(feedLink):
    page = helper.load_page(feedLink)
    data = json.loads(page)
    
    for categoryItem in data['items']:
        action = "showCategory"
        if categoryItem['hasChildren'] == False:
            action = "showVideos"
        print categoryItem['title']
        print categoryItem['ID']
        parameters = {"channel":thisChannel, "action" : action, "link": categoryItem['ID']}
        helper.addDirectoryItem(categoryItem['title'], parameters, categoryItem['thumbnailURL'])
        
    helper.endOfDirectory()
def mainPage():
    menu_link = "http://disney.go.com/disneyjunior/data/tilePack?id=1815104&maxAmount=12&index=0"
    helper.addDirectoryItem("By Character",{"channel":thisChannel, "action":"subPageXml", "link":menu_link})
    
    menu_link = "http://disney.go.com/disneyjunior/data/tilePack?id=1815106&maxAmount=12&index=0"
    helper.addDirectoryItem("Full Episodes",{"channel":thisChannel, "action":"videoPageXml", "link":menu_link})

    menu_link = "http://disney.go.com/disneyjunior/data/tilePack?id=1815107&maxAmount=12&index=0"
    helper.addDirectoryItem("Short Videos",{"channel":thisChannel, "action":"videoPageXml", "link":menu_link})

    menu_link = "http://disney.go.com/disneyjunior/data/tilePack?id=1815108&maxAmount=12&index=0"
    helper.addDirectoryItem("Music Videos",{"channel":thisChannel, "action":"videoPageXml", "link":menu_link})

    helper.endOfDirectory()
Example #20
0
def showShows(link):
    page = helper.load_page(urllib.unquote(link))
    
    extractShow = re.compile("<section class=\".*?content-item-vertical.*?\">.*?<div class=\"thumbimg\">.*?src=\"(.*?)\".*?href=\"(.*?)\".*?>(.*?)</a>", re.DOTALL)
    
    for show in extractShow.finditer(page):
        showImg = baseLink + show.group(1)
        showLink = baseLink + show.group(2) + "/videos"
        showTitle = show.group(3)
        
        showPage = urllib.urlopen(showLink)
        if showLink == showPage.geturl():
            if extractSection.search(showPage.read()) is not None:
                helper.addDirectoryItem(showTitle, {"channel":thisChannel, "action":"showVideos", "link":showLink}, showImg)
    helper.endOfDirectory()
Example #21
0
def showVideos(link):
    page = helper.load_page(urllib.unquote(link))
    extractVideos = re.compile("<ul id=\"videoList_ul\">(.*?)</ul>",re.DOTALL)
    extractVideo = re.compile("<li class=\"vidItem [a-z]*\" id=\"video_(.*?)\".*?src=\"(.*?)\".*?<span id=\".*?\">(.*?)</span>",re.DOTALL)
    
    videos = extractVideos.search(page).group(1)
    
    for video in extractVideo.finditer(videos):
        menu_link = video.group(1)
        menu_name = helper.removeHtmlSpecialChars(video.group(3))
        menu_img = video.group(2)
        parameters = {"channel":thisChannel,"action":"playVideo","link":menu_link}
        helper.addDirectoryItem(menu_name, parameters, menu_img, folder=False)

    helper.endOfDirectory()
def showVideos(feedUrl):
	feed = helper.load_page(urllib.unquote(feedUrl))
	
	media = helper.extractMrss(feed)

   	for video in media:
   		parameters = {"channel":thisChannel,"action":"playVideo","link":video['url']}
   		helper.addDirectoryItem(video['title'], parameters, video['img'], False, duration=video['duration'], plot=video['plot'])
	
	#Next page
	extractNextPage = re.compile("<atom:link rel=\"next\" href=\"(.*)\" />").search(feed)
	if extractNextPage is not None:
		helper.addDirectoryItem("Show more", {"channel":thisChannel,"action":"showVideos","link":extractNextPage.group(1)}, "")
	
	helper.endOfDirectory()
Example #23
0
def mainPage():
    page = helper.load_page(baseLink+"/video")
    extractChannels = re.compile("<ul id=\"channelCarousel_ul\">(.*?)</ul>",re.DOTALL)
    extractChannel = re.compile("<a href=\"(.*?)\".*?alt=\"(.*?)\" src=\"(.*?)\"",re.DOTALL)
    
    channels = extractChannels.search(page).group(1)
    
    for channel in extractChannel.finditer(channels):
        menu_link = baseLink+channel.group(1)
        menu_name = channel.group(2)
        menu_img = baseLink+channel.group(3)
        parameters = {"channel":thisChannel,"action":"showVideos","link":menu_link}
        helper.addDirectoryItem(menu_name, parameters, menu_img)

    helper.endOfDirectory()
def showCategory(link):
    page = helper.load_page(urllib.unquote(link))
    
    page = page.replace("\xED","\xc3\xad")
    
    data = json.loads(page)
    items = data['config']['promos'][0]['items']
    
    for video in items:
        vidName = helper.removeHtmlSpecialChars(video['title'])
        vidId = video['id']
        vidImg =  video['thumbnail']
        
        helper.addDirectoryItem(vidName, {"channel":thisChannel,"action":"playVideo","link":vidId}, vidImg, False)

    helper.endOfDirectory()
Example #25
0
def mainPage():
    page = helper.load_page(baseLink + "/videos")
    
    heroCats = re.compile("<ul id=\"hero_cats\">(.*?</ul><ul id=\"more_cats\">.*?)</ul>", re.DOTALL).search(page).group(1)
    
    items = re.compile("<a href=\"(/videos/category/(.*?))\" class=\".*?\"><span>(.*?)</span></a>").finditer(heroCats)
    
    helper.addDirectoryItem("All", {"channel":thisChannel, "action":"showCategory", "link":"/videos"})
    
    for category in items:
        catName = category.group(3)
        catLink = category.group(1)
        catImg = baseLink + "/assets/icons/cats/" + category.group(2).replace("+", "_") + "_normal.png"
        helper.addDirectoryItem(catName, {"channel":thisChannel, "action":"showCategory", "link":catLink}, catImg)

    helper.endOfDirectory()
Example #26
0
def mainPage():
    page = helper.load_page(apiLink % ("kids-video-landing"))

    data = json.loads(page)
    items = data['config']['promos'][0]['items']

    for category in items:
        catName = helper.removeHtmlSpecialChars(category['title'])
        catLink = apiLink % (category['urlAlias'])
        catImg = baseLink + category['thumbnail']
        helper.addDirectoryItem(catName, {
            "channel": thisChannel,
            "action": "showCategory",
            "link": catLink
        }, catImg)

    helper.endOfDirectory()
def mainPage():
	page = helper.load_page(baseLink)
	extractShow = re.compile("<a href=\"(.*?)\" target=\"_self\"><img src=\"(.*?)\".*?alt=\"Watch (.*?) on KidMango.com!\" /></a>")
	
	for show in extractShow.finditer(page):
		link = show.group(1).replace("comtinpo","com/tinpo")
		print link
		page = urllib.urlopen(link)
		if page.getcode() != 404:
			page =page.read()
			extractContentId = re.compile("contentId : '([0-9]*)',").search(page)
			if extractContentId is not None:
				contentId = extractContentId.group(1)
				feedUrl = "http://cms.springboard.gorillanation.com/xml_feeds_advanced/index/891/rss1/"+contentId+"/"
				helper.addDirectoryItem(show.group(3), {"channel":thisChannel,"action":"showVideos","link":feedUrl}, show.group(2))

	helper.endOfDirectory()
def showVideos(link):
    link = "http://media.treehousetv.com/videos.ashx?c=" + urllib.unquote(link)
    page = helper.load_page(link)
    data = json.loads(page)

    for video in data:
        menu_link = video["Id"]
        menu_name = video["Name"]
        menu_img = video["ThumbnailURL"]
        parameters = {
            "channel": thisChannel,
            "action": "playVideo",
            "link": menu_link
        }
        helper.addDirectoryItem(menu_name, parameters, menu_img, folder=False)

    helper.endOfDirectory()
Example #29
0
def mainPage():
    xmlPage = helper.load_page(link)
    xmlDom = minidom.parseString(xmlPage)
    
    for entry in xmlDom.getElementsByTagName("entry"):
        youtubeUrl = entry.getElementsByTagName("id")[0].firstChild.data
        youtubeId = youtubeUrl[youtubeUrl.rfind("/")+1:]
        title = entry.getElementsByTagName("title")[0].firstChild.data

        descirption = entry.getElementsByTagName("content")[0].firstChild.data
        img = entry.getElementsByTagName("media:thumbnail")[0].getAttribute("url")
        videoDuration = entry.getElementsByTagName("media:content")[0].getAttribute("duration")
        videoDuration = str(int(videoDuration)/60)
        
        parameters = {"channel":thisChannel,"action":"playVideo","id":youtubeId}
        helper.addDirectoryItem(title, parameters, img, False, plot=descirption, duration=videoDuration)
        
    helper.endOfDirectory()
def videoPageXml(link, start, showName):
    xmlPage = helper.load_page(link)
    xmlDom = minidom.parseString(xmlPage)
    for release in xmlDom.getElementsByTagName("Release"):
        titles = release.getElementsByTagName("title")
        menu_name = release.getElementsByTagName("title")[len(titles) - 1].firstChild.data
        clip = ""
        for customData in release.getElementsByTagName("CustomDataElement"):
            if customData.getElementsByTagName("title")[0].firstChild.data == "Episode_Title":
                if customData.getElementsByTagName("value")[0].firstChild is not None:
                    menu_name = customData.getElementsByTagName("value")[0].firstChild.data
            if customData.getElementsByTagName("title")[0].firstChild.data == "IsClip":
                if customData.getElementsByTagName("value")[0].firstChild.data == "true":
                    clip = " (Clip)"
        menu_name = menu_name + clip
        menu_link = release.getElementsByTagName("URL")[0].firstChild.data
        menu_img = ""
        if release.getElementsByTagName("thumbnailURL")[0].firstChild is not None:
            menu_img = release.getElementsByTagName("thumbnailURL")[0].firstChild.data
        menu_duration = str(int(release.getElementsByTagName("length")[0].firstChild.data) / 1000 / 60)
        parameters = {"channel": thisChannel, "action": "playVideo", "link": menu_link}
        helper.addDirectoryItem(menu_name, parameters, menu_img, folder=False, duration=menu_duration)

    total_count = int(xmlDom.getElementsByTagName("totalCount")[0].firstChild.data)
    if int(start) + 20 < total_count:
        menu_link = videoPageLink % (
            str(int(start) + 20),
            str(int(start) + 40),
            showName,
            affiliate,
            player,
            playerQuery,
        )
        parameters = {
            "channel": thisChannel,
            "action": "videoPageXml",
            "link": menu_link,
            "start": str(int(start) + 20),
            "name": showName,
        }
        helper.addDirectoryItem("Show more", parameters)
    helper.endOfDirectory()
def subPageXml(link):
    xmlPage = helper.load_page(link)
    xmlDom = minidom.parseString(xmlPage)
    for category in xmlDom.getElementsByTagName("Category"):
        menu_name = category.getElementsByTagName("fullTitle")[0].firstChild.data
        menu_link = videoPageLink % ("1", "20", menu_name, affiliate, player, playerQuery)
        menu_img = ""
        menuImgItem = category.getElementsByTagName("CustomDataElement")[0].getElementsByTagName("value")[0].firstChild
        if menuImgItem is not None:
            menu_img = menuImgItem.data
        parameters = {
            "channel": thisChannel,
            "action": "videoPageXml",
            "link": menu_link,
            "start": "1",
            "name": menu_name,
        }
        helper.addDirectoryItem(menu_name, parameters, menu_img, folder=True)

    helper.endOfDirectory()
Example #32
0
def showCategory(link):
    page = helper.load_page(urllib.unquote(link))

    page = page.replace("\xED", "\xc3\xad")

    data = json.loads(page)
    items = data['config']['promos'][0]['items']

    for video in items:
        vidName = helper.removeHtmlSpecialChars(video['title'])
        vidId = video['id']
        vidImg = video['thumbnail']

        helper.addDirectoryItem(vidName, {
            "channel": thisChannel,
            "action": "playVideo",
            "link": vidId
        }, vidImg, False)

    helper.endOfDirectory()
def subPageXml(link, action="videoPage"):
    if action == "videoPage":
        nextAction = "subPageXml"
        isFolder = True
    elif action == "playVideo":
        nextAction = "videoPageXml"
        isFolder = False

    xmlPage = helper.load_page(link)
    xmlDom = minidom.parseString(xmlPage)
    for sprite in xmlDom.getElementsByTagName("sprite"):
        if sprite.getAttribute(
                "class"
        ) == "com.disney.disneyjunior.classes.sprites.TileAsset video":
            menu_name = sprite.getElementsByTagName("text")[0].firstChild.data
            menu_name = helper.removeTags(menu_name)
            menu_link = sprite.getElementsByTagName("a")[0].getAttribute(
                "href")
            menu_img = sprite.getElementsByTagName("img")[0].getAttribute(
                "src")
            parameters = {
                "channel": thisChannel,
                "action": action,
                "link": menu_link
            }
            helper.addDirectoryItem(menu_name,
                                    parameters,
                                    menu_img,
                                    folder=isFolder)

    menuNode = xmlDom.getElementById("next")
    for a in xmlDom.getElementsByTagName("a"):
        if a.getAttribute("id") == "next":
            parameters = {
                "channel": thisChannel,
                "action": nextAction,
                "link": a.getAttribute("href")
            }
            helper.addDirectoryItem("Next page", parameters)

    helper.endOfDirectory()
Example #34
0
def mainPage():
    page = helper.load_page(baseLink + "/video")
    extractChannels = re.compile("<ul id=\"channelCarousel_ul\">(.*?)</ul>",
                                 re.DOTALL)
    extractChannel = re.compile(
        "<a href=\"(.*?)\".*?alt=\"(.*?)\" src=\"(.*?)\"", re.DOTALL)

    channels = extractChannels.search(page).group(1)

    for channel in extractChannel.finditer(channels):
        menu_link = baseLink + channel.group(1)
        menu_name = channel.group(2)
        menu_img = baseLink + channel.group(3)
        parameters = {
            "channel": thisChannel,
            "action": "showVideos",
            "link": menu_link
        }
        helper.addDirectoryItem(menu_name, parameters, menu_img)

    helper.endOfDirectory()
Example #35
0
def showVideos(link):
    page = helper.load_page(urllib.unquote(link))
    extractVideos = re.compile("<ul id=\"videoList_ul\">(.*?)</ul>", re.DOTALL)
    extractVideo = re.compile(
        "<li class=\"vidItem [a-z]*\" id=\"video_(.*?)\".*?src=\"(.*?)\".*?<span id=\".*?\">(.*?)</span>",
        re.DOTALL)

    videos = extractVideos.search(page).group(1)

    for video in extractVideo.finditer(videos):
        menu_link = video.group(1)
        menu_name = helper.removeHtmlSpecialChars(video.group(3))
        menu_img = video.group(2)
        parameters = {
            "channel": thisChannel,
            "action": "playVideo",
            "link": menu_link
        }
        helper.addDirectoryItem(menu_name, parameters, menu_img, folder=False)

    helper.endOfDirectory()
def showSubMenu(level1=-1):
    page = helper.load_page(baseLink)
    mainMenu = extractMenu(page)
    
    if level1 == -1:
        menu = mainMenu
    else:
        menu = mainMenu[int(level1)]['children']
    
    counter = 0
    for menuItem in menu:
        menu_name = menuItem['name'];
        
        menu_link = menuItem['link'];
        if len(menuItem['children']):
            helper.addDirectoryItem(menuItem['name'], {"channel":thisChannel, "action" : "showSubMenu", "link": counter})   
        else:        
            helper.addDirectoryItem(menuItem['name'], {"channel":thisChannel, "action" : "showVideos", "link": menu_link})
        counter = counter + 1
    
    helper.endOfDirectory()
Example #37
0
def showCategory(link):
    page = helper.load_page(baseLink+urllib.unquote(link))

    extractVideos = re.compile("<div class=\"peepshow\">.*?<a href=\"(.*?)\">(.*?)</a>.*?<img.*?src=\"(.*?)\".*?<p>(.*?)</p>",re.DOTALL)
    
    for video in extractVideos.finditer(page):
        vidName = video.group(2)
        vidName = helper.removeHtmlSpecialChars(vidName)
        vidLink = video.group(1)
        vidImg = video.group(3)
        vidPlot = video.group(4)
        parameters = {"channel":thisChannel, "action":"playVideo", "link":vidLink}
        helper.addDirectoryItem(vidName, parameters, vidImg, False, plot=vidPlot)
        
    extractNextPage = re.compile("<li class=\"next\"><a href=\"(.*?)\" rel=\"next\">Next")
    
    nextPage = extractNextPage.search(page)
    
    if nextPage is not None:
        helper.addDirectoryItem("Show more", {"channel":thisChannel, "action":"showCategory", "link":nextPage.group(1)})
    
    helper.endOfDirectory()
Example #38
0
def showCategory(link):
    page = helper.load_page(baseLink + urllib.unquote(link))

    extractVideos = re.compile(
        "<div class=\"peepshow\">.*?<a href=\"(.*?)\">(.*?)</a>.*?<img.*?src=\"(.*?)\".*?<p>(.*?)</p>",
        re.DOTALL)

    for video in extractVideos.finditer(page):
        vidName = video.group(2)
        vidName = helper.removeHtmlSpecialChars(vidName)
        vidLink = video.group(1)
        vidImg = video.group(3)
        vidPlot = video.group(4)
        parameters = {
            "channel": thisChannel,
            "action": "playVideo",
            "link": vidLink
        }
        helper.addDirectoryItem(vidName,
                                parameters,
                                vidImg,
                                False,
                                plot=vidPlot)

    extractNextPage = re.compile(
        "<li class=\"next\"><a href=\"(.*?)\" rel=\"next\">Next")

    nextPage = extractNextPage.search(page)

    if nextPage is not None:
        helper.addDirectoryItem(
            "Show more", {
                "channel": thisChannel,
                "action": "showCategory",
                "link": nextPage.group(1)
            })

    helper.endOfDirectory()
Example #39
0
def mainPage():
    menu_link = mainPageLink % ("Show", customBoolean)
    helper.addDirectoryItem("Shows", {
        "channel": thisChannel,
        "action": "subPageXml",
        "link": menu_link
    })

    menu_link = mainPageLink % ("Channel", customBoolean)
    helper.addDirectoryItem("Channels", {
        "channel": thisChannel,
        "action": "subPageXml",
        "link": menu_link
    })

    menu_link = ""
    helper.addDirectoryItem("New", {
        "channel": thisChannel,
        "action": "videoPageXml",
        "link": menu_link
    })

    helper.endOfDirectory()
Example #40
0
def subPageXml(link):
    xmlPage = helper.load_page(link)
    xmlDom = minidom.parseString(xmlPage)
    for category in xmlDom.getElementsByTagName("Category"):
        menu_name = category.getElementsByTagName(
            "fullTitle")[0].firstChild.data
        menu_link = videoPageLink % ("1", "20", menu_name, affiliate, player,
                                     playerQuery)
        menu_img = ""
        menuImgItem = category.getElementsByTagName(
            "CustomDataElement")[0].getElementsByTagName("value")[0].firstChild
        if menuImgItem is not None:
            menu_img = menuImgItem.data
        parameters = {
            "channel": thisChannel,
            "action": "videoPageXml",
            "link": menu_link,
            "start": "1",
            "name": menu_name
        }
        helper.addDirectoryItem(menu_name, parameters, menu_img, folder=True)

    helper.endOfDirectory()
def mainPage():
    helper.addDirectoryItem("Videos", {"channel":thisChannel, "action":"showVideos", "link":baseLink + "videos"}, "")
    helper.addDirectoryItem("Shows", {"channel":thisChannel, "action":"showShows", "link":baseLink + "shows"}, "")
    helper.endOfDirectory()
Example #42
0
def mainPage():
	for channel in channels:
		channelPic = os.path.join(addonpath,'resources','images',channel[1]+'.png')
		helper.addDirectoryItem(channel[0],{"channel":channel[1]}, channelPic)
	helper.endOfDirectory()