"""
urlresolver XBMC Addon
Copyright (C) 2014 tknorris
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
reusable captcha methods
"""
from urlresolver import common
import re
import xbmcgui
import xbmc
import os
import recaptcha_v2
import helpers
net = common.Net()
IMG_FILE = 'captcha_img.gif'
def get_response(img):
try:
img = xbmcgui.ControlImage(450, 0, 400, 130, img)
wdlg = xbmcgui.WindowDialog()
wdlg.addControl(img)
wdlg.show()
xbmc.sleep(3000)
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:
return solution
else:
raise Exception('Captcha Error')
finally:
wdlg.close()
def do_captcha(html):
solvemedia = re.search('