summaryrefslogtreecommitdiffstats
path: root/module/plugins/addons/MultishareCz.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2012-09-18 17:59:50 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2012-09-18 17:59:50 +0200
commit6130a2377ca6754fee88773097ce220abef1aa47 (patch)
tree76bea0d76393100fcf393c164c96d34f286aba7a /module/plugins/addons/MultishareCz.py
parentAdded DuckcryptInfo decrypter, smaller fixes (diff)
parentdropdowns in navbar (diff)
downloadpyload-6130a2377ca6754fee88773097ce220abef1aa47.tar.xz
merged stable into default
Diffstat (limited to 'module/plugins/addons/MultishareCz.py')
-rw-r--r--module/plugins/addons/MultishareCz.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/module/plugins/addons/MultishareCz.py b/module/plugins/addons/MultishareCz.py
new file mode 100644
index 000000000..a00c6cb2b
--- /dev/null
+++ b/module/plugins/addons/MultishareCz.py
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+
+from module.network.RequestFactory import getURL
+from module.plugins.internal.MultiHoster import MultiHoster
+import re
+
+def getConfigSet(option):
+ s = set(option.lower().split('|'))
+ s.discard(u'')
+ return s
+
+class MultishareCz(MultiHoster):
+ __name__ = "MultishareCz"
+ __version__ = "0.03"
+ __type__ = "hook"
+ __config__ = [("activated", "bool", "Activated", "False"),
+ ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"),
+ ("hosterList", "str", "Hoster list (comma separated)", "uloz.to")]
+ __description__ = """MultiShare.cz hook plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ replacements = [("share-rapid.cz", "sharerapid.com")]
+ HOSTER_PATTERN = r'<img class="logo-shareserveru"[^>]*?alt="([^"]+)"></td>\s*<td class="stav">[^>]*?alt="OK"'
+
+ def getHoster(self):
+
+ page = getURL("http://www.multishare.cz/monitoring/")
+ hosters = set(h.lower().strip() for h in re.findall(self.HOSTER_PATTERN, page))
+
+ configMode = self.getConfig('hosterListMode')
+ if configMode in ("listed", "unlisted"):
+ configList = set(self.getConfig('hosterList').strip().lower().replace('|',',').replace(';',',').split(','))
+ configList.discard(u'')
+ if configMode == "listed":
+ hosters &= configList
+ elif configMode == "unlisted":
+ hosters -= configList
+
+ return list(hosters) \ No newline at end of file