diff options
| author | 2016-03-07 18:48:34 +0100 | |
|---|---|---|
| committer | 2016-03-07 18:48:34 +0100 | |
| commit | 461e7507bf4f424e758ab5b83082f687b51f6c27 (patch) | |
| tree | 02f3e16632578ad31d2fc1e843646447f801e97f /module | |
| parent | Merge pull request #2375 from sodd/adecaptcha (diff) | |
| download | pyload-461e7507bf4f424e758ab5b83082f687b51f6c27.tar.xz | |
[UlzTo] fix #2377
Diffstat (limited to 'module')
| -rw-r--r-- | module/plugins/captcha/UlozTo.py | 41 | 
1 files changed, 25 insertions, 16 deletions
| diff --git a/module/plugins/captcha/UlozTo.py b/module/plugins/captcha/UlozTo.py index 7e7297138..9a9ed0ffd 100644 --- a/module/plugins/captcha/UlozTo.py +++ b/module/plugins/captcha/UlozTo.py @@ -1,26 +1,35 @@ -try: -        import adecaptcha.clslib as clslib -        adecaptcha_available = True -except ImportError: -        adecaptcha_available = False +# -*- coding: utf-8 -*-  import os.path +from module.plugins.internal.OCR import OCR +try: +    import adecaptcha.clslib as clslib +except ImportError: +    pass -class UlozTo(object): -    __name__ = "UlozTo" -    def __init__(self, plugin=None): -        pass -        self._plugin=plugin + +class UlozTo(OCR): +    __name__ =    "UlozTo" +    __type__    = "captcha" +    __version__ = "0.02" +    __status__  = "testing" + +    __description__ = """UlozTo audio captcha service plugin""" +    __license__     = "GPLv3" +    __authors__     = [("sodd",      None                        ), +                       ("GammaC0de", "nitzo2001[AT]yahoo[DOT]com")]      def recognize(self, audio):          """ Audio decoding - more info could be found at https://launchpad.net/adecaptcha """          #print "!!!CAPTCHA :", audio -        if adecaptcha_available: -                cfg_file=os.path.join(os.path.split(clslib.__file__)[0], 'ulozto.cfg') -                text= clslib.classify_audio_file(audio, cfg_file) -                return text -        else: -                pass +        try: +            cfg_file = os.path.join(os.path.split(clslib.__file__)[0], 'ulozto.cfg') +            text = clslib.classify_audio_file(audio, cfg_file) +            return text + +        except NameError: +            self.log_error(_("Unable to decode audio captcha"), +                           _("Please install adecaptcha library from https://github.com/izderadicka/adecaptcha")) | 
