Example #1
0
    def img_parser(self, image, referer):
        try:
            if not image.startswith('http:'): image = 'http:' + image
            result = client.request(image, referer=referer)

            image, width, height = re.compile("<img\s+src='([^']+)'\s+width='(\d+)'\s+height='(\d+)'").findall(result)[0]
            click = re.compile("href='([^']+)").findall(result)[0]

            image = client.replaceHTMLCodes(image)
            image = image.encode('utf-8')

            width, height = int(width), int(height)
            left = (1280 - width) / 2

            if width <= 0 or height <= 0: raise Exception()

            f = control.image(left,0,width,height, image)
            d = control.windowDialog
            d.addControl(f)
            d.show()

            client.request(image, referer=referer)

            control.dialog.ok(control.addonInfo('name'), str('Continue to Video'), '')

            if random.randint(0, 100) < 5:
                client.request(click, referer=referer)

            try: d.removeControl(f) ; d.close()
            except: return
        except:
            try: d.removeControl(f) ; d.close()
            except: return
Example #2
0
    def img_parser(self, image, referer):
        try:
            if not image.startswith('http:'): image = 'http:' + image

            d = control.windowDialog

            result = client.request(image, referer=referer, close=False)

            for match in re.finditer("<img\s+src='([^']+)'\s+width='(\d+)'\s+height='(\d+)'", result):
                img_url, width, height = match.groups()
                img_url = client.replaceHTMLCodes(img_url)
                width = int(width)
                height = int(height)
                if width > 0 and height > 0:
                    left = (1280 - width) / 2
                    f = control.image(left, 0, width, height, img_url)
                    d.addControl(f)
                else:
                    client.request(img_url, referer=image, close=False)

            d.show()

            control.dialog.ok(control.addonInfo('name'), str('Continue to Video'), '')

            match = re.search("href='([^']+)", result)
            if match and random.randint(0, 100) < 5:
                client.request(match.group(1))

            try: d.removeControl(f) ; d.close()
            except: return
        except:
            try: d.removeControl(f) ; d.close()
            except: return
Example #3
0
    def img_parser(self, image, referer):
        try:
            if not image.startswith('http:'): image = 'http:' + image

            d = control.windowDialog

            result = client.request(image, referer=referer, close=False)

            for match in re.finditer(
                    "<img\s+src='([^']+)'\s+width='(\d+)'\s+height='(\d+)'",
                    result):
                img_url, width, height = match.groups()
                img_url = client.replaceHTMLCodes(img_url)
                width = int(width)
                height = int(height)
                if width > 0 and height > 0:
                    left = (1280 - width) / 2
                    f = control.image(left, 0, width, height, img_url)
                    d.addControl(f)
                else:
                    client.request(img_url, referer=image, close=False)

            d.show()

            control.dialog.ok(control.addonInfo('name'),
                              str('Continue to Video'), '')

            match = re.search("href='([^']+)", result)
            if match and random.randint(0, 100) < 5:
                result = client.request(match.group(1), close=False)
                match = re.search("location=decode\('([^']+)", result)
                client.request(match.group(1))

            try:
                d.removeControl(f)
                d.close()
            except:
                return
        except:
            try:
                d.removeControl(f)
                d.close()
            except:
                return
Example #4
0
def keyboard(response):
    try:
        i = os.path.join(control.dataPath, 'img')
        f = control.openFile(i, 'w')
        f.write(client.request(response))
        f.close()
        f = control.image(450, 5, 375, 115, i)
        d = control.windowDialog
        d.addControl(f)
        control.deleteFile(i)
        d.show()
        t = 'Type the letters in the image'
        k = control.keyboard('', t)
        k.doModal()
        c = k.getText() if k.isConfirmed() else None
        if c == '': c = None
        d.removeControl(f)
        d.close()
        return c
    except:
        return
Example #5
0
def keyboard(response):
    try:
        i = os.path.join(control.dataPath,'img')
        f = control.openFile(i, 'w')
        f.write(client.request(response))
        f.close()
        f = control.image(450,5,375,115, i)
        d = control.windowDialog
        d.addControl(f)
        control.deleteFile(i)
        d.show()
        t = 'Type the letters in the image'
        k = control.keyboard('', t)
        k.doModal()
        c = k.getText() if k.isConfirmed() else None
        if c == '': c = None
        d.removeControl(f)
        d.close()
        return c
    except:
        return