Esempio n. 1
0
def play_mirror(url):
    with common.busy_indicator():
        # soup = BeautifulSoup(common.webread(url), 'html5lib')
        # iframe = soup.find(id='iframeplayer')
        # iframe_url = urljoin(config.base_url, iframe.attrs['src'])
        (vidurl,
         pars) = scrapers.episodeVideo(urljoin(config.video_url,
                                               url))  # common.resolve(url)
        vidurl = _base64(vidurl)
        if not re.match(r'(.)*\.m3u8$', vidurl):
            if re.match(r'(.*)123ku(.*)', pars):
                vidurl = scrapers.episodeVideo_123ku(vidurl)
            else:
                vidurl = scrapers.episodeVideo_dplayer(vidurl)

        if vidurl:
            try:
                title, image = scrapers.title_image(
                    urljoin(config.video_url, url))
            except Exception:
                # we can proceed without the title and image
                title, image = ('', '')

            li = xbmcgui.ListItem(title)
            if 'User-Agent=' not in vidurl:
                vidurl = vidurl + '|User-Agent=' + quote(get_ua())
            xbmc.Player().play(vidurl, li)
Esempio n. 2
0
def play_mirror(url):
    with common.busy_indicator():
        soup = BeautifulSoup(common.webread(url), 'html5lib')
        iframe = soup.find(id='iframeplayer')
        iframe_url = urljoin(config.base_url, str(iframe.attrs['src']))
        try:
            vidurl = common.resolve(iframe_url)
        except ResolverError as e:
            if str(e) == 'No link selected':
                return
            raise e

        if vidurl:
            try:
                title, image = scrapers.title_image(url)
            except Exception:
                # we can proceed without the title and image
                title, image = ('', '')
            li = xbmcgui.ListItem(title)
            li.setArt({'thumb': image})
            if 'User-Agent=' not in vidurl:
                vidurl = vidurl + '|User-Agent=' + urllib.parse.quote(get_ua())
            xbmc.Player().play(vidurl, li)

        else:
            common.notify(heading="icDrama", message="Unable to play video")
Esempio n. 3
0
def play_mirror(url):
    with common.busy_indicator():
        # soup = BeautifulSoup(common.webread(url), 'html5lib')
        # iframe = soup.find(id='iframeplayer')
        # iframe_url = urljoin(config.base_url, iframe.attrs['src'])
        vidurl = scrapers.episodeVideo(urljoin(config.video_url, url)) # common.resolve(url)

        if vidurl:
            try:
                title, image = scrapers.title_image(urljoin(config.video_url, url))
            except Exception:
                # we can proceed without the title and image
                title, image = ('', '')

            osWin = xbmc.getCondVisibility('system.platform.windows')
            osOsx = xbmc.getCondVisibility('system.platform.osx')
            osLinux = xbmc.getCondVisibility('system.platform.linux')
            osAndroid = xbmc.getCondVisibility('System.Platform.Android')

            li = xbmcgui.ListItem(title)
            li.setThumbnailImage(image)

            if osOsx or osWin or (osLinux and not osAndroid):    
                if 'User-Agent=' not in vidurl:
                    vidurl = vidurl + '|User-Agent=' + urllib.quote(get_ua())
                xbmc.Player().play(vidurl, li)
            elif osAndroid:
                xbmc.executebuiltin("PlayMedia("+vidurl+")")
def play_mirror(url):
    with common.busy_indicator():
        vidurl = common.resolve(url)
        if vidurl:
            try:
                title, image = scrapers.title_image(url)
            except Exception:
                # we can proceed without the title and image
                title, image = ('', '')
            li = xbmcgui.ListItem(title)
            li.setThumbnailImage(image)
            if 'User-Agent=' not in vidurl:
                vidurl = vidurl + '|User-Agent=' + urllib.quote(get_ua())
            xbmc.Player().play(vidurl, li)
def play_mirror(url):
    playing = False
    player = None
    orig_url = ''
    
    with common.busy_indicator():
        vidurl = common.resolve(url)
        orig_url = vidurl
        if vidurl:
            try:
                title, image = scrapers.title_image(url)
            except Exception:
                # we can proceed without the title and image
                title, image = ('', '')
            li = xbmcgui.ListItem(title)
            li.setArt({ 'thumb' : image })
            if 'User-Agent=' not in vidurl:
                vidurl = vidurl + '|User-Agent=' + urllib.quote(get_ua())
            
            # Instantiate own player class
            player = MyPlayer()
            
            player.play(vidurl, li)

            
            playing = True
    
    if player:
        counter = 0
        # Checks for a minimum of 60 seconds; keeps script alive for this time
        while player.alive and counter < 30:
            counter += 1
            xbmc.sleep(2000)
        
        if not player.hasStarted:
            common.debug('Icdrama: Player encountered a format that prevented it from starting')
            # Add to blacklist
            sourceutil.add_blacklist(orig_url)
            
            # Delete to free up reference
            del player
            
            # Try again
            play_mirror(url)
            
        else:
            # Delete to free up reference
            del player
    
    return playing
Esempio n. 6
0
def play_mirror(url):
    with common.busy_indicator():
        vidurl = common.resolve(url)
        if vidurl:
            try:
                title, image = scrapers.title_image(url)
            except Exception:
                # we can proceed without the title and image
                title, image = ('', '')
            li = xbmcgui.ListItem(title)
            li.setThumbnailImage(image)
            if 'User-Agent=' not in vidurl:
                vidurl = vidurl + '|User-Agent=' + urllib.quote(get_ua())
            xbmc.Player().play(vidurl, li)
Esempio n. 7
0
def play_mirror(url):
    with common.busy_indicator():
        # soup = BeautifulSoup(common.webread(url), 'html5lib')
        # iframe = soup.find(id='iframeplayer')
        # iframe_url = urljoin(config.base_url, iframe.attrs['src'])
        vidurl = scrapers.episodeVideo(urljoin(config.video_url, url)) # common.resolve(url)

        if vidurl:
            try:
                title, image = scrapers.title_image(urljoin(config.video_url, url))
            except Exception:
                # we can proceed without the title and image
                title, image = ('', '')

            li = xbmcgui.ListItem(title)
            xbmc.Player().play(vidurl, li)
Esempio n. 8
0
def play_mirror(url):
    with common.busy_indicator():
        soup = BeautifulSoup(common.webread(url), 'html5lib')
        iframe = soup.find(id='iframeplayer')
        iframe_url = urljoin(config.base_url, iframe.attrs['src'])
        vidurl = common.resolve(iframe_url)

        if vidurl:
            try:
                title, image = scrapers.title_image(url)
            except Exception:
                # we can proceed without the title and image
                title, image = ('', '')
            li = xbmcgui.ListItem(title)
            li.setArt({ 'thumb': image })
            if 'User-Agent=' not in vidurl:
                vidurl = vidurl + '|User-Agent=' + quote(get_ua())
            xbmc.Player().play(vidurl, li)