Python xbmcgui.WindowDialog() Examples

The following are 5 code examples of xbmcgui.WindowDialog(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module xbmcgui , or try the search function .
Example #1
Source File: captcha_lib.py    From script.module.urlresolver with GNU General Public License v2.0 5 votes vote down vote up
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()
        return solution 
Example #2
Source File: captcha_lib.py    From script.module.resolveurl with GNU General Public License v2.0 5 votes vote down vote up
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()
        return solution 
Example #3
Source File: captcha_lib.py    From filmkodi with Apache License 2.0 5 votes vote down vote up
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() 
Example #4
Source File: megadede.py    From addon with GNU General Public License v3.0 4 votes vote down vote up
def login():
    url_origen = host+"/login?popup=1"
    try:
        data = httptools.downloadpage(url_origen).data
    except:
        data = httptools.downloadpage(url_origen, follow_redirects=False).data
    if '<span class="username">' in data:
         return True
    token = scrapertools.find_single_match(data, '<input name="_token" type="hidden" value="([^"]+)"')
    if 'Escribe los nĂºmeros de la imagen' in data:
        captcha_url = scrapertools.find_single_match(data, '<img src="([^"]+)" alt="captcha">')
        imagen_data = httptools.downloadpage(captcha_url).data
        ficheropng = os.path.join(config.get_data_path(), "captcha_megadede.png")
        outfile=open(ficheropng,'wb')
        outfile.write(imagen_data)
        outfile.close()
        img = xbmcgui.ControlImage(450,15,400,130,ficheropng)
        wdlg = xbmcgui.WindowDialog()
        wdlg.addControl(img)
        wdlg.show()
        sleep(1)
        kb = platformtools.dialog_numeric(0, "Escribe los nĂºmeros de la imagen")

        postcaptcha = ""
        if kb !='':
                solution = kb
                postcaptcha = "&captcha=" + str(solution)
        else:
             return False
        wdlg.close()
    else:
        postcaptcha=""
    post = "_token=" + str(token) + "&email=" + str(config.get_setting("megadedeuser", "megadede")) + \
           "&password=" + str(config.get_setting("megadedepassword", "megadede")) + postcaptcha\
           #+ "&app=2131296469"
    headers = {"User-Agent": "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko) "
        "Chrome/66.0.3163.100 Safari/537.36", "Referer": host, "X-Requested-With": "XMLHttpRequest","X-CSRF-TOKEN":
        token}
    data = httptools.downloadpage(host+"/login", post=post, headers=headers).data
    if "redirect" in data:
        return True
    else:
        return False 
Example #5
Source File: mrknow_urlparser.py    From filmkodi with Apache License 2.0 4 votes vote down vote up
def parseopenload(self,url,referer,options):
        #print("link", urlparse.urlparse(url))
        myparts = urlparse.urlparse(url)
        media_id = myparts.path
        media_id = media_id.replace('/video/','').replace('/embed/','')
        media_id = media_id.split('/')[0]

        url_new = 'https://openload.co/embed/' + media_id

        ticket_url = 'https://api.openload.io/1/file/dlticket?file=%s' % (media_id)
        query_data = { 'url': ticket_url, 'use_host': False, 'use_cookie': False, 'use_post': False, 'return_data': True }
        result = self.cm.getURLRequestData(query_data)
        js_result = json.loads(result)
        #print("re",js_result,result)
        if js_result['status'] == 200:
            img = xbmcgui.ControlImage(450, 0, 400, 130, js_result['result']['captcha_url'])
            wdlg = xbmcgui.WindowDialog()
            wdlg.addControl(img)
            wdlg.show()
            kb = xbmc.Keyboard('', 'Type the letters in the image', False)
            kb.doModal()
            if (kb.isConfirmed()):
                solution = kb.getText()
                if solution == '':
                    raise Exception('You must enter text in the image to access video')
            else:
                dialog = xbmcgui.Dialog()
                dialog.ok(" Problem"," Nie wprowadzono kodu Captcha")
                return ''
        else:
            dialog = xbmcgui.Dialog()
            dialog.ok(" Problem",js_result['msg'])
            return ''
        xbmc.sleep(js_result['result']['wait_time'] * 1000)
        video_url = 'https://api.openload.io/1/file/dl?file=%s&ticket=%s&captcha_response=%s' % (media_id, js_result['result']['ticket'],solution)
        query_data = { 'url': video_url, 'use_host': False, 'use_cookie': False, 'use_post': False, 'return_data': True }
        result = self.cm.getURLRequestData(query_data)
        js_result = json.loads(result)
        self.log("JSRES %s" % js_result)
        if js_result['status'] == 200:
            #czy mamy napisy
            #query_data = { 'url': url_new, 'use_host': False, 'use_cookie': False, 'use_post': False, 'return_data': True }
            ##result = self.cm.getURLRequestData(query_data)
            #match2 = re.compile('var suburl = "(.*?)";').findall(result)
            #self.log("res %s" % result)
            #print("match %s " %match2)
            #if len(match2)>0:
            #   #mamy napisy
            #    mylink = {}
            #    mylink[0] = js_result['result']['url'] + '?mime=true'
            #    mylink[1] = "https://openload.io" + match2[0].replace('\\','')
            #    print("mylink",mylink)
            #    return mylink
            #else:
            return js_result['result']['url'] + '?mime=true'
        else:
            dialog = xbmcgui.Dialog()
            dialog.ok(" Problem",js_result['msg'])
            return ''