本文整理匯總了Python中xbmcgui.WindowDialog方法的典型用法代碼示例。如果您正苦於以下問題:Python xbmcgui.WindowDialog方法的具體用法?Python xbmcgui.WindowDialog怎麽用?Python xbmcgui.WindowDialog使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類xbmcgui
的用法示例。
在下文中一共展示了xbmcgui.WindowDialog方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_response
# 需要導入模塊: import xbmcgui [as 別名]
# 或者: from xbmcgui import WindowDialog [as 別名]
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
示例2: get_response
# 需要導入模塊: import xbmcgui [as 別名]
# 或者: from xbmcgui import WindowDialog [as 別名]
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()
示例3: login
# 需要導入模塊: import xbmcgui [as 別名]
# 或者: from xbmcgui import WindowDialog [as 別名]
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
示例4: parseopenload
# 需要導入模塊: import xbmcgui [as 別名]
# 或者: from xbmcgui import WindowDialog [as 別名]
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 ''