Beispiel #1
0
 def __auth_ip(self, media_id):
     header = i18n('vidup_auth_header')
     line1 = i18n('auth_required')
     line2 = i18n('visit_link')
     line3 = i18n('click_pair') % ('https://vidup.me/pair')
     with common.kodi.CountdownDialog(header, line1, line2, line3) as cd:
         return cd.start(self.__check_auth, [media_id])
Beispiel #2
0
 def __auth_ip(self, media_id):
     header = i18n('vidup_auth_header')
     line1 = i18n('auth_required')
     line2 = i18n('visit_link')
     line3 = i18n('click_pair') % ('https://vidup.me/pair')
     with common.kodi.CountdownDialog(header, line1, line2, line3) as cd:
         return cd.start(self.__check_auth, [media_id])
Beispiel #3
0
 def __auth_ip(self, media_id):
     js_data = self.__get_json(INFO_URL)
     pair_url = js_data.get('result', {}).get('auth_url', '')
     if pair_url:
         pair_url = pair_url.replace('\/', '/')
         header = i18n('ol_auth_header')
         line1 = i18n('auth_required')
         line2 = i18n('visit_link')
         line3 = i18n('click_pair') % (pair_url)
         with common.kodi.CountdownDialog(header, line1, line2, line3) as cd:
             return cd.start(self.__check_auth, [media_id])
 def __auth_ip(self, media_id):
     js_data = self.__get_json(INFO_URL)
     pair_url = js_data.get('result', {}).get('auth_url', '')
     if pair_url:
         pair_url = pair_url.replace('\/', '/')
         header = i18n('ol_auth_header')
         line1 = i18n('auth_required')
         line2 = i18n('visit_link')
         line3 = i18n('click_pair') % (pair_url)
         with common.kodi.CountdownDialog(header, line1, line2,
                                          line3) as cd:
             return cd.start(self.__check_auth, [media_id])
Beispiel #5
0
def pick_source(sources, auto_pick=None):
    if auto_pick is None:
        #auto_pick = common.get_setting('auto_pick') == 'true'
        auto_pick = True
    if len(sources) == 1:
        return sources[0][1]
    elif len(sources) > 1:
        if auto_pick:
            return sources[0][1]
        else:
            result = xbmcgui.Dialog().select(common.i18n('choose_the_link'), [str(source[0]) if source[0] else 'Unknown' for source in sources])
            if result == -1:
                raise ResolverError(common.i18n('no_link_selected'))
            else:
                return sources[result][1]
    else:
        raise ResolverError(common.i18n('no_video_link'))
def pick_source(sources, auto_pick=None):
    if auto_pick is None:
        #auto_pick = common.get_setting('auto_pick') == 'true'
        auto_pick = True
    if len(sources) == 1:
        return sources[0][1]
    elif len(sources) > 1:
        if auto_pick:
            return sources[0][1]
        else:
            result = xbmcgui.Dialog().select(common.i18n('choose_the_link'), [str(source[0]) if source[0] else 'Unknown' for source in sources])
            if result == -1:
                raise ResolverError(common.i18n('no_link_selected'))
            else:
                return sources[result][1]
    else:
        raise ResolverError(common.i18n('no_video_link'))
Beispiel #7
0
    def get_media_url(self, host, media_id):
        try:

            myurl = 'http://openload.co/embed/%s' % media_id
            HTTP_HEADER = {
                'User-Agent': common.FF_USER_AGENT,
                'Referer': myurl
            }  # 'Connection': 'keep-alive'

            response = self.net.http_GET(myurl, headers=HTTP_HEADER)
            html = response.content

            mylink = self.get_mylink(html)

            videoUrl = mylink
            try:
                common.log_utils.log_notice('A openload resolve parse: %s' %
                                            videoUrl)
            except:
                pass

            try:
                req = urllib2.Request(videoUrl, None, HTTP_HEADER)
                res = urllib2.urlopen(req)
                videoUrl = res.geturl()
                res.close()
            except Exception as e:
                common.log_utils.log_notice(
                    'A openload primary false, backup method. Error: %s' % e)

                try:
                    if not self.__file_exists(media_id):
                        raise ResolverError('File Not Available')

                    video_url = self.__check_auth(media_id)
                    if not video_url:
                        video_url = self.__auth_ip(media_id)
                except ResolverError:
                    raise

                if video_url:
                    return video_url
                else:
                    raise ResolverError(i18n('no_ol_auth'))

            #return videoUrl + helpers.append_headers({'User-Agent': common.FF_USER_AGENT})
            return videoUrl
            # video_url = 'https://openload.co/stream/%s?mime=true' % myvidurl

        except Exception as e:
            common.log_utils.log_notice(
                'Exception during openload resolve parse: %s' % e)
            print("Error", e)
            raise
Beispiel #8
0
def get_response(img):
    try:
        img = xbmcgui.ControlImage(450, 0, 400, 130, img)
        wdlg = xbmcgui.WindowDialog()
        wdlg.addControl(img)
        wdlg.show()
        common.kodi.sleep(3000)
        solution = common.kodi.get_keyboard(common.i18n('letters_image'))
        if not solution:
            raise Exception('captcha_error')
    finally:
        wdlg.close()
Beispiel #9
0
    def get_media_url(self, host, media_id):
        try:

            myurl = 'http://openload.co/embed/%s' % media_id
            HTTP_HEADER = {
                'User-Agent': common.FF_USER_AGENT,
                'Referer': myurl
            }  # 'Connection': 'keep-alive'

            response = self.net.http_GET(myurl, headers=HTTP_HEADER)
            html = response.content
            common.log_utils.log_notice('%s; DIRECTORY' % os.getcwd())

            videoUrl = media_id

            if not self.__file_exists(media_id):
                raise ResolverError('File Not Available')

            try:
                ol_id = re.findall(
                    r'''<span[^>]+id=(["'])[^"']+\1[^>]*>(?P<id>[0-9A-Za-z]+)</span>''',
                    html)
                video_url = 'https://openload.co/stream/%s?mime=true'

                decoded = self._eval_id_decoding(html, ol_id[0][-1])
                video_url = video_url % decoded
                return video_url
            except Exception as e:
                common.log_utils.log_notice(
                    '%s; falling back to method with pairing, error: %s' %
                    (media_id, e))

                #video_url = self.__check_auth(media_id)
                #if not video_url:
                #    video_url = self.__auth_ip(media_id)

            if video_url:
                return video_url
            else:
                raise ResolverError(i18n('no_ol_auth'))

            #return videoUrl + helpers.append_headers({'User-Agent': common.FF_USER_AGENT})
            return videoUrl
            # video_url = 'https://openload.co/stream/%s?mime=true' % myvidurl

        except Exception as e:
            common.log_utils.log_notice(
                'Exception during openload resolve parse: %s' % e)
            print("Error", e)
            raise
Beispiel #10
0
    def get_media_url(self, host, media_id):
        try:

            myurl = 'http://openload.co/embed/%s' % media_id
            HTTP_HEADER = {'User-Agent': common.FF_USER_AGENT,'Referer': myurl}  # 'Connection': 'keep-alive'

            response = self.net.http_GET(myurl, headers=HTTP_HEADER)
            html = response.content
            common.log_utils.log_notice('%s; DIRECTORY' % os.getcwd())

            videoUrl = media_id


            if not self.__file_exists(media_id):
                raise ResolverError('File Not Available')

            try:
                ol_id = re.findall(r'''<span[^>]+id=(["'])[^"']+\1[^>]*>(?P<id>[0-9A-Za-z]+)</span>''',html)
                video_url = 'https://openload.co/stream/%s?mime=true'

                decoded = self._eval_id_decoding(html, ol_id[0][-1])
                video_url = video_url % decoded
                return video_url
            except Exception as e:
                common.log_utils.log_notice('%s; falling back to method with pairing, error: %s' % (media_id,e))

                #video_url = self.__check_auth(media_id)
                #if not video_url:
                #    video_url = self.__auth_ip(media_id)


            if video_url:
                return video_url
            else:
                raise ResolverError(i18n('no_ol_auth'))

            #return videoUrl + helpers.append_headers({'User-Agent': common.FF_USER_AGENT})
            return videoUrl
            # video_url = 'https://openload.co/stream/%s?mime=true' % myvidurl


        except Exception as e:
            common.log_utils.log_notice('Exception during openload resolve parse: %s' % e)
            print("Error", e)
            raise
Beispiel #11
0
    def __init__(self, *args, **kwargs):
        bg_image = os.path.join(common.addon_path, 'resources', 'images', 'DialogBack2.png')
        check_image = os.path.join(common.addon_path, 'resources', 'images', 'checked.png')
        button_fo = os.path.join(common.kodi.get_path(), 'resources', 'skins', 'Default', 'media', 'button-fo.png')
        button_nofo = os.path.join(common.kodi.get_path(), 'resources', 'skins', 'Default', 'media', 'button-nofo.png')
        self.cancelled = False
        self.chk = [0] * 9
        self.chkbutton = [0] * 9
        self.chkstate = [False] * 9

        imgX, imgY, imgw, imgh = 436, 210, 408, 300
        ph, pw = imgh / 3, imgw / 3
        x_gap = 70
        y_gap = 70
        button_gap = 40
        button_h = 40
        button_y = imgY + imgh + button_gap
        middle = imgX + (imgw / 2)
        win_x = imgX - x_gap
        win_y = imgY - y_gap
        win_h = imgh + 2 * y_gap + button_h + button_gap
        win_w = imgw + 2 * x_gap

        ctrlBackgound = xbmcgui.ControlImage(win_x, win_y, win_w, win_h, bg_image)
        self.addControl(ctrlBackgound)
        self.msg = '[COLOR red]%s[/COLOR]' % (kwargs.get('msg'))
        self.strActionInfo = xbmcgui.ControlLabel(imgX, imgY - 30, imgw, 20, self.msg, 'font13')
        self.addControl(self.strActionInfo)
        img = xbmcgui.ControlImage(imgX, imgY, imgw, imgh, kwargs.get('captcha'))
        self.addControl(img)
        self.iteration = kwargs.get('iteration')
        self.strActionInfo = xbmcgui.ControlLabel(imgX, imgY + imgh, imgw, 20, common.i18n('captcha_round') % (str(self.iteration)), 'font40')
        self.addControl(self.strActionInfo)
        self.cancelbutton = xbmcgui.ControlButton(middle - 110, button_y, 100, button_h, common.i18n('cancel'), focusTexture=button_fo, noFocusTexture=button_nofo, alignment=2)
        self.okbutton = xbmcgui.ControlButton(middle + 10, button_y, 100, button_h, common.i18n('ok'), focusTexture=button_fo, noFocusTexture=button_nofo, alignment=2)
        self.addControl(self.okbutton)
        self.addControl(self.cancelbutton)

        for i in xrange(9):
            row = i / 3
            col = i % 3
            x_pos = imgX + (pw * col)
            y_pos = imgY + (ph * row)
            self.chk[i] = xbmcgui.ControlImage(x_pos, y_pos, pw, ph, check_image)
            self.addControl(self.chk[i])
            self.chk[i].setVisible(False)
            self.chkbutton[i] = xbmcgui.ControlButton(x_pos, y_pos, pw, ph, str(i + 1), font='font1', focusTexture=button_fo, noFocusTexture=button_nofo)
            self.addControl(self.chkbutton[i])

        for i in xrange(9):
            row_start = (i / 3) * 3
            right = row_start + (i + 1) % 3
            left = row_start + (i - 1) % 3
            up = (i - 3) % 9
            down = (i + 3) % 9
            self.chkbutton[i].controlRight(self.chkbutton[right])
            self.chkbutton[i].controlLeft(self.chkbutton[left])
            if i <= 2:
                self.chkbutton[i].controlUp(self.okbutton)
            else:
                self.chkbutton[i].controlUp(self.chkbutton[up])

            if i >= 6:
                self.chkbutton[i].controlDown(self.okbutton)
            else:
                self.chkbutton[i].controlDown(self.chkbutton[down])

        self.okbutton.controlLeft(self.cancelbutton)
        self.okbutton.controlRight(self.cancelbutton)
        self.cancelbutton.controlLeft(self.okbutton)
        self.cancelbutton.controlRight(self.okbutton)
        self.okbutton.controlDown(self.chkbutton[2])
        self.okbutton.controlUp(self.chkbutton[8])
        self.cancelbutton.controlDown(self.chkbutton[0])
        self.cancelbutton.controlUp(self.chkbutton[6])
        self.setFocus(self.okbutton)
Beispiel #12
0
    def __init__(self, *args, **kwargs):
        bg_image = os.path.join(common.addon_path, 'resources', 'images', 'DialogBack2.png')
        check_image = os.path.join(common.addon_path, 'resources', 'images', 'checked.png')
        button_fo = os.path.join(common.kodi.get_path(), 'resources', 'skins', 'Default', 'media', 'button-fo.png')
        button_nofo = os.path.join(common.kodi.get_path(), 'resources', 'skins', 'Default', 'media', 'button-nofo.png')
        self.cancelled = False
        self.chk = [0] * 9
        self.chkbutton = [0] * 9
        self.chkstate = [False] * 9

        imgX, imgY, imgw, imgh = 436, 210, 408, 300
        ph, pw = imgh / 3, imgw / 3
        x_gap = 70
        y_gap = 70
        button_gap = 40
        button_h = 40
        button_y = imgY + imgh + button_gap
        middle = imgX + (imgw / 2)
        win_x = imgX - x_gap
        win_y = imgY - y_gap
        win_h = imgh + 2 * y_gap + button_h + button_gap
        win_w = imgw + 2 * x_gap

        ctrlBackgound = xbmcgui.ControlImage(win_x, win_y, win_w, win_h, bg_image)
        self.addControl(ctrlBackgound)
        self.msg = '[COLOR red]%s[/COLOR]' % (kwargs.get('msg'))
        self.strActionInfo = xbmcgui.ControlLabel(imgX, imgY - 30, imgw, 20, self.msg, 'font13')
        self.addControl(self.strActionInfo)
        img = xbmcgui.ControlImage(imgX, imgY, imgw, imgh, kwargs.get('captcha'))
        self.addControl(img)
        self.iteration = kwargs.get('iteration')
        self.strActionInfo = xbmcgui.ControlLabel(imgX, imgY + imgh, imgw, 20, common.i18n('captcha_round') % (str(self.iteration)), 'font40')
        self.addControl(self.strActionInfo)
        self.cancelbutton = xbmcgui.ControlButton(middle - 110, button_y, 100, button_h, common.i18n('cancel'), focusTexture=button_fo, noFocusTexture=button_nofo, alignment=2)
        self.okbutton = xbmcgui.ControlButton(middle + 10, button_y, 100, button_h, common.i18n('ok'), focusTexture=button_fo, noFocusTexture=button_nofo, alignment=2)
        self.addControl(self.okbutton)
        self.addControl(self.cancelbutton)

        for i in xrange(9):
            row = i / 3
            col = i % 3
            x_pos = imgX + (pw * col)
            y_pos = imgY + (ph * row)
            self.chk[i] = xbmcgui.ControlImage(x_pos, y_pos, pw, ph, check_image)
            self.addControl(self.chk[i])
            self.chk[i].setVisible(False)
            self.chkbutton[i] = xbmcgui.ControlButton(x_pos, y_pos, pw, ph, str(i + 1), font='font1', focusTexture=button_fo, noFocusTexture=button_nofo)
            self.addControl(self.chkbutton[i])

        for i in xrange(9):
            row_start = (i / 3) * 3
            right = row_start + (i + 1) % 3
            left = row_start + (i - 1) % 3
            up = (i - 3) % 9
            down = (i + 3) % 9
            self.chkbutton[i].controlRight(self.chkbutton[right])
            self.chkbutton[i].controlLeft(self.chkbutton[left])
            if i <= 2:
                self.chkbutton[i].controlUp(self.okbutton)
            else:
                self.chkbutton[i].controlUp(self.chkbutton[up])

            if i >= 6:
                self.chkbutton[i].controlDown(self.okbutton)
            else:
                self.chkbutton[i].controlDown(self.chkbutton[down])

        self.okbutton.controlLeft(self.cancelbutton)
        self.okbutton.controlRight(self.cancelbutton)
        self.cancelbutton.controlLeft(self.okbutton)
        self.cancelbutton.controlRight(self.okbutton)
        self.okbutton.controlDown(self.chkbutton[2])
        self.okbutton.controlUp(self.chkbutton[8])
        self.cancelbutton.controlDown(self.chkbutton[0])
        self.cancelbutton.controlUp(self.chkbutton[6])
        self.setFocus(self.okbutton)