diff options
Diffstat (limited to 'module/plugins/hooks/LinkdecrypterCom.py')
-rw-r--r-- | module/plugins/hooks/LinkdecrypterCom.py | 59 |
1 files changed, 28 insertions, 31 deletions
diff --git a/module/plugins/hooks/LinkdecrypterCom.py b/module/plugins/hooks/LinkdecrypterCom.py index dd9cd79f2..b0ce335d0 100644 --- a/module/plugins/hooks/LinkdecrypterCom.py +++ b/module/plugins/hooks/LinkdecrypterCom.py @@ -1,36 +1,26 @@ # -*- coding: utf-8 -*- -""" - 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 <http://www.gnu.org/licenses/>. - - @author: zoidberg -""" - import re -from module.plugins.Hook import Hook from module.network.RequestFactory import getURL +from module.plugins.Hook import Hook from module.utils import remove_chars class LinkdecrypterCom(Hook): - __name__ = "LinkdecrypterCom" - __version__ = "0.19" + __name__ = "LinkdecrypterCom" + __type__ = "hook" + __version__ = "0.21" + __description__ = """Linkdecrypter.com hook plugin""" - __config__ = [("activated", "bool", "Activated", False)] - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + + + #@TODO: Remove in 0.4.10 + def initPeriodical(self): + pass + def coreReady(self): try: @@ -38,15 +28,22 @@ class LinkdecrypterCom(Hook): except Exception, e: self.logError(e) + def loadPatterns(self): - page = getURL("http://linkdecrypter.com/") - m = re.search(r'<b>Supported\(\d+\)</b>: <i>([^+<]*)', page) - if not m: + html = getURL("http://linkdecrypter.com/") + + m = re.search(r'<title>', html) + if m is None: + self.logError(_("Linkdecrypter site is down")) + return + + m = re.search(r'<b>Supported\(\d+\)</b>: <i>([^+<]*)', html) + if m is None: self.logError(_("Crypter list not found")) return builtin = [name.lower() for name in self.core.pluginManager.crypterPlugins.keys()] - builtin.extend(["downloadserienjunkiesorg"]) + builtin.append("downloadserienjunkiesorg") crypter_pattern = re.compile("(\w[\w.-]+)") online = [] @@ -59,10 +56,10 @@ class LinkdecrypterCom(Hook): self.logError(_("Crypter list is empty")) return - regexp = r"https?://([^.]+\.)*?(%s)/.*" % "|".join(online) + regexp = r'https?://([^.]+\.)*?(%s)/.*' % '|'.join(online) dict = self.core.pluginManager.crypterPlugins[self.__name__] - dict["pattern"] = regexp - dict["re"] = re.compile(regexp) + dict['pattern'] = regexp + dict['re'] = re.compile(regexp) - self.logDebug("REGEXP: " + regexp) + self.logDebug("Loaded pattern: %s" % regexp) |