def play(url=None):
    if not url:
        url = Common.args.url
    data = Common.getURL(url)
    if 'nayakhabar' in url:
        travlink = re.compile('a href="(http://www.canadanepal.+?)".+?<strong>').findall(data)
        if travlink:
            travlink = travlink[0]
            data = Common.getURL(travlink)
    post = common.parseDOM(data, "div", attrs={ "class": "post" })[0]
    Title = common.parseDOM(post, "h2", attrs={ "class": "title"})[0]
    Title = common.replaceHTMLCodes(Title)
    Title = Title.encode('utf-8')
    entry = common.parseDOM(post, "div", attrs={ "class": "entry"})[0]
    # Resolve media url using videohosts
    videoUrl = None
    videoUrl = hosts.resolve(entry)
     
    if not videoUrl:
        dialog = xbmcgui.Dialog()
        dialog.ok('Nothing to play', 'A playable url could not be found.')
        return                
    else:
        #print videoUrl
        playList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
        playList.clear()
        count = 1
        for PlayItem in videoUrl:
            Title = Title + ' Part ' + str(count)
            listitem = ListItem(Title, iconImage='', thumbnailImage='')
            listitem.setInfo('video', { 'Title': Title})
            playList.add(url=PlayItem, listitem=listitem)
            count = count + 1
        xbmcPlayer = xbmc.Player()
        xbmcPlayer.play(playList)
def play(url=None):
    if not url:
        url = Common.args.url
    data = Common.fetch(url)
    panel = common.parseDOM(data, "div", attrs={"class": "panel"})[0]
    Title = re.compile("<h3>Daily Link : (.+?) on").findall(data)
    if Title:
        Title = Title[0]
        Title = common.replaceHTMLCodes(Title)
        Title = Title.encode("utf-8")
    else:
        Title = "Video"
    # Resolve media url using videohosts
    videoUrl = None
    videoUrl = hosts.resolve(panel)
    if not videoUrl:
        dialog = xbmcgui.Dialog()
        dialog.ok("Nothing to play", "A playable url could not be found.")
        return
    else:
        # print videoUrl
        playList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
        playList.clear()
        count = 1
        for PlayItem in videoUrl:
            Title = Title + " Part " + str(count)
            listitem = ListItem(Title, iconImage="", thumbnailImage="")
            listitem.setInfo("video", {"Title": Title})
            playList.add(url=PlayItem, listitem=listitem)
            count = count + 1
        xbmcPlayer = xbmc.Player()
        xbmcPlayer.play(playList)
Exemple #3
0
def play(url=None):
    if not url:
        url = Common.args.url
    data = Common.fetch(url)
    panel = common.parseDOM(data, "div", attrs={"class": "panel"})[0]
    Title = re.compile('<h3>Daily Link : (.+?) on').findall(data)
    if Title:
        Title = Title[0]
        Title = common.replaceHTMLCodes(Title)
        Title = Title.encode('utf-8')
    else:
        Title = 'Video'
    # Resolve media url using videohosts
    videoUrl = None
    videoUrl = hosts.resolve(panel)
    if not videoUrl:
        dialog = xbmcgui.Dialog()
        dialog.ok('Nothing to play', 'A playable url could not be found.')
        return
    else:
        #print videoUrl
        playList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
        playList.clear()
        count = 1
        for PlayItem in videoUrl:
            Title = Title + ' Part ' + str(count)
            listitem = ListItem(Title, iconImage='', thumbnailImage='')
            listitem.setInfo('video', {'Title': Title})
            playList.add(url=PlayItem, listitem=listitem)
            count = count + 1
        xbmcPlayer = xbmc.Player()
        xbmcPlayer.play(playList)
def play(url=None):
    if not url:
        url = Common.args.url
    data = Common.getURL(url)
    videoborderbox = common.parseDOM(data, "div", attrs={ "id": "videoarea" })[0]
    Title = common.parseDOM(videoborderbox, "div", {"id": "videotitle"})[0]
    Title = common.replaceHTMLCodes(Title)
    Title = Title.encode('utf-8')
    videoplayer = common.parseDOM(videoborderbox, "div", attrs={ "id": "videodisplay"})[0]
    # Resolve media url using videohosts
    videoUrl = None
    videoUrl = hosts.resolve(videoplayer)
    #videoUrl = None 
    if not videoUrl:
        dialog = xbmcgui.Dialog()
        dialog.ok('Nothing to play', 'A playable url could not be found.')
        return                
    else:
        #print videoUrl
        playList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
        playList.clear()
        count = 1
        for PlayItem in videoUrl:
            Title = Title + ' Part ' + str(count)
            listitem = ListItem(Title, iconImage='', thumbnailImage='')
            listitem.setInfo('video', { 'Title': Title})
            playList.add(url=PlayItem, listitem=listitem)
            count = count + 1
        xbmcPlayer = xbmc.Player()
        xbmcPlayer.play(playList)
def play(url=None):
    if not url:
        url = Common.args.url
    data = Common.getURL(url)
    videoborderbox = common.parseDOM(data, "div", attrs={"id": "videoarea"})[0]
    Title = common.parseDOM(videoborderbox, "div", {"id": "videotitle"})[0]
    Title = common.replaceHTMLCodes(Title)
    Title = Title.encode('utf-8')
    videoplayer = common.parseDOM(videoborderbox,
                                  "div",
                                  attrs={"id": "videodisplay"})[0]
    # Resolve media url using videohosts
    videoUrl = None
    videoUrl = hosts.resolve(videoplayer)
    #videoUrl = None
    if not videoUrl:
        dialog = xbmcgui.Dialog()
        dialog.ok('Nothing to play', 'A playable url could not be found.')
        return
    else:
        #print videoUrl
        playList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
        playList.clear()
        count = 1
        for PlayItem in videoUrl:
            Title = Title + ' Part ' + str(count)
            listitem = ListItem(Title, iconImage='', thumbnailImage='')
            listitem.setInfo('video', {'Title': Title})
            playList.add(url=PlayItem, listitem=listitem)
            count = count + 1
        xbmcPlayer = xbmc.Player()
        xbmcPlayer.play(playList)
Exemple #6
0
def play():
    Linky = Common.args.url
    videoUrl = hosts.resolve(Linky)
    if videoUrl:
        Url = videoUrl[0]
        xbmcplugin.setResolvedUrl(pluginhandle, True,
                                  xbmcgui.ListItem(path=Url))
def play(url=None):
    if not url:
        url = Common.args.url
    data = Common.getURL(url)
    playerholder = common.parseDOM(data, "div", attrs={ "id": "Playerholder" })[0]
    # Resolve media url using videohosts
    videoUrl = None
    videoUrl = hosts.resolve(playerholder)
    #videoUrl = None 
    if videoUrl:
        #print videoUrl
        Url = videoUrl[0]
        xbmcplugin.setResolvedUrl(pluginhandle, True, xbmcgui.ListItem(path=Url))
def playVideo(link):
    #print 'playVideo'
    ulink = urllib.unquote(link)
    data = cache.cacheFunction(getURL, ulink)
    if not data:
        xbmcplugin.setResolvedUrl(thisPlugin, False, xbmcgui.ListItem())
        return
    page = data['html']
    #page = load_page(ulink)
    contentIds = common.parseDOM(page, "param", {"name": "@videoPlayer"}, ret="value")
    if not contentIds:
        #xbmcplugin.setResolvedUrl(thisPlugin, False, xbmcgui.ListItem())
        node_article = common.parseDOM(page, "div", {"class": "node_article"})[0]
        videolinks = hosts.resolve(node_article)
        if videolinks:
            videolink = videolinks[0]
            xbmcplugin.setResolvedUrl(thisPlugin, True, xbmcgui.ListItem(path=videolink))
        return
    #videoPlayer = re.compile("brightcove_mediaId: ([0-9]*),").search(page).group(1)
    
    #splits = ulink.rsplit('/', 1)
    #contentId = int(splits[1])
    stacked_url = 'stack://'
    for contentId in contentIds:
        contentId = int(contentId)
        stream = brightcovePlayer.play(contentId, ulink)
    
        rtmpbase = stream[1][0:stream[1].find("&")]
        finalurl = None
        if not 'edgefcs.net' in rtmpbase:
            playpath = stream[1][stream[1].find("&") + 1:]
            finalurl = rtmpbase + ' playpath=' + playpath
        else:
            postfix = stream[1][stream[1].find("?") :]
            postfix2 = "&videoId=" + str(contentId) + "&lineUpId=&pubId=616302933001&playerId=798983031001&affiliateId="
            app = "ondemand" + postfix + postfix2
        
            swfUrl = "http://admin.brightcove.com/viewer/us20120711.1450/federatedVideoUI/BrightcovePlayer.swf?uid=42300475817"
        
            pageUrl = ulink
        
            playpath = stream[1][stream[1].find("&") + 1:] + postfix2
            finalurl = rtmpbase + " app=" + app + " swfUrl=" + swfUrl + " pageUrl=" + pageUrl + " playpath=" + playpath
            
        if finalurl:
            stacked_url += finalurl.replace(',',',,')+' , '
    
    stacked_url = stacked_url[:-3]
    item = xbmcgui.ListItem(stream[0], path=stacked_url)
    xbmcplugin.setResolvedUrl(thisPlugin, True, item)
Exemple #9
0
def play(url=None):
    if not url:
        url = Common.args.url
    data = Common.getURL(url)
    playerholder = common.parseDOM(data, "div", attrs={"id":
                                                       "Playerholder"})[0]
    # Resolve media url using videohosts
    videoUrl = None
    videoUrl = hosts.resolve(playerholder)
    #videoUrl = None
    if videoUrl:
        #print videoUrl
        Url = videoUrl[0]
        xbmcplugin.setResolvedUrl(pluginhandle, True,
                                  xbmcgui.ListItem(path=Url))
def Playlist(url):
    print 'Fetching links from ' + url
    '''req = urllib2.Request(url)
    req.add_header('User-Agent', USER_AGENT)
    response = urllib2.urlopen(req)
    contents = response.read()
    response.close()
    itemsDOM = common.parseDOM(contents, "div", attrs = { "class": "post"})
    Matches = hosts.resolve(itemsDOM[0])'''
    Matches = None
    try:
        xbmc.executebuiltin("ActivateWindow(busydialog)")
        contents = getURL(url)
        contents = contents.replace("\n", " ")
    
        itemsDOM = common.parseDOM(contents, "div", attrs={ "class": "post"})
        Matches = hosts.resolve(itemsDOM[0])
    except:
        pass
    finally:
        xbmc.executebuiltin("Dialog.Close(busydialog)")
    if Matches == None or len(Matches) == 0:
        xbmcplugin.setResolvedUrl(pluginhandle, False,
                                  xbmcgui.ListItem())
        dialog = xbmcgui.Dialog()
        ok = dialog.ok('Nothing to play', 'A playable url could not be found.')
        return
    if Matches[0].find('playlist') > 0:
        print Matches[0]
        return xbmc.executebuiltin("xbmc.PlayMedia(" + Matches[0] + ")")
        
    playList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
    playList.clear()
    for PlayItem in Matches:
        print PlayItem
        listitem = xbmcgui.ListItem('Video')
        listitem.setInfo(type="video", infoLabels={ "Title": name })
        listitem.setProperty("IsPlayable", "true")
        playList.add(url=PlayItem, listitem=listitem)
    xbmcPlayer = xbmc.Player()
    xbmcPlayer.play(playList)
def PlayVideo(url):
    ###########################################################
    ## Mode == M_PLAY_VIDEO
    ## Try to get a list of playable items and play it.
    ###########################################################
    if url == None or url == '':
        return
    xbmc.executebuiltin( "ActivateWindow(busydialog)" )
    # Get contents for given url
    data = getURL(url)
    data = data.replace('\r', '')
    
    YTPlayer = common.parseDOM(data, "div", attrs={ "id": "ytplayer"})
    if not YTPlayer:
        return
    URLs = []
    for Player in YTPlayer:
        Matches = hosts.resolve(Player)
        if Matches:
            URLs.extend(Matches)
    xbmc.executebuiltin( "Dialog.Close(busydialog)" )
    if Matches == None or len(Matches) == 0:
        #xbmcplugin.setResolvedUrl(pluginhandle, False, xbmcgui.ListItem())
        dialog = xbmcgui.Dialog()
        dialog.ok('Nothing to play', 'A playable url could not be found.')
        return
    playList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
    playList.clear()
    #count = 1
    for PlayItem in URLs:
        #Title = Title + ' Part ' + str(count)
        #listitem = ListItem(Title, iconImage=Thumb, thumbnailImage=Thumb)
        listitem = ListItem('Video')
        #listitem.setInfo('video', { 'Title': Title})
        listitem.setProperty("IsPlayable", "true")
        playList.add(url=PlayItem, listitem=listitem)
        #count = count + 1
    xbmcPlayer = xbmc.Player()
    xbmcPlayer.play(playList)
def Playlist(url):
    #print 'Fetching links from ' + url
    Matches = None
    try:
        xbmc.executebuiltin( "ActivateWindow(busydialog)" )
        contents = getURL(url)
    
        itemsDOM = common.parseDOM(contents, "div", attrs = { "id": "vidback"})
        Matches = hosts.resolve(itemsDOM[0])
    except:
        pass
    finally:
        xbmc.executebuiltin( "Dialog.Close(busydialog)" )
    if Matches == None or len(Matches) == 0:
        xbmcplugin.setResolvedUrl(pluginhandle, False, 
                                  xbmcgui.ListItem())
        dialog = xbmcgui.Dialog()
        ok = dialog.ok('Nothing to play', 'A playable url could not be found.')
        return
    #print Matches[0]
    if Matches[0].find('playlist') > 0:
        #print Matches[0]
        #listitem = xbmcgui.ListItem(path=Matches[0])
        #listitem.setProperty("IsPlayable", "true")
        #return xbmcplugin.setResolvedUrl(pluginhandle, True, listitem)
        return xbmc.executebuiltin("xbmc.PlayMedia("+Matches[0]+")")
        #return xbmcplugin.setResolvedUrl(pluginhandle, True, 
        #                          xbmcgui.ListItem(path=Matches[0]))
        
    playList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
    playList.clear()
    for PlayItem in Matches:
        #print PlayItem
        listitem = xbmcgui.ListItem('Video')
        listitem.setInfo( type="video", infoLabels={ "Title": name } )
        listitem.setProperty("IsPlayable", "true")
        playList.add(url=PlayItem, listitem=listitem)
    xbmcPlayer = xbmc.Player()
    xbmcPlayer.play(playList)
def play(url=None):
    if not url:
        url = Common.args.url
    data = Common.getURL(url)
    playerholder = common.parseDOM(data, "object")
    # Resolve media url using videohosts
    videoUrl = None
    if playerholder:
        playerholder = playerholder[0]
        videoUrl = hosts.resolve(playerholder)
    if not videoUrl:
        flvdiv = common.parseDOM(data, "div", {"class": "downloadTxt"})
        if flvdiv:
            flvdiv = flvdiv[0]
            flvlink = common.parseDOM(flvdiv, "a", ret="href")
            if flvlink:
                videoUrl = []
                videoUrl.append(flvlink[0].replace(' ', '%20'))
    #videoUrl = None 
    if videoUrl:
        #print videoUrl
        Url = videoUrl[0]
        xbmcplugin.setResolvedUrl(pluginhandle, True, xbmcgui.ListItem(path=Url))
def play():
    Linky = Common.args.url
    videoUrl = hosts.resolve(Linky)
    if videoUrl:
        Url = videoUrl[0]
        xbmcplugin.setResolvedUrl(pluginhandle, True, xbmcgui.ListItem(path=Url))
def Playlist(url):
    #print 'Fetching links from ' + url
    Matches = None
    Patterns = [ 'href="http://adf.ly/\d{1,}/([^"]+)">Full Movie \(Click Here\)',
                'href="http://adf.ly/\d{1,}/([^"]+)".+?>',
                'href="([^"]+)">Full Movie \(Click Here\)',
                'href="([^"]+)"[^P]+Part ' ]
    try:
        xbmc.executebuiltin("ActivateWindow(busydialog)")
        contents = cache.cacheFunction(getURL, url)
    
        itemsDOM = common.parseDOM(contents, "div", attrs={ "class": "entry"})
        #itemsDOM = common.parseDOM(contents, "div", attrs = { "style": "text-align: center;"})
        entry = itemsDOM[1]
        #print entry
        Matches = hosts.resolve(entry)
        
        if Matches == None or len(Matches) == 0:
            for Pattern in Patterns:
                adClick = re.compile(Pattern).findall(entry)
                if len(adClick) > 0:
                    for url1 in adClick:
                        if url1 is not None and url1 != '':
                            contents2 = cache.cacheFunction(getURL, url1)
                        if contents2 is not None:
                            MatchesI = hosts.resolve(contents2)
                            if MatchesI is not None:
                                Matches.extend(MatchesI)
                if len(Matches) > 0:
                    break
                
    except:
        print 'Exception occurred.'
        pass
    finally:
        xbmc.executebuiltin("Dialog.Close(busydialog)")

    if Matches == None or len(Matches) == 0:
        xbmcplugin.setResolvedUrl(pluginhandle, False,
                                  xbmcgui.ListItem())
        dialog = xbmcgui.Dialog()
        ok = dialog.ok('Nothing to play', 'A playable url could not be found.')
        return
    if Matches[0].find('playlist') > 0:
        #print Matches[0]
        #listitem = xbmcgui.ListItem(path=Matches[0])
        #listitem.setProperty("IsPlayable", "true")
        #return xbmcplugin.setResolvedUrl(pluginhandle, True, listitem)
        return xbmc.executebuiltin("xbmc.PlayMedia(" + Matches[0] + ")")
        #return xbmcplugin.setResolvedUrl(pluginhandle, True, 
        #                          xbmcgui.ListItem(path=Matches[0]))
        
    playList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
    playList.clear()
    for PlayItem in Matches:
        #print PlayItem
        listitem = xbmcgui.ListItem('Video')
        listitem.setInfo(type="video", infoLabels={ "Title": name })
        listitem.setProperty("IsPlayable", "true")
        playList.add(url=PlayItem, listitem=listitem)
    xbmcPlayer = xbmc.Player()
    xbmcPlayer.play(playList)
def PlaySerial(url):
    ###########################################################
    ## Mode == M_PLAY_SERIAL
    ## Try to get a list of playable items and play it.
    ###########################################################
    if url == None or url == '':
        return
    
    # Get contents for given url
    data = getURL(url)
    data = data.replace('\r\n', '').replace('\r', '').replace('\n', '')
    
    centerblocks = common.parseDOM(data, "div", attrs={ "id": "centerblocks"})[0]
    h1 = common.parseDOM(centerblocks, "h1")[0]
    h3 = common.parseDOM(centerblocks, "h3")[0]
    Title = h1 + ' - ' + h3
    Thumb = common.parseDOM(centerblocks, "img", attrs={ "class": "thumb"}, ret="src")[0]
    Title = Title.encode('utf-8')
    
    tables = common.parseDOM(centerblocks, "table", attrs={ "class": "list"})
    Mirrors = []
    for item in tables:
        Host = common.parseDOM(item, "td", attrs={ "width": "75%"})[0]
        Mirrors.append((Host, item))
    Hosts = []
    for Host, _ in Mirrors:
        Hosts.append(Host)
    dialog = xbmcgui.Dialog()
    index = dialog.select('Choose Mirror', Hosts)
    if index > -1:
        #print 'so far so good ' + str(index)
        Matches = None
        try:
            xbmc.executebuiltin( "ActivateWindow(busydialog)" )
            _, src = Mirrors[index]
            #print src
            URLs = []
            #src = re.sub('\n', '', src)
            #NavPages = common.parseDOM(src, "a", attrs={ "rel": "nofollow"}, ret="href")
            NavPages = re.compile("href='(.+?)'").findall(src)
            #print 'Num Links found: ' + str(len(NavPages))
            for Page in NavPages:
                #print 'URL one: ' + Page
                data2 = getURL(Page)
                data2 = data2.replace('\r\n', '').replace('\r', '').replace('\n', '')
                dataHtml = common.parseDOM(data2, "div", attrs={ "id": "centerblocks"})[0]
                #print dataHtml
                #print 'centerblocks: ' + dataHtml
                Matches = hosts.resolve(dataHtml)
                #print 'Matches after first try: ' + str(len(Matches))
                #break
                if not Matches:
                    NavPage2 = common.parseDOM(dataHtml, "a", attrs={ "rel": "nofollow"}, ret="href")[0]
                    data3 = getURL(NavPage2)
                    #print data3
                    Matches = hosts.resolve(data3)
                    #print 'Matches after second try: ' + str(len(Matches))
                
                if Matches:
                    URLs.extend(Matches)
        except:
            print 'Error occured in try block in PlaySerial'
        finally:
            xbmc.executebuiltin( "Dialog.Close(busydialog)" )
        
        if Matches is None or len(Matches) == 0:
            #xbmcplugin.setResolvedUrl(pluginhandle, False, xbmcgui.ListItem())
            dialog = xbmcgui.Dialog()
            dialog.ok('Nothing to play', 'A playable url could not be found.')
            return
        playList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
        playList.clear()
        count = 1
        for PlayItem in URLs:
            Title = Title + ' Part ' + str(count)
            listitem = ListItem(Title, iconImage=Thumb, thumbnailImage=Thumb)
            listitem.setInfo('video', { 'Title': Title})
            #listitem.setProperty("IsPlayable", "true")
            playList.add(url=PlayItem, listitem=listitem)
            count = count + 1
        xbmcPlayer = xbmc.Player()
        xbmcPlayer.play(playList)