From 7a7e3e211e36af06d00e0effbcc37ac59e152427 Mon Sep 17 00:00:00 2001 From: synweap15 Date: Tue, 8 Jul 2014 20:00:23 +0200 Subject: nopremium.pl files added --- module/plugins/hooks/NoPremiumPl.py | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 module/plugins/hooks/NoPremiumPl.py (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/NoPremiumPl.py b/module/plugins/hooks/NoPremiumPl.py new file mode 100644 index 000000000..154d748f1 --- /dev/null +++ b/module/plugins/hooks/NoPremiumPl.py @@ -0,0 +1,39 @@ +# !/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +@author: Pawel W. +""" + +from module.plugins.internal.MultiHoster import MultiHoster +from module.network.RequestFactory import getURL + +try: + from json import loads +except ImportError: + from simplejson import loads + +class NoPremiumPl(MultiHoster): + __name__ = "NoPremiumPl" + __version__ = "0.01" + __type__ = "hook" + + __config__ = [("activated", "bool", "Activated", "False"), + ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), + ("hosterList", "str", "Hoster list (comma separated)", ""), + ("unloadFailing", "bool", "Try standard download if download fails", "False"), + ("interval", "int", "Reload supported hosts interval in hours (0 to disable)", "24")] + + __description__ = "NoPremium.pl hook" + __author_name__ = ("goddie") + __author_mail__ = ("dev@nopremium.pl") + + def getHoster(self): + + hostings = loads(getURL("https://www.nopremium.pl/clipboard.php?json=3").strip()) + return [domain for row in hostings for domain in row["domains"] if row["sdownload"] == "0"] + + def getHosterCached(self): + return self.getHoster() + + -- cgit v1.2.3 From 2404538888ced4e6964df55823d0514b1c0ba685 Mon Sep 17 00:00:00 2001 From: synweap15 Date: Tue, 8 Jul 2014 20:03:27 +0200 Subject: rapideo.pl files added --- module/plugins/hooks/RapideoPl.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 module/plugins/hooks/RapideoPl.py (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/RapideoPl.py b/module/plugins/hooks/RapideoPl.py new file mode 100644 index 000000000..5d7673826 --- /dev/null +++ b/module/plugins/hooks/RapideoPl.py @@ -0,0 +1,38 @@ +# !/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +@author: Pawel W. +""" +from module.plugins.internal.MultiHoster import MultiHoster +from module.network.RequestFactory import getURL + +try: + from json import loads +except ImportError: + from simplejson import loads + +class RapideoPl(MultiHoster): + __name__ = "RapideoPl" + __version__ = "0.01" + __type__ = "hook" + + __config__ = [("activated", "bool", "Activated", "False"), + ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), + ("hosterList", "str", "Hoster list (comma separated)", ""), + ("unloadFailing", "bool", "Try standard download if download fails", "False"), + ("interval", "int", "Reload supported hosts interval in hours (0 to disable)", "24")] + + __description__ = "Rapideo.pl hook" + __author_name__ = ("goddie") + __author_mail__ = ("dev@rapideo.pl") + + def getHoster(self): + + hostings = loads(getURL("https://www.rapideo.pl/clipboard.php?json=3").strip()) + return [domain for row in hostings for domain in row["domains"] if row["sdownload"] == "0"] + + def getHosterCached(self): + return self.getHoster() + + -- cgit v1.2.3 From ccf15e75c12ad1e8347fdff834f8c62e5e2ab617 Mon Sep 17 00:00:00 2001 From: synweap15 Date: Tue, 8 Jul 2014 21:33:01 +0200 Subject: remove redundant author information --- module/plugins/hooks/NoPremiumPl.py | 4 ---- 1 file changed, 4 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/NoPremiumPl.py b/module/plugins/hooks/NoPremiumPl.py index 154d748f1..527119c5f 100644 --- a/module/plugins/hooks/NoPremiumPl.py +++ b/module/plugins/hooks/NoPremiumPl.py @@ -1,10 +1,6 @@ # !/usr/bin/env python # -*- coding: utf-8 -*- -""" -@author: Pawel W. -""" - from module.plugins.internal.MultiHoster import MultiHoster from module.network.RequestFactory import getURL -- cgit v1.2.3 From ea1cbeda0006bbf427223686892c9e6f87cfbe94 Mon Sep 17 00:00:00 2001 From: synweap15 Date: Tue, 8 Jul 2014 21:36:14 +0200 Subject: remove redundant author information --- module/plugins/hooks/RapideoPl.py | 3 --- 1 file changed, 3 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/RapideoPl.py b/module/plugins/hooks/RapideoPl.py index 5d7673826..e032b426d 100644 --- a/module/plugins/hooks/RapideoPl.py +++ b/module/plugins/hooks/RapideoPl.py @@ -1,9 +1,6 @@ # !/usr/bin/env python # -*- coding: utf-8 -*- -""" -@author: Pawel W. -""" from module.plugins.internal.MultiHoster import MultiHoster from module.network.RequestFactory import getURL -- cgit v1.2.3 From 2ed13d51ab8cd28f2f3db4caabde9b6d2e2cec25 Mon Sep 17 00:00:00 2001 From: synweap15 Date: Wed, 9 Jul 2014 11:55:23 +0200 Subject: remove enviroment line --- module/plugins/hooks/RapideoPl.py | 1 - 1 file changed, 1 deletion(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/RapideoPl.py b/module/plugins/hooks/RapideoPl.py index e032b426d..fa3df9f84 100644 --- a/module/plugins/hooks/RapideoPl.py +++ b/module/plugins/hooks/RapideoPl.py @@ -1,4 +1,3 @@ -# !/usr/bin/env python # -*- coding: utf-8 -*- from module.plugins.internal.MultiHoster import MultiHoster -- cgit v1.2.3 From e325412cd71ae329f3f0b7084e5989e6ffbdbd18 Mon Sep 17 00:00:00 2001 From: synweap15 Date: Wed, 9 Jul 2014 11:57:05 +0200 Subject: remove enviroment line --- module/plugins/hooks/NoPremiumPl.py | 1 - 1 file changed, 1 deletion(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/NoPremiumPl.py b/module/plugins/hooks/NoPremiumPl.py index 527119c5f..ef36331eb 100644 --- a/module/plugins/hooks/NoPremiumPl.py +++ b/module/plugins/hooks/NoPremiumPl.py @@ -1,4 +1,3 @@ -# !/usr/bin/env python # -*- coding: utf-8 -*- from module.plugins.internal.MultiHoster import MultiHoster -- cgit v1.2.3 From 352301e4892d311d1a4cf6127f6bc70bc23eede3 Mon Sep 17 00:00:00 2001 From: synweap15 Date: Wed, 9 Jul 2014 12:02:59 +0200 Subject: remove blank lines and unused imports --- module/plugins/hooks/NoPremiumPl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/NoPremiumPl.py b/module/plugins/hooks/NoPremiumPl.py index ef36331eb..121e92f91 100644 --- a/module/plugins/hooks/NoPremiumPl.py +++ b/module/plugins/hooks/NoPremiumPl.py @@ -24,8 +24,8 @@ class NoPremiumPl(MultiHoster): __author_mail__ = ("dev@nopremium.pl") def getHoster(self): - hostings = loads(getURL("https://www.nopremium.pl/clipboard.php?json=3").strip()) + return [domain for row in hostings for domain in row["domains"] if row["sdownload"] == "0"] def getHosterCached(self): -- cgit v1.2.3 From ce18793af9864acdf9e9c71b7324d923a53adaad Mon Sep 17 00:00:00 2001 From: synweap15 Date: Wed, 9 Jul 2014 12:05:22 +0200 Subject: fix json loads, dumps on ImportError exception --- module/plugins/hooks/NoPremiumPl.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/NoPremiumPl.py b/module/plugins/hooks/NoPremiumPl.py index 121e92f91..47aa117df 100644 --- a/module/plugins/hooks/NoPremiumPl.py +++ b/module/plugins/hooks/NoPremiumPl.py @@ -4,9 +4,10 @@ from module.plugins.internal.MultiHoster import MultiHoster from module.network.RequestFactory import getURL try: - from json import loads + from json import loads, dumps except ImportError: - from simplejson import loads + from module.common.json_layer import json_loads as loads + from module.common.json_layer import json_dumps as dumps class NoPremiumPl(MultiHoster): __name__ = "NoPremiumPl" -- cgit v1.2.3 From dfd5cb44138494b803f66559747cacc1260b5595 Mon Sep 17 00:00:00 2001 From: synweap15 Date: Wed, 9 Jul 2014 12:15:03 +0200 Subject: simplify json loads, replace crypto with hashlib --- module/plugins/hooks/NoPremiumPl.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/NoPremiumPl.py b/module/plugins/hooks/NoPremiumPl.py index 47aa117df..1357c95e8 100644 --- a/module/plugins/hooks/NoPremiumPl.py +++ b/module/plugins/hooks/NoPremiumPl.py @@ -3,11 +3,9 @@ from module.plugins.internal.MultiHoster import MultiHoster from module.network.RequestFactory import getURL -try: - from json import loads, dumps -except ImportError: - from module.common.json_layer import json_loads as loads - from module.common.json_layer import json_dumps as dumps +from module.common.json_layer import json_loads as loads + + class NoPremiumPl(MultiHoster): __name__ = "NoPremiumPl" -- cgit v1.2.3 From 2e8ed2bf0b357e907f6921c7bb88719bb347367b Mon Sep 17 00:00:00 2001 From: synweap15 Date: Wed, 9 Jul 2014 13:47:49 +0200 Subject: remove blank lines and unused imports --- module/plugins/hooks/RapideoPl.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/RapideoPl.py b/module/plugins/hooks/RapideoPl.py index fa3df9f84..de1a80908 100644 --- a/module/plugins/hooks/RapideoPl.py +++ b/module/plugins/hooks/RapideoPl.py @@ -8,6 +8,7 @@ try: except ImportError: from simplejson import loads + class RapideoPl(MultiHoster): __name__ = "RapideoPl" __version__ = "0.01" @@ -24,8 +25,8 @@ class RapideoPl(MultiHoster): __author_mail__ = ("dev@rapideo.pl") def getHoster(self): - hostings = loads(getURL("https://www.rapideo.pl/clipboard.php?json=3").strip()) + return [domain for row in hostings for domain in row["domains"] if row["sdownload"] == "0"] def getHosterCached(self): -- cgit v1.2.3 From 25d2cceff065a0268a7e183449ef54edf98f1783 Mon Sep 17 00:00:00 2001 From: synweap15 Date: Wed, 9 Jul 2014 13:49:12 +0200 Subject: simplify json loads, replace crypto with hashlib --- module/plugins/hooks/RapideoPl.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/RapideoPl.py b/module/plugins/hooks/RapideoPl.py index de1a80908..0c5327903 100644 --- a/module/plugins/hooks/RapideoPl.py +++ b/module/plugins/hooks/RapideoPl.py @@ -2,12 +2,7 @@ from module.plugins.internal.MultiHoster import MultiHoster from module.network.RequestFactory import getURL - -try: - from json import loads -except ImportError: - from simplejson import loads - +from module.common.json_layer import json_loads as loads class RapideoPl(MultiHoster): __name__ = "RapideoPl" -- cgit v1.2.3 From 88ba5ecd9027ffa7a8bb5eb207085295ad35724d Mon Sep 17 00:00:00 2001 From: synweap15 Date: Wed, 9 Jul 2014 13:49:42 +0200 Subject: newline fix --- module/plugins/hooks/RapideoPl.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/RapideoPl.py b/module/plugins/hooks/RapideoPl.py index 0c5327903..910dd175b 100644 --- a/module/plugins/hooks/RapideoPl.py +++ b/module/plugins/hooks/RapideoPl.py @@ -4,6 +4,7 @@ from module.plugins.internal.MultiHoster import MultiHoster from module.network.RequestFactory import getURL from module.common.json_layer import json_loads as loads + class RapideoPl(MultiHoster): __name__ = "RapideoPl" __version__ = "0.01" -- cgit v1.2.3 From 0824528da43d0842c15ffa0d4fe132309ca592eb Mon Sep 17 00:00:00 2001 From: synweap15 Date: Wed, 9 Jul 2014 14:05:40 +0200 Subject: newline fix --- module/plugins/hooks/NoPremiumPl.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/NoPremiumPl.py b/module/plugins/hooks/NoPremiumPl.py index 1357c95e8..757af6037 100644 --- a/module/plugins/hooks/NoPremiumPl.py +++ b/module/plugins/hooks/NoPremiumPl.py @@ -2,11 +2,9 @@ from module.plugins.internal.MultiHoster import MultiHoster from module.network.RequestFactory import getURL - from module.common.json_layer import json_loads as loads - class NoPremiumPl(MultiHoster): __name__ = "NoPremiumPl" __version__ = "0.01" -- cgit v1.2.3 From 36b5bfedc2e57bd000831559ca8fb4d7e7899e24 Mon Sep 17 00:00:00 2001 From: tjeh Date: Sun, 20 Jul 2014 21:49:27 +0200 Subject: Added support for Multihosters.com multihoster. --- module/plugins/hooks/MultihostersCom.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 module/plugins/hooks/MultihostersCom.py (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/MultihostersCom.py b/module/plugins/hooks/MultihostersCom.py new file mode 100644 index 000000000..5ada3aa56 --- /dev/null +++ b/module/plugins/hooks/MultihostersCom.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- + +from module.network.RequestFactory import getURL +from module.plugins.internal.MultiHoster import MultiHoster + +class MultihostersCom(MultiHoster): + __name__ = "MultihostersCom" + __version__ = "0.01" + __type__ = "hook" + __config__ = [("activated", "bool", "Activated", False), + ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + ("hosterList", "str", "Hoster list (comma separated)", ""), + ("unloadFailing", "bool", "Revert to standard download if download fails", False), + ("interval", "int", "Reload interval in hours (0 to disable)", 24)] + + __description__ = """Multihosters.com hook plugin""" + __author_name__ = "tjeh" + __author_mail__ = "tjeh@gmx.net" + + def getHoster(self): + page = getURL("http://www.multihosters.com/jDownloader.ashx?cmd=gethosters") + return [x.strip() for x in page.split(",")] \ No newline at end of file -- cgit v1.2.3 From 3554160654a1cb8e7000ebeea06aecdabc91af8e Mon Sep 17 00:00:00 2001 From: glukgluk Date: Thu, 7 Aug 2014 22:33:47 +0200 Subject: Create JustPremium.py --- module/plugins/hooks/JustPremium.py | 76 +++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 module/plugins/hooks/JustPremium.py (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/JustPremium.py b/module/plugins/hooks/JustPremium.py new file mode 100644 index 000000000..17028ef5e --- /dev/null +++ b/module/plugins/hooks/JustPremium.py @@ -0,0 +1,76 @@ +# -*- 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 . + + @author: mazleu +""" +from module.plugins.Hook import Hook +from module.plugins.Account import Account +from module.plugins.Hoster import Hoster + + +class JustPremium(Hook): + __name__ = "JustPremium" + __version__ = "0.15" + __description__ = "If you add multiple links with at least one premium hoster link, all non premium links get removed" + __config__ = [("activated", "bool", "Activated", "False"), + ("freehosters","bool", "Allow all freehosters and other unknown sites", "false"), + ("nicehoster", "str", "unblock this hosters (comma seperated)", "Zippyshare.com")] + + __author_name__ = ("mazleu") + __author_mail__ = ("mazleica@gmail.com") + + event_list = ["linksAdded"] + + def coreReady(self) : + accs=str(self.core.accountManager.getAccountInfos()) + global badhosts + global hosts + hosts = "" + while "[{" in accs: + startid=accs.rfind("[], ", 0, accs.find("[{"))+2 + endid=accs.find("}]",startid)+2 + hosts=hosts+","+accs[startid+3:accs.find("'",startid+3)] + accs=accs[0:startid]+accs[endid:] + badhosts=accs.replace("': [], '",",")[2:-6] + hosts=hosts[1:] + hosts=hosts+","+self.getConfig("nicehoster") + self.logDebug("good hosts:",hosts) + self.logDebug("bad hosts:",badhosts) + + + def filterLinks(self, t): + links = self.core.api.checkURLs(t) + hosterlist ="" + bhosters = [x.strip() for x in badhosts.split(",")] + ghosters = [x.strip() for x in hosts.split(",")] + premhoster = False + for hoster in links: + self.logDebug(hoster) + if hoster in ghosters: + premhoster = True + if premhoster : + for hoster in links: + if self.getConfig("freehosters"): + if hoster in bhosters: + for link in links[hoster]: + t.remove(link) + self.logDebug("removed link '%s'because hoster was: '%s' " % (link,hoster)) + else: + if not hoster in ghosters: + for link in links[hoster]: + t.remove(link) + self.logDebug("removed link '%s'because hoster was: '%s' " % (link,hoster)) + def linksAdded(self, links, pid): + self.filterLinks(links) -- cgit v1.2.3 From dabe45332a554aba173c47754d39b514fa77c1bb Mon Sep 17 00:00:00 2001 From: glukgluk Date: Fri, 8 Aug 2014 21:53:56 +0200 Subject: Update JustPremium.py --- module/plugins/hooks/JustPremium.py | 77 +++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 37 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/JustPremium.py b/module/plugins/hooks/JustPremium.py index 17028ef5e..2c5788b75 100644 --- a/module/plugins/hooks/JustPremium.py +++ b/module/plugins/hooks/JustPremium.py @@ -22,55 +22,58 @@ from module.plugins.Hoster import Hoster class JustPremium(Hook): __name__ = "JustPremium" - __version__ = "0.15" + __version__ = "0.16" __description__ = "If you add multiple links with at least one premium hoster link, all non premium links get removed" __config__ = [("activated", "bool", "Activated", "False"), - ("freehosters","bool", "Allow all freehosters and other unknown sites", "false"), + ("freehosters","bool", "Allow all freehosters and other unknown sites", "false"), ("nicehoster", "str", "unblock this hosters (comma seperated)", "Zippyshare.com")] - + __author_name__ = ("mazleu") __author_mail__ = ("mazleica@gmail.com") event_list = ["linksAdded"] - - def coreReady(self) : + + def coreReady(self) : accs=str(self.core.accountManager.getAccountInfos()) - global badhosts - global hosts - hosts = "" - while "[{" in accs: - startid=accs.rfind("[], ", 0, accs.find("[{"))+2 - endid=accs.find("}]",startid)+2 - hosts=hosts+","+accs[startid+3:accs.find("'",startid+3)] - accs=accs[0:startid]+accs[endid:] - badhosts=accs.replace("': [], '",",")[2:-6] - hosts=hosts[1:] - hosts=hosts+","+self.getConfig("nicehoster") - self.logDebug("good hosts:",hosts) - self.logDebug("bad hosts:",badhosts) + global badhosts + global hosts + hosts = "" + while "[{" in accs: + startid=accs.rfind("[], ", 0, accs.find("[{"))+2 + endid=accs.find("}]",startid)+2 + hosts=hosts+","+accs[startid+3:accs.find("'",startid+3)] + accs=accs[0:startid]+accs[endid:] + badhosts=accs.replace("': [], '",",")[2:-6] + hosts=hosts[1:] + hosts=hosts+","+self.getConfig("nicehoster") + self.logDebug("good hosts:",hosts) + self.logDebug("bad hosts:",badhosts) - def filterLinks(self, t): - links = self.core.api.checkURLs(t) + def filterLinks(self, t): + links = self.core.api.checkURLs(t) hosterlist ="" - bhosters = [x.strip() for x in badhosts.split(",")] - ghosters = [x.strip() for x in hosts.split(",")] - premhoster = False - for hoster in links: - self.logDebug(hoster) + bhosters = [x.strip() for x in badhosts.split(",")] + ghosters = [x.strip() for x in hosts.split(",")] + premhoster = False + for hoster in links: + self.logDebug(hoster) if hoster in ghosters: premhoster = True - if premhoster : - for hoster in links: - if self.getConfig("freehosters"): - if hoster in bhosters: - for link in links[hoster]: - t.remove(link) - self.logDebug("removed link '%s'because hoster was: '%s' " % (link,hoster)) - else: - if not hoster in ghosters: - for link in links[hoster]: - t.remove(link) - self.logDebug("removed link '%s'because hoster was: '%s' " % (link,hoster)) + self.logDebug ("Found at least one hoster with account") + if premhoster : + for hoster in links: + if self.getConfig("freehosters"): + if hoster in bhosters: + self.logInfo("remove links from hoster '%s' " % (hoster)) + for link in links[hoster]: + t.remove(link) + self.logDebug("remove link '%s'because hoster was: '%s' " % (link,hoster)) + else: + if not hoster in ghosters: + self.logInfo("remove links from hoster '%s' " % (hoster)) + for link in links[hoster]: + t.remove(link) + self.logDebug("remove link '%s' because hoster was: '%s' " % (link,hoster)) def linksAdded(self, links, pid): self.filterLinks(links) -- cgit v1.2.3 From 168f175ce4765dec7e847c45d95e4babe20a7193 Mon Sep 17 00:00:00 2001 From: synweap15 Date: Mon, 3 Nov 2014 14:42:05 +0100 Subject: New __authors__ key, added __license__ --- module/plugins/hooks/NoPremiumPl.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/NoPremiumPl.py b/module/plugins/hooks/NoPremiumPl.py index 757af6037..f60cb3dd6 100644 --- a/module/plugins/hooks/NoPremiumPl.py +++ b/module/plugins/hooks/NoPremiumPl.py @@ -17,8 +17,8 @@ class NoPremiumPl(MultiHoster): ("interval", "int", "Reload supported hosts interval in hours (0 to disable)", "24")] __description__ = "NoPremium.pl hook" - __author_name__ = ("goddie") - __author_mail__ = ("dev@nopremium.pl") + __license__ = "GPLv3" + __authors__ = [("goddie", "dev@nopremium.pl")] def getHoster(self): hostings = loads(getURL("https://www.nopremium.pl/clipboard.php?json=3").strip()) -- cgit v1.2.3 From 005710831caa04bbe372b54ac357658963fe02bb Mon Sep 17 00:00:00 2001 From: synweap15 Date: Mon, 3 Nov 2014 14:44:44 +0100 Subject: New __authors__ key, added __license__ --- module/plugins/hooks/RapideoPl.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/RapideoPl.py b/module/plugins/hooks/RapideoPl.py index 910dd175b..a5d7a34a5 100644 --- a/module/plugins/hooks/RapideoPl.py +++ b/module/plugins/hooks/RapideoPl.py @@ -17,8 +17,8 @@ class RapideoPl(MultiHoster): ("interval", "int", "Reload supported hosts interval in hours (0 to disable)", "24")] __description__ = "Rapideo.pl hook" - __author_name__ = ("goddie") - __author_mail__ = ("dev@rapideo.pl") + __license__ = "GPLv3" + __authors__ = [("goddie", "dev@rapideo.pl")] def getHoster(self): hostings = loads(getURL("https://www.rapideo.pl/clipboard.php?json=3").strip()) -- cgit v1.2.3 From 430092f0ba67e4bb2dd75433b08340d0afca0fa9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 12 Dec 2014 20:34:42 +0100 Subject: Update plugins after SimpleHoster changes --- module/plugins/hooks/SkipRev.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index 609bb4197..107740a3d 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -10,7 +10,7 @@ from module.plugins.Plugin import SkipDownload class SkipRev(Hook): __name__ = "SkipRev" __type__ = "hook" - __version__ = "0.14" + __version__ = "0.15" __config__ = [("tokeep", "int", "Number of rev files to keep for package (-1 to auto)", -1)] @@ -37,10 +37,10 @@ class SkipRev(Hook): if hasattr(plugin, "info") and 'name' in plugin.info and plugin.info['name']: name = plugin.info['name'] - elif hasattr(plugin, "parseInfo"): - name = next(plugin.parseInfo([url]))['name'] + elif hasattr(plugin, "parseInfos"): + name = next(plugin.parseInfos([url]))['name'] - elif hasattr(plugin, "getInfo"): #@NOTE: if parseInfo was not found, getInfo should be missing too + elif hasattr(plugin, "getInfo"): #@NOTE: if parseInfos was not found, getInfo should be missing too name = plugin.getInfo(url)['name'] else: -- cgit v1.2.3 From 3d27f5ccee412d38102873a5b02e3f236375eb97 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 16 Dec 2014 03:44:15 +0100 Subject: Update plugins (2) --- module/plugins/hooks/RestartSlow.py | 4 ++-- module/plugins/hooks/SkipRev.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/RestartSlow.py b/module/plugins/hooks/RestartSlow.py index 587799235..c2fdf6f95 100644 --- a/module/plugins/hooks/RestartSlow.py +++ b/module/plugins/hooks/RestartSlow.py @@ -8,7 +8,7 @@ from module.plugins.Hook import Hook class RestartSlow(Hook): __name__ = "RestartSlow" __type__ = "hook" - __version__ = "0.02" + __version__ = "0.03" __config__ = [("free_limit" , "int" , "Transfer speed threshold in kilobytes" , 100 ), ("free_time" , "int" , "Sample interval in minutes" , 5 ), @@ -45,7 +45,7 @@ class RestartSlow(Hook): limit = max(5, self.getConfig("%s_limit" % type) * 1024) chunks = [chunk for chunk in self.pyfile.req.dl.chunks \ - if chunk.id not in self.info['chunk'] or self.info['chunk'][chunk.id] not is (time, limit)] + if chunk.id not in self.info['chunk'] or self.info['chunk'][chunk.id] is not (time, limit)] for chunk in chunks: chunk.c.setopt(pycurl.LOW_SPEED_TIME , time) diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index 107740a3d..d21aa0f6d 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -10,7 +10,7 @@ from module.plugins.Plugin import SkipDownload class SkipRev(Hook): __name__ = "SkipRev" __type__ = "hook" - __version__ = "0.15" + __version__ = "0.16" __config__ = [("tokeep", "int", "Number of rev files to keep for package (-1 to auto)", -1)] @@ -45,13 +45,13 @@ class SkipRev(Hook): else: self.logWarning("Unable to grab file name") - name = urlparse(unquote(url)).path.split('/')[-1]) + name = urlparse(unquote(url)).path.split('/')[-1] return name def downloadPreparing(self, pyfile): - if pyfile.getStatusName() is "unskipped" or not pyname(pyfile).endswith(".rev"): + if pyfile.getStatusName() is "unskipped" or not self.pyname(pyfile).endswith(".rev"): return tokeep = self.getConfig("tokeep") -- cgit v1.2.3 From bc47c7282b093eabe70d7a04bb481789e4cebf65 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 16 Dec 2014 23:03:48 +0100 Subject: [SkipRev] Another fix --- module/plugins/hooks/SkipRev.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index d21aa0f6d..0c38ac9af 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -10,7 +10,7 @@ from module.plugins.Plugin import SkipDownload class SkipRev(Hook): __name__ = "SkipRev" __type__ = "hook" - __version__ = "0.16" + __version__ = "0.17" __config__ = [("tokeep", "int", "Number of rev files to keep for package (-1 to auto)", -1)] @@ -57,7 +57,7 @@ class SkipRev(Hook): tokeep = self.getConfig("tokeep") if tokeep: - saved = [True for link in pyfile.package().getChildren() \ + saved = [True for link in self.core.api.getPackageData(pyfile.packageid).links \ if link.name.endswith(".rev") and (link.hasStatus("finished") or link.hasStatus("downloading"))].count(True) if not saved or saved < tokeep: #: keep one rev at least in auto mode @@ -73,7 +73,7 @@ class SkipRev(Hook): if not tokeep: return - for link in pyfile.package().getChildren(): + for link in self.core.api.getPackageData(pyfile.packageid).links: if link.hasStatus("skipped") and link.name.endswith(".rev"): if tokeep > -1 or pyfile.name.endswith(".rev"): link.setStatus("queued") -- cgit v1.2.3 From 8bb189cf5495b293cf574e5049c34a64ae36ffe1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 16 Dec 2014 23:04:15 +0100 Subject: Spare code cosmetics --- module/plugins/hooks/ExtractArchive.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index fc77dbdf6..895aee51f 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -195,6 +195,7 @@ class ExtractArchive(Hook): if targets: self.logDebug("Targets for %s: %s" % (plugin.__name__, targets)) matched = True + for target, fid in targets: if target in processed: self.logDebug(basename(target), "skipped") @@ -206,8 +207,10 @@ class ExtractArchive(Hook): try: klass = plugin(self, target, out, fullpath, overwrite, excludefiles, renice) klass.init() - password = p.password.strip().splitlines() - new_files = self._extract(klass, fid, password, thread) + + passwords = p.password.strip().splitlines() + new_files = self._extract(klass, fid, passwords, thread) + except Exception, e: self.logError(basename(target), e) success = False @@ -256,13 +259,7 @@ class ExtractArchive(Hook): self.logInfo(basename(plugin.file), _("Password protected")) self.logDebug("Passwords", passwords) - pwlist = copy(self.getPasswords()) - # remove already supplied pws from list (only local) - for pw in passwords: - if pw in pwlist: - pwlist.remove(pw) - - for pw in passwords + pwlist: + for pw in set(passwords) + set(self.getPasswords()): try: self.logDebug("Try password", pw) if plugin.checkPassword(pw): @@ -270,6 +267,7 @@ class ExtractArchive(Hook): self.addPassword(pw) success = True break + except WrongPassword: self.logDebug("Password was wrong") @@ -297,8 +295,10 @@ class ExtractArchive(Hook): except ArchiveError, e: self.logError(basename(plugin.file), _("Archive Error"), e) + except CRCError: self.logError(basename(plugin.file), _("CRC Mismatch")) + except Exception, e: if self.core.debug: print_exc() -- cgit v1.2.3 From ad0483adfd5dcb931392cd26eb4961f74ce91122 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 17 Dec 2014 20:03:05 +0100 Subject: [DebridItaliaCom] Fix hook getHoster --- module/plugins/hooks/DebridItaliaCom.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/DebridItaliaCom.py b/module/plugins/hooks/DebridItaliaCom.py index b7f0ef1c7..43e910a4b 100644 --- a/module/plugins/hooks/DebridItaliaCom.py +++ b/module/plugins/hooks/DebridItaliaCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.MultiHoster import MultiHoster class DebridItaliaCom(MultiHoster): __name__ = "DebridItaliaCom" __type__ = "hook" - __version__ = "0.08" + __version__ = "0.09" __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", ""), @@ -23,5 +23,4 @@ class DebridItaliaCom(MultiHoster): def getHoster(self): - html = getURL("http://www.debriditalia.com/status.php") - return re.findall(r'title="(.+?)"> \1 Date: Wed, 17 Dec 2014 23:47:33 +0100 Subject: [LinestorageCom] Added hoster plugin --- module/plugins/hooks/XFileSharingPro.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py index e9b1b454e..10de43cc0 100644 --- a/module/plugins/hooks/XFileSharingPro.py +++ b/module/plugins/hooks/XFileSharingPro.py @@ -8,7 +8,7 @@ from module.plugins.Hook import Hook class XFileSharingPro(Hook): __name__ = "XFileSharingPro" __type__ = "hook" - __version__ = "0.26" + __version__ = "0.27" __config__ = [("activated", "bool", "Activated", True), ("use_hoster_list", "bool", "Load listed hosters only", True), @@ -30,7 +30,7 @@ class XFileSharingPro(Hook): HOSTER_LIST = [#WORKING HOSTERS: "eyesfile.ca", "file4safe.com", "fileband.com", "filedwon.com", "filevice.com", "hostingbulk.com", - "linestorage.com", "ravishare.com", "sharesix.com", "thefile.me", "verzend.be", "xvidstage.com", + "ravishare.com", "sharesix.com", "thefile.me", "verzend.be", "xvidstage.com", #NOT TESTED: "101shared.com", "4upfiles.com", "filemaze.ws", "filenuke.com", "linkzhost.com", "mightyupload.com", "rockdizfile.com", "sharebeast.com", "sharerepo.com", "shareswift.com", "uploadbaz.com", "uploadc.com", -- cgit v1.2.3 From da9e6c949243613f4d5e100cac6ff192449b4718 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 18 Dec 2014 18:45:17 +0100 Subject: Update extractor plugins --- module/plugins/hooks/ExtractArchive.py | 37 +++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 16 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 895aee51f..ddec8319b 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -16,7 +16,6 @@ if sys.version_info < (2, 7) and os.name != "nt": import errno from subprocess import Popen - def _eintr_retry_call(func, *args): while True: try: @@ -59,7 +58,7 @@ from module.utils import save_join, fs_encode class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "0.19" + __version__ = "0.20" __config__ = [("activated", "bool", "Activated", True), ("fullpath", "bool", "Extract full path", True), @@ -89,7 +88,7 @@ class ExtractArchive(Hook): def setup(self): - self.plugins = [] + self.plugins = [] self.passwords = [] names = [] @@ -141,24 +140,27 @@ class ExtractArchive(Hook): @threaded def allDownloadsProcessed(self, thread): local = copy(self.queue) + del self.queue[:] + if self.extract(local, thread): #: check only if all gone fine, no failed reporting for now self.manager.dispatchEvent("all_archives_extracted") + self.manager.dispatchEvent("all_archives_processed") def extract(self, ids, thread=None): processed = [] extracted = [] - failed = [] + failed = [] - destination = self.getConfig("destination") - subfolder = self.getConfig("subfolder") - fullpath = self.getConfig("fullpath") - overwrite = self.getConfig("overwrite") + destination = self.getConfig("destination") + subfolder = self.getConfig("subfolder") + fullpath = self.getConfig("fullpath") + overwrite = self.getConfig("overwrite") excludefiles = self.getConfig("excludefiles") - renice = self.getConfig("renice") - recursive = self.getConfig("recursive") + renice = self.getConfig("renice") + recursive = self.getConfig("recursive") # reload from txt file self.reloadPasswords() @@ -208,8 +210,7 @@ class ExtractArchive(Hook): klass = plugin(self, target, out, fullpath, overwrite, excludefiles, renice) klass.init() - passwords = p.password.strip().splitlines() - new_files = self._extract(klass, fid, passwords, thread) + new_files = self._extract(klass, fid, [p.password.strip()], thread) except Exception, e: self.logError(basename(target), e) @@ -253,15 +254,15 @@ class ExtractArchive(Hook): success = False if not plugin.checkArchive(): - plugin.extract(progress) + plugin.extract(progress, pw) success = True else: self.logInfo(basename(plugin.file), _("Password protected")) - self.logDebug("Passwords", passwords) + self.logDebug("Passwords: %s" % passwords if passwords else "No password provided") - for pw in set(passwords) + set(self.getPasswords()): + for pw in set(passwords) | set(self.getPasswords()): try: - self.logDebug("Try password", pw) + self.logDebug("Try password: %s" % pw) if plugin.checkPassword(pw): plugin.extract(progress, pw) self.addPassword(pw) @@ -305,6 +306,7 @@ class ExtractArchive(Hook): self.logError(basename(plugin.file), _("Unknown Error"), e) self.manager.dispatchEvent("archive_extract_failed", pyfile) + raise Exception(_("Extract failed")) @@ -344,6 +346,7 @@ class ExtractArchive(Hook): with open(passwordfile, "wb") as f: for pw in self.passwords: f.write(pw + "\n") + except IOError, e: self.logError(e) @@ -352,6 +355,7 @@ class ExtractArchive(Hook): for f in files: if not exists(f): continue + try: if self.config['permission']['change_file']: if isfile(f): @@ -363,5 +367,6 @@ class ExtractArchive(Hook): uid = getpwnam(self.config['permission']['user'])[2] gid = getgrnam(self.config['permission']['group'])[2] chown(f, uid, gid) + except Exception, e: self.logWarning(_("Setting User and Group failed"), e) -- cgit v1.2.3 From 854efeb463bd98cb8e22f1f78f5ce97e6c0ab49f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 22 Dec 2014 16:45:04 +0100 Subject: Spare code cosmetics --- module/plugins/hooks/Checksum.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index 18036e020..8d9f8f981 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -56,10 +56,10 @@ class Checksum(Hook): methods = {'sfv': 'crc32', 'crc': 'crc32', 'hash': 'md5'} - regexps = {'sfv': r'^(?P[^;].+)\s+(?P[0-9A-Fa-f]{8})$', - 'md5': r'^(?P[0-9A-Fa-f]{32}) (?P.+)$', - 'crc': r'filename=(?P.+)\nsize=(?P\d+)\ncrc32=(?P[0-9A-Fa-f]{8})$', - 'default': r'^(?P[0-9A-Fa-f]+)\s+\*?(?P.+)$'} + regexps = {'sfv': r'^(?P[^;].+)\s+(?P[0-9A-Fa-f]{8})$', + 'md5': r'^(?P[0-9A-Fa-f]{32}) (?P.+)$', + 'crc': r'filename=(?P.+)\nsize=(?P\d+)\ncrc32=(?P[0-9A-Fa-f]{8})$', + 'default': r'^(?P[0-9A-Fa-f]+)\s+\*?(?P.+)$'} #@TODO: Remove in 0.4.10 @@ -179,12 +179,12 @@ class Checksum(Hook): data = m.groupdict() self.logDebug(link['name'], data) - local_file = fs_encode(save_join(download_folder, data['name'])) + local_file = fs_encode(save_join(download_folder, data['NAME'])) algorithm = self.methods.get(file_type, file_type) checksum = computeChecksum(local_file, algorithm) - if checksum == data['hash']: + if checksum == data['HASH']: self.logInfo(_('File integrity of "%s" verified by %s checksum (%s)') % - (data['name'], algorithm, checksum)) + (data['NAME'], algorithm, checksum)) else: self.logWarning(_("%s checksum for file %s does not match (%s != %s)") % - (algorithm, data['name'], checksum, data['hash'])) + (algorithm, data['NAME'], checksum, data['HASH'])) -- cgit v1.2.3 From c10f5af761319b239381a24e2cf2f418e20d8744 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 22 Dec 2014 16:56:35 +0100 Subject: [XFileSharingPro] Support salefiles.com --- module/plugins/hooks/XFileSharingPro.py | 36 +++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py index 10de43cc0..946838e47 100644 --- a/module/plugins/hooks/XFileSharingPro.py +++ b/module/plugins/hooks/XFileSharingPro.py @@ -8,10 +8,10 @@ from module.plugins.Hook import Hook class XFileSharingPro(Hook): __name__ = "XFileSharingPro" __type__ = "hook" - __version__ = "0.27" + __version__ = "0.28" __config__ = [("activated", "bool", "Activated", True), - ("use_hoster_list", "bool", "Load listed hosters only", True), + ("use_hoster_list", "bool", "Load listed hosters only", False), ("use_crypter_list", "bool", "Load listed crypters only", False), ("use_builtin_list", "bool", "Load built-in plugin list", True), ("hoster_list", "str", "Hoster list (comma separated)", ""), @@ -30,7 +30,7 @@ class XFileSharingPro(Hook): HOSTER_LIST = [#WORKING HOSTERS: "eyesfile.ca", "file4safe.com", "fileband.com", "filedwon.com", "filevice.com", "hostingbulk.com", - "ravishare.com", "sharesix.com", "thefile.me", "verzend.be", "xvidstage.com", + "ravishare.com", "salefiles.com", "sharesix.com", "thefile.me", "verzend.be", "xvidstage.com", #NOT TESTED: "101shared.com", "4upfiles.com", "filemaze.ws", "filenuke.com", "linkzhost.com", "mightyupload.com", "rockdizfile.com", "sharebeast.com", "sharerepo.com", "shareswift.com", "uploadbaz.com", "uploadc.com", @@ -80,7 +80,10 @@ class XFileSharingPro(Hook): match_list = '|'.join(sorted(plugin_list)) len_match_list = len(plugin_list) - self.logInfo(_("Handling %d %s%s: %s") % (len_match_list, type, "" if len_match_list is 1 else "s", match_list.replace('|', ', '))) + self.logInfo(_("Handling %d %s%s: %s") % (len_match_list, + type, + "" if len_match_list is 1 else "s", + match_list.replace('|', ', '))) pattern = self.regexp[type][1] % match_list.replace('.', '\.') @@ -98,6 +101,31 @@ class XFileSharingPro(Hook): def unload(self): + # self.unloadHoster("BasePlugin") for type, plugin in (("hoster", "XFileSharingPro"), ("crypter", "XFileSharingProFolder")): self._unload(type, plugin) + + + def unloadHoster(self, hoster): + hdict = self.core.pluginManager.hosterPlugins[hoster] + if "new_name" in hdict and hdict['new_name'] is "XFileSharingPro": + if "module" in hdict: + del hdict['module'] + + if "new_module" in hdict: + del hdict['new_module'] + del hdict['new_name'] + + return True + else: + return False + + + # def downloadFailed(self, pyfile): + # if pyfile.pluginname is "BasePlugin" \ + # and pyfile.hasStatus("failed") \ + # and not self.getConfig("use_hoster_list") \ + # and self.unloadHoster("BasePlugin"): + # self.logDebug("Unloaded XFileSharingPro from BasePlugin") + # pyfile.setStatus("queued") -- cgit v1.2.3 From b9b9301f6e4db89d174bd6bdabbbf7746ae21b53 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 23 Dec 2014 12:32:49 +0100 Subject: [ExpertDecoders] Fix typo (thx DKeppi) --- module/plugins/hooks/ExpertDecoders.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py index 1784a270c..54de8eb53 100644 --- a/module/plugins/hooks/ExpertDecoders.py +++ b/module/plugins/hooks/ExpertDecoders.py @@ -15,7 +15,7 @@ from module.plugins.Hook import Hook class ExpertDecoders(Hook): __name__ = "ExpertDecoders" __type__ = "hook" - __version__ = "0.02" + __version__ = "0.03" __config__ = [("force", "bool", "Force CT even if client is connected", False), ("passkey", "password", "Access key", "")] @@ -97,7 +97,7 @@ class ExpertDecoders(Hook): try: res = getURL(self.API_URL, post={'action': "refund", 'key': self.getConfig("passkey"), 'gen_task_id': task.data['ticket']}) - self.logInfo(_("Request refund", res) + self.logInfo(_("Request refund"), res) except BadHeader, e: self.logError(_("Could not send refund request"), e) -- cgit v1.2.3 From 57a319563651a07bf8265ab52da0d7375191319c Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 23 Dec 2014 13:13:42 +0100 Subject: Rename MultiHoster plugin to MultiHook --- module/plugins/hooks/AlldebridCom.py | 6 +++--- module/plugins/hooks/DebridItaliaCom.py | 6 +++--- module/plugins/hooks/EasybytezCom.py | 6 +++--- module/plugins/hooks/FastixRu.py | 6 +++--- module/plugins/hooks/FreeWayMe.py | 6 +++--- module/plugins/hooks/LinksnappyCom.py | 6 +++--- module/plugins/hooks/MegaDebridEu.py | 6 +++--- module/plugins/hooks/MultishareCz.py | 6 +++--- module/plugins/hooks/MyfastfileCom.py | 6 +++--- module/plugins/hooks/OverLoadMe.py | 6 +++--- module/plugins/hooks/PremiumTo.py | 8 ++++---- module/plugins/hooks/PremiumizeMe.py | 8 ++++---- module/plugins/hooks/RPNetBiz.py | 8 ++++---- module/plugins/hooks/RealdebridCom.py | 6 +++--- module/plugins/hooks/RehostTo.py | 8 ++++---- module/plugins/hooks/SimplyPremiumCom.py | 6 +++--- module/plugins/hooks/SimplydebridCom.py | 6 +++--- module/plugins/hooks/UnrestrictLi.py | 6 +++--- module/plugins/hooks/XFileSharingPro.py | 12 ++++++------ module/plugins/hooks/ZeveraCom.py | 4 ++-- 20 files changed, 66 insertions(+), 66 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/AlldebridCom.py b/module/plugins/hooks/AlldebridCom.py index 2d3c8aad7..d5986053f 100644 --- a/module/plugins/hooks/AlldebridCom.py +++ b/module/plugins/hooks/AlldebridCom.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- from module.network.RequestFactory import getURL -from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.MultiHook import MultiHook -class AlldebridCom(MultiHoster): +class AlldebridCom(MultiHook): __name__ = "AlldebridCom" __type__ = "hook" - __version__ = "0.13" + __version__ = "0.14" __config__ = [("https", "bool", "Enable HTTPS", False), ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), diff --git a/module/plugins/hooks/DebridItaliaCom.py b/module/plugins/hooks/DebridItaliaCom.py index 43e910a4b..e31bc98d7 100644 --- a/module/plugins/hooks/DebridItaliaCom.py +++ b/module/plugins/hooks/DebridItaliaCom.py @@ -3,13 +3,13 @@ import re from module.network.RequestFactory import getURL -from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.MultiHook import MultiHook -class DebridItaliaCom(MultiHoster): +class DebridItaliaCom(MultiHook): __name__ = "DebridItaliaCom" __type__ = "hook" - __version__ = "0.09" + __version__ = "0.10" __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", ""), diff --git a/module/plugins/hooks/EasybytezCom.py b/module/plugins/hooks/EasybytezCom.py index 3faa4fa1a..0dab2a7fe 100644 --- a/module/plugins/hooks/EasybytezCom.py +++ b/module/plugins/hooks/EasybytezCom.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.MultiHook import MultiHook -class EasybytezCom(MultiHoster): +class EasybytezCom(MultiHook): __name__ = "EasybytezCom" __type__ = "hook" - __version__ = "0.03" + __version__ = "0.04" __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", "")] diff --git a/module/plugins/hooks/FastixRu.py b/module/plugins/hooks/FastixRu.py index cec6c6f1f..73297eb23 100644 --- a/module/plugins/hooks/FastixRu.py +++ b/module/plugins/hooks/FastixRu.py @@ -2,13 +2,13 @@ from module.common.json_layer import json_loads from module.network.RequestFactory import getURL -from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.MultiHook import MultiHook -class FastixRu(MultiHoster): +class FastixRu(MultiHook): __name__ = "FastixRu" __type__ = "hook" - __version__ = "0.02" + __version__ = "0.03" __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("unloadFailing", "bool", "Revert to standard download if download fails", False), diff --git a/module/plugins/hooks/FreeWayMe.py b/module/plugins/hooks/FreeWayMe.py index 5abec29ba..0b71fc35b 100644 --- a/module/plugins/hooks/FreeWayMe.py +++ b/module/plugins/hooks/FreeWayMe.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- from module.network.RequestFactory import getURL -from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.MultiHook import MultiHook -class FreeWayMe(MultiHoster): +class FreeWayMe(MultiHook): __name__ = "FreeWayMe" __type__ = "hook" - __version__ = "0.11" + __version__ = "0.12" __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), ("hosterList", "str", "Hoster list (comma separated)", ""), diff --git a/module/plugins/hooks/LinksnappyCom.py b/module/plugins/hooks/LinksnappyCom.py index 82edc30fd..96bf1c0d1 100644 --- a/module/plugins/hooks/LinksnappyCom.py +++ b/module/plugins/hooks/LinksnappyCom.py @@ -2,13 +2,13 @@ from module.common.json_layer import json_loads from module.network.RequestFactory import getURL -from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.MultiHook import MultiHook -class LinksnappyCom(MultiHoster): +class LinksnappyCom(MultiHook): __name__ = "LinksnappyCom" __type__ = "hook" - __version__ = "0.01" + __version__ = "0.02" __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", ""), diff --git a/module/plugins/hooks/MegaDebridEu.py b/module/plugins/hooks/MegaDebridEu.py index 4f627b7e9..f3a0c31ea 100644 --- a/module/plugins/hooks/MegaDebridEu.py +++ b/module/plugins/hooks/MegaDebridEu.py @@ -2,13 +2,13 @@ from module.common.json_layer import json_loads from module.network.RequestFactory import getURL -from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.MultiHook import MultiHook -class MegaDebridEu(MultiHoster): +class MegaDebridEu(MultiHook): __name__ = "MegaDebridEu" __type__ = "hook" - __version__ = "0.02" + __version__ = "0.03" __config__ = [("unloadFailing", "bool", "Revert to standard download if download fails", False)] diff --git a/module/plugins/hooks/MultishareCz.py b/module/plugins/hooks/MultishareCz.py index 0e651393d..5ec5b63b6 100644 --- a/module/plugins/hooks/MultishareCz.py +++ b/module/plugins/hooks/MultishareCz.py @@ -3,13 +3,13 @@ import re from module.network.RequestFactory import getURL -from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.MultiHook import MultiHook -class MultishareCz(MultiHoster): +class MultishareCz(MultiHook): __name__ = "MultishareCz" __type__ = "hook" - __version__ = "0.04" + __version__ = "0.05" __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", "uloz.to")] diff --git a/module/plugins/hooks/MyfastfileCom.py b/module/plugins/hooks/MyfastfileCom.py index 0cf2c6c22..ec7c4e55b 100644 --- a/module/plugins/hooks/MyfastfileCom.py +++ b/module/plugins/hooks/MyfastfileCom.py @@ -2,13 +2,13 @@ from module.common.json_layer import json_loads from module.network.RequestFactory import getURL -from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.MultiHook import MultiHook -class MyfastfileCom(MultiHoster): +class MyfastfileCom(MultiHook): __name__ = "MyfastfileCom" __type__ = "hook" - __version__ = "0.02" + __version__ = "0.03" __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", ""), diff --git a/module/plugins/hooks/OverLoadMe.py b/module/plugins/hooks/OverLoadMe.py index baa9b0e0a..378ce0a65 100644 --- a/module/plugins/hooks/OverLoadMe.py +++ b/module/plugins/hooks/OverLoadMe.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- from module.network.RequestFactory import getURL -from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.MultiHook import MultiHook -class OverLoadMe(MultiHoster): +class OverLoadMe(MultiHook): __name__ = "OverLoadMe" __type__ = "hook" - __version__ = "0.01" + __version__ = "0.02" __config__ = [("https", "bool", "Enable HTTPS", True), ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), diff --git a/module/plugins/hooks/PremiumTo.py b/module/plugins/hooks/PremiumTo.py index 7be46945f..3087db552 100644 --- a/module/plugins/hooks/PremiumTo.py +++ b/module/plugins/hooks/PremiumTo.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- from module.network.RequestFactory import getURL -from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.MultiHook import MultiHook -class PremiumTo(MultiHoster): +class PremiumTo(MultiHook): __name__ = "PremiumTo" __type__ = "hook" - __version__ = "0.04" + __version__ = "0.05" __config__ = [("hosterListMode", "all;listed;unlisted", "Use for downloads from supported hosters:", "all"), ("hosterList", "str", "Hoster list (comma separated)", "")] @@ -34,4 +34,4 @@ class PremiumTo(MultiHoster): self.logError(_("Please add your premium.to account first and restart pyLoad")) return - return MultiHoster.coreReady(self) + return MultiHook.coreReady(self) diff --git a/module/plugins/hooks/PremiumizeMe.py b/module/plugins/hooks/PremiumizeMe.py index c18e8cf8e..4ebf96451 100644 --- a/module/plugins/hooks/PremiumizeMe.py +++ b/module/plugins/hooks/PremiumizeMe.py @@ -2,13 +2,13 @@ from module.common.json_layer import json_loads from module.network.RequestFactory import getURL -from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.MultiHook import MultiHook -class PremiumizeMe(MultiHoster): +class PremiumizeMe(MultiHook): __name__ = "PremiumizeMe" __type__ = "hook" - __version__ = "0.12" + __version__ = "0.13" __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), ("hosterList", "str", "Hoster list (comma separated)", ""), @@ -51,4 +51,4 @@ class PremiumizeMe(MultiHoster): return # Run the overwriten core ready which actually enables the multihoster hook - return MultiHoster.coreReady(self) + return MultiHook.coreReady(self) diff --git a/module/plugins/hooks/RPNetBiz.py b/module/plugins/hooks/RPNetBiz.py index 917cd02de..c54f7d445 100644 --- a/module/plugins/hooks/RPNetBiz.py +++ b/module/plugins/hooks/RPNetBiz.py @@ -2,13 +2,13 @@ from module.common.json_layer import json_loads from module.network.RequestFactory import getURL -from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.MultiHook import MultiHook -class RPNetBiz(MultiHoster): +class RPNetBiz(MultiHook): __name__ = "RPNetBiz" __type__ = "hook" - __version__ = "0.10" + __version__ = "0.11" __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), ("hosterList", "str", "Hoster list (comma separated)", ""), @@ -49,4 +49,4 @@ class RPNetBiz(MultiHoster): return # Run the overwriten core ready which actually enables the multihoster hook - return MultiHoster.coreReady(self) + return MultiHook.coreReady(self) diff --git a/module/plugins/hooks/RealdebridCom.py b/module/plugins/hooks/RealdebridCom.py index 50cc81f0c..066aa52c4 100644 --- a/module/plugins/hooks/RealdebridCom.py +++ b/module/plugins/hooks/RealdebridCom.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- from module.network.RequestFactory import getURL -from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.MultiHook import MultiHook -class RealdebridCom(MultiHoster): +class RealdebridCom(MultiHook): __name__ = "RealdebridCom" __type__ = "hook" - __version__ = "0.43" + __version__ = "0.44" __config__ = [("https", "bool", "Enable HTTPS", False), ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), diff --git a/module/plugins/hooks/RehostTo.py b/module/plugins/hooks/RehostTo.py index 1bf7d2555..48afa2342 100644 --- a/module/plugins/hooks/RehostTo.py +++ b/module/plugins/hooks/RehostTo.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- from module.network.RequestFactory import getURL -from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.MultiHook import MultiHook -class RehostTo(MultiHoster): +class RehostTo(MultiHook): __name__ = "RehostTo" __type__ = "hook" - __version__ = "0.43" + __version__ = "0.44" __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", ""), @@ -38,4 +38,4 @@ class RehostTo(MultiHoster): self.ses = data['ses'] self.long_ses = data['long_ses'] - return MultiHoster.coreReady(self) + return MultiHook.coreReady(self) diff --git a/module/plugins/hooks/SimplyPremiumCom.py b/module/plugins/hooks/SimplyPremiumCom.py index cc7e9183c..10a1655c2 100644 --- a/module/plugins/hooks/SimplyPremiumCom.py +++ b/module/plugins/hooks/SimplyPremiumCom.py @@ -2,13 +2,13 @@ from module.common.json_layer import json_loads from module.network.RequestFactory import getURL -from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.MultiHook import MultiHook -class SimplyPremiumCom(MultiHoster): +class SimplyPremiumCom(MultiHook): __name__ = "SimplyPremiumCom" __type__ = "hook" - __version__ = "0.02" + __version__ = "0.03" __config__ = [("activated", "bool", "Activated", "False"), ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), diff --git a/module/plugins/hooks/SimplydebridCom.py b/module/plugins/hooks/SimplydebridCom.py index 173206e75..48568f870 100644 --- a/module/plugins/hooks/SimplydebridCom.py +++ b/module/plugins/hooks/SimplydebridCom.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- from module.network.RequestFactory import getURL -from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.MultiHook import MultiHook -class SimplydebridCom(MultiHoster): +class SimplydebridCom(MultiHook): __name__ = "SimplydebridCom" __type__ = "hook" - __version__ = "0.01" + __version__ = "0.02" __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", "")] diff --git a/module/plugins/hooks/UnrestrictLi.py b/module/plugins/hooks/UnrestrictLi.py index d87265ef4..245264d44 100644 --- a/module/plugins/hooks/UnrestrictLi.py +++ b/module/plugins/hooks/UnrestrictLi.py @@ -2,13 +2,13 @@ from module.common.json_layer import json_loads from module.network.RequestFactory import getURL -from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.MultiHook import MultiHook -class UnrestrictLi(MultiHoster): +class UnrestrictLi(MultiHook): __name__ = "UnrestrictLi" __type__ = "hook" - __version__ = "0.02" + __version__ = "0.03" __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", ""), diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py index 946838e47..589143547 100644 --- a/module/plugins/hooks/XFileSharingPro.py +++ b/module/plugins/hooks/XFileSharingPro.py @@ -10,12 +10,12 @@ class XFileSharingPro(Hook): __type__ = "hook" __version__ = "0.28" - __config__ = [("activated", "bool", "Activated", True), - ("use_hoster_list", "bool", "Load listed hosters only", False), - ("use_crypter_list", "bool", "Load listed crypters only", False), - ("use_builtin_list", "bool", "Load built-in plugin list", True), - ("hoster_list", "str", "Hoster list (comma separated)", ""), - ("crypter_list", "str", "Crypter list (comma separated)", "")] + __config__ = [("activated" , "bool", "Activated" , True ), + ("use_hoster_list" , "bool", "Load listed hosters only" , False), + ("use_crypter_list", "bool", "Load listed crypters only" , False), + ("use_builtin_list", "bool", "Load built-in plugin list" , True ), + ("hoster_list" , "str" , "Hoster list (comma separated)" , "" ), + ("crypter_list" , "str" , "Crypter list (comma separated)", "" )] __description__ = """Load XFileSharingPro based hosters and crypter which don't need a own plugin to run""" __license__ = "GPLv3" diff --git a/module/plugins/hooks/ZeveraCom.py b/module/plugins/hooks/ZeveraCom.py index 6fafb9666..ef1c128f3 100644 --- a/module/plugins/hooks/ZeveraCom.py +++ b/module/plugins/hooks/ZeveraCom.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- from module.network.RequestFactory import getURL -from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.MultiHook import MultiHook -class ZeveraCom(MultiHoster): +class ZeveraCom(MultiHook): __name__ = "ZeveraCom" __type__ = "hook" __version__ = "0.02" -- cgit v1.2.3 From 87203e996fb42c172b15e29f0e394d5b328d9ac2 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 23 Dec 2014 13:20:53 +0100 Subject: New plugin: MultiHoster --- module/plugins/hooks/ZeveraCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ZeveraCom.py b/module/plugins/hooks/ZeveraCom.py index ef1c128f3..6ca696f38 100644 --- a/module/plugins/hooks/ZeveraCom.py +++ b/module/plugins/hooks/ZeveraCom.py @@ -7,7 +7,7 @@ from module.plugins.internal.MultiHook import MultiHook class ZeveraCom(MultiHook): __name__ = "ZeveraCom" __type__ = "hook" - __version__ = "0.02" + __version__ = "0.03" __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", "")] -- cgit v1.2.3 From 87ffa4185db663bfc796a678415a49f8dbbab535 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 23 Dec 2014 17:41:57 +0100 Subject: [PremiumizeMe] Fix typo --- module/plugins/hooks/PremiumizeMe.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/PremiumizeMe.py b/module/plugins/hooks/PremiumizeMe.py index 4ebf96451..b37728e06 100644 --- a/module/plugins/hooks/PremiumizeMe.py +++ b/module/plugins/hooks/PremiumizeMe.py @@ -8,7 +8,7 @@ from module.plugins.internal.MultiHook import MultiHook class PremiumizeMe(MultiHook): __name__ = "PremiumizeMe" __type__ = "hook" - __version__ = "0.13" + __version__ = "0.14" __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), ("hosterList", "str", "Hoster list (comma separated)", ""), @@ -30,7 +30,7 @@ class PremiumizeMe(MultiHook): # Get supported hosters list from premiumize.me using the # json API v1 (see https://secure.premiumize.me/?show=api) - answer = getURL("https://api.premiumize.me/pm-api/v1.php" + answer = getURL("https://api.premiumize.me/pm-api/v1.php", get={'method': "hosterlist", 'params[login]': user, 'params[pass]': data['password']}) data = json_loads(answer) -- cgit v1.2.3 From d18ae2d67b9aaf3725c6004e4a83efd2774de397 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 23 Dec 2014 22:13:11 +0100 Subject: [SkipRev] Now should work fine... --- module/plugins/hooks/SkipRev.py | 49 +++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 14 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index 0c38ac9af..2a971bb7c 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -1,16 +1,24 @@ # -*- coding: utf-8 -*- +from types import MethodType from urllib import unquote from urlparse import urlparse +from module.PyFile import PyFile from module.plugins.Hook import Hook from module.plugins.Plugin import SkipDownload +def _setup(self): + self.pyfile.plugin._setup() + if self.pyfile.hasStatus("skipped"): + raise SkipDownload(self.pyfile.self.statusname or self.pyfile.pluginname) + + class SkipRev(Hook): __name__ = "SkipRev" __type__ = "hook" - __version__ = "0.17" + __version__ = "0.20" __config__ = [("tokeep", "int", "Number of rev files to keep for package (-1 to auto)", -1)] @@ -24,13 +32,7 @@ class SkipRev(Hook): pass - def _setup(self): - super(self.pyfile.plugin, self).setup() - if self.pyfile.hasStatus("skipped"): - raise SkipDownload(self.pyfile.getStatusName() or self.pyfile.pluginname) - - - def pyname(self, pyfile): + def _pyname(self, pyfile): url = pyfile.url plugin = pyfile.plugin @@ -50,21 +52,35 @@ class SkipRev(Hook): return name + def _pyfile(self, link): + return PyFile(self.core.files, + link.fid, + link.url, + link.name, + link.size, + link.status, + link.error, + link.plugin, + link.packageID, + link.order) + + def downloadPreparing(self, pyfile): - if pyfile.getStatusName() is "unskipped" or not self.pyname(pyfile).endswith(".rev"): + if pyfile.statusname is "unskipped" or not self._pyname(pyfile).endswith(".rev"): return tokeep = self.getConfig("tokeep") if tokeep: saved = [True for link in self.core.api.getPackageData(pyfile.packageid).links \ - if link.name.endswith(".rev") and (link.hasStatus("finished") or link.hasStatus("downloading"))].count(True) + if link.name.endswith(".rev") and link.status in (0, 12)].count(True) if not saved or saved < tokeep: #: keep one rev at least in auto mode return pyfile.setCustomStatus("SkipRev", "skipped") - pyfile.plugin.setup = _setup #: work-around: inject status checker inside the preprocessing routine of the plugin + pyfile.plugin._setup = pyfile.plugin.setup + pyfile.plugin.setup = MethodType(_setup, pyfile.plugin) #: work-around: inject status checker inside the preprocessing routine of the plugin def downloadFailed(self, pyfile): @@ -74,9 +90,14 @@ class SkipRev(Hook): return for link in self.core.api.getPackageData(pyfile.packageid).links: - if link.hasStatus("skipped") and link.name.endswith(".rev"): + if link.status is 4 and link.name.endswith(".rev"): + pylink = self._pyfile(link) + if tokeep > -1 or pyfile.name.endswith(".rev"): - link.setStatus("queued") + pylink.setStatus("queued") else: - link.setCustomStatus("unskipped", "queued") + pylink.setCustomStatus("unskipped", "queued") + + self.core.files.save() + pylink.release() return -- cgit v1.2.3 From a165fce9fdcba70158e3e980b2c0ecf13698c65c Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 23 Dec 2014 22:54:26 +0100 Subject: [SkipRev] Typo --- module/plugins/hooks/SkipRev.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index 2a971bb7c..1eaee0118 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -12,7 +12,7 @@ from module.plugins.Plugin import SkipDownload def _setup(self): self.pyfile.plugin._setup() if self.pyfile.hasStatus("skipped"): - raise SkipDownload(self.pyfile.self.statusname or self.pyfile.pluginname) + raise SkipDownload(self.pyfile.statusname or self.pyfile.pluginname) class SkipRev(Hook): -- cgit v1.2.3 From 29df1397bbbe80eced4674b6fa39e16540c80901 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 24 Dec 2014 01:11:44 +0100 Subject: Extractor rewritten --- module/plugins/hooks/ExtractArchive.py | 168 ++++++++++++++++++++++----------- 1 file changed, 115 insertions(+), 53 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index ddec8319b..16942bef0 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -51,32 +51,33 @@ if os.name != "nt": from pwd import getpwnam from module.plugins.Hook import Hook, threaded, Expose -from module.plugins.internal.AbstractExtractor import ArchiveError, CRCError, WrongPassword -from module.utils import save_join, fs_encode +from module.plugins.internal.AbstractExtractor import ArchiveError, CRCError, PasswordError +from module.utils import save_join, uniqify class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "0.20" - - __config__ = [("activated", "bool", "Activated", True), - ("fullpath", "bool", "Extract full path", True), - ("overwrite", "bool", "Overwrite files", True), - ("passwordfile", "file", "password file", "archive_password.txt"), - ("deletearchive", "bool", "Delete archives when done", False), - ("subfolder", "bool", "Create subfolder for each package", False), - ("destination", "folder", "Extract files to", ""), - ("excludefiles", "str", "Exclude files from unpacking (seperated by ;)", ""), - ("recursive", "bool", "Extract archives in archvies", True), - ("queue", "bool", "Wait for all downloads to be finished", True), - ("renice", "int", "CPU Priority", 0)] + __version__ = "1.00" + + __config__ = [("activated" , "bool" , "Activated" , True ), + ("fullpath" , "bool" , "Extract full path" , True ), + ("overwrite" , "bool" , "Overwrite files" , False ), + ("keepbroken" , "bool" , "Extract broken archives" , False ), + ("repair" , "bool" , "Repair broken archives" , True ), + ("passwordfile" , "file" , "Store passwords in file" , "archive_password.txt" ), + ("delete" , "bool" , "Delete archive when successfully extracted", False ), + ("subfolder" , "bool" , "Create subfolder for each package" , False ), + ("destination" , "folder", "Extract files to" , "" ), + ("extensions" , "str" , "Extract the following extensions" , "7z,bz2,bzip2,gz,gzip,lha,lzh,lzma,rar,tar,taz,tbz,tbz2,tgz,xar,xz,z,zip"), + ("excludefiles" , "str" , "Don't extract the following files" , "*.nfo,*.DS_Store,index.dat,thumb.db" ), + ("recursive" , "bool" , "Extract archives in archives" , True ), + ("queue" , "bool" , "Wait for all downloads to be finished" , True ), + ("renice" , "int" , "CPU Priority" , 0 )] __description__ = """Extract different kind of archives""" __license__ = "GPLv3" - __authors__ = [("RaNaN", "ranan@pyload.org"), - ("AndroKev", None), - ("Walter Purcaro", "vuolter@gmail.com")] + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] event_list = ["allDownloadsProcessed"] @@ -92,7 +93,7 @@ class ExtractArchive(Hook): self.passwords = [] names = [] - for p in ("UnRar", "UnZip"): + for p in ("UnRar", "SevenZip", "UnZip"): try: module = self.core.pluginManager.loadModule("internal", p) klass = getattr(module, p) @@ -154,13 +155,21 @@ class ExtractArchive(Hook): extracted = [] failed = [] + clearlist = lambda string: [x.lstrip('.') for x in string.replace(' ', '').replace(',', '|').replace(';', '|').split('|')] + destination = self.getConfig("destination") subfolder = self.getConfig("subfolder") fullpath = self.getConfig("fullpath") overwrite = self.getConfig("overwrite") - excludefiles = self.getConfig("excludefiles") + extensions = clearlist(self.getConfig("extensions")) + excludefiles = clearlist(self.getConfig("excludefiles")) renice = self.getConfig("renice") recursive = self.getConfig("recursive") + delete = self.getConfig("delete") + keepbroken = self.getConfig("keepbroken") + + if extensions: + self.logDebug("Extensions allowed: %s" % "|.".join(extensions)) # reload from txt file self.reloadPasswords() @@ -171,7 +180,7 @@ class ExtractArchive(Hook): #iterate packages -> plugins -> targets for pid in ids: p = self.core.files.getPackage(pid) - self.logInfo(_("Check package %s") % p.name) + self.logInfo(_("Check package: %s") % p.name) if not p: continue @@ -179,21 +188,25 @@ class ExtractArchive(Hook): out = save_join(dl, p.folder, destination, "") #: force trailing slash if subfolder: - out = save_join(out, fs_encode(p.folder)) + out = save_join(out, p.folder) if not exists(out): makedirs(out) files_ids = [(save_join(dl, p.folder, x['name']), x['id']) for x in p.getChildren().itervalues()] - matched = False - success = True + matched = False + success = True # check as long there are unseen files while files_ids: new_files_ids = [] + if extensions: + files_ids = [(file, id) for file, id in files_ids if filter(lambda ext: file.endswith(ext), extensions)] + for plugin in self.plugins: targets = plugin.getTargets(files_ids) + if targets: self.logDebug("Targets for %s: %s" % (plugin.__name__, targets)) matched = True @@ -205,19 +218,31 @@ class ExtractArchive(Hook): processed.append(target) # prevent extracting same file twice - self.logInfo(basename(target), _("Extract to %s") % out) + self.logInfo(basename(target), _("Extract to: %s") % out) try: - klass = plugin(self, target, out, fullpath, overwrite, excludefiles, renice) + klass = plugin(self, + target, + out, + p.password, + fullpath, + overwrite, + excludefiles, + renice, + delete, + keepbroken) klass.init() - new_files = self._extract(klass, fid, [p.password.strip()], thread) + new_files = self._extract(klass, fid, thread) except Exception, e: self.logError(basename(target), e) + new_files = None + + if new_files is None: success = False continue - self.logDebug("Extracted", new_files) + self.logDebug("Extracted files: %s" % new_files) self.setPermissions(new_files) for file in new_files: @@ -242,43 +267,78 @@ class ExtractArchive(Hook): return True if not failed else False - def _extract(self, plugin, fid, passwords, thread): + def _extract(self, plugin, fid, thread): pyfile = self.core.files.getFile(fid) - deletearchive = self.getConfig("deletearchive") pyfile.setCustomStatus(_("extracting")) thread.addActive(pyfile) # keep this file until everything is done try: - progress = lambda x: pyfile.setProgress(x) - success = False + progress = lambda x: pyfile.setProgress(x) + encrypted = False + passwords = self.getPasswords() + + try: + self.logInfo(basename(plugin.file), "Verifying...") + + tmp_password = plugin.password + plugin.password = "" #: Force verifying without password + + plugin.verify() + + except PasswordError: + encrypted = True + + except CRCError: + self.logWarning(basename(plugin.file), _("Archive damaged")) + + if not self.getConfig("repair"): + raise CRCError + + elif plugin.repair(): + self.logInfo(basename(plugin.file), _("Successfully repaired")) + + elif not self.getConfig("keepbroken"): + raise ArchiveError(_("Broken archive")) + + else: + self.logInfo(basename(plugin.file), _("All OK")) + + plugin.password = tmp_password + + if not encrypted: + plugin.extract(progress) - if not plugin.checkArchive(): - plugin.extract(progress, pw) - success = True else: self.logInfo(basename(plugin.file), _("Password protected")) - self.logDebug("Passwords: %s" % passwords if passwords else "No password provided") - for pw in set(passwords) | set(self.getPasswords()): + if plugin.password: + passwords.insert(0, plugin.password) + passwords = uniqify(self.passwords) + self.logDebug("Password: %s" % plugin.password) + else: + self.logDebug("No package password provided") + + for pw in passwords: try: self.logDebug("Try password: %s" % pw) - if plugin.checkPassword(pw): - plugin.extract(progress, pw) + + if plugin.setPassword(pw): + plugin.extract(progress) self.addPassword(pw) - success = True break + else: + raise PasswordError - except WrongPassword: + except PasswordError: self.logDebug("Password was wrong") - - if not success: - raise Exception(_("Wrong password")) + else: + raise PasswordError if self.core.debug: - self.logDebug("Would delete", ", ".join(plugin.getDeleteFiles())) + self.logDebug("Would delete: %s" % ", ".join(plugin.getDeleteFiles())) - if deletearchive: + if self.getConfig("delete"): files = plugin.getDeleteFiles() self.logInfo(_("Deleting %s files") % len(files)) for f in files: @@ -294,12 +354,16 @@ class ExtractArchive(Hook): return extracted_files - except ArchiveError, e: - self.logError(basename(plugin.file), _("Archive Error"), e) + except PasswordError: + self.logError(basename(plugin.file), _("Wrong password" if passwords else "No password found")) + plugin.password = "" except CRCError: self.logError(basename(plugin.file), _("CRC Mismatch")) + except ArchiveError, e: + self.logError(basename(plugin.file), _("Archive Error"), e) + except Exception, e: if self.core.debug: print_exc() @@ -307,7 +371,7 @@ class ExtractArchive(Hook): self.manager.dispatchEvent("archive_extract_failed", pyfile) - raise Exception(_("Extract failed")) + self.logError(basename(plugin.file), _("Extract failed")) @Expose @@ -337,15 +401,13 @@ class ExtractArchive(Hook): """ Adds a password to saved list""" passwordfile = self.getConfig("passwordfile") - if pw in self.passwords: - self.passwords.remove(pw) - self.passwords.insert(0, pw) + self.passwords = uniqify(self.passwords) try: with open(passwordfile, "wb") as f: for pw in self.passwords: - f.write(pw + "\n") + f.write(pw + '\n') except IOError, e: self.logError(e) -- cgit v1.2.3 From f71c1ef70a199e42e8a519364d9924e138ffd37c Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 24 Dec 2014 15:48:08 +0100 Subject: [ExtractArchive] Remove empty directory --- module/plugins/hooks/ExtractArchive.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 16942bef0..8b3b4e310 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -58,7 +58,7 @@ from module.utils import save_join, uniqify class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.00" + __version__ = "1.01" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract full path" , True ), @@ -135,7 +135,7 @@ class ExtractArchive(Hook): self.logInfo(_("Package %s queued for later extracting") % pypack.name) self.queue.append(pid) else: - self.manager.startThread(self.extract, [pid]) + self.extractPackage(pid) @threaded @@ -239,6 +239,7 @@ class ExtractArchive(Hook): new_files = None if new_files is None: + self.logWarning(basename(target), _("No files extracted")) success = False continue @@ -264,6 +265,12 @@ class ExtractArchive(Hook): else: self.logInfo(_("No files found to extract")) + if not matched or not success and subfolder: + try: + os.rmdir(out) + except OSError: + pass + return True if not failed else False -- cgit v1.2.3 From 3a7839e3c8f78c729adde099f071c31abf64ea1b Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 24 Dec 2014 16:48:08 +0100 Subject: [SkipRev] Improve downloadFailed routine --- module/plugins/hooks/SkipRev.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index 1eaee0118..cc32c365e 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -18,7 +18,7 @@ def _setup(self): class SkipRev(Hook): __name__ = "SkipRev" __type__ = "hook" - __version__ = "0.20" + __version__ = "0.21" __config__ = [("tokeep", "int", "Number of rev files to keep for package (-1 to auto)", -1)] @@ -72,7 +72,7 @@ class SkipRev(Hook): tokeep = self.getConfig("tokeep") if tokeep: - saved = [True for link in self.core.api.getPackageData(pyfile.packageid).links \ + saved = [True for link in self.core.api.getPackageData(pyfile.package().id).links \ if link.name.endswith(".rev") and link.status in (0, 12)].count(True) if not saved or saved < tokeep: #: keep one rev at least in auto mode @@ -84,12 +84,17 @@ class SkipRev(Hook): def downloadFailed(self, pyfile): + #: Check if pyfile is still "failed", + # maybe might has been restarted in meantime + if pyfile.status != 8: + return + tokeep = self.getConfig("tokeep") if not tokeep: return - for link in self.core.api.getPackageData(pyfile.packageid).links: + for link in self.core.api.getPackageData(pyfile.package().id).links: if link.status is 4 and link.name.endswith(".rev"): pylink = self._pyfile(link) -- cgit v1.2.3 From 429f8b54b11b1df9d99aa8f3fe222e47d98a5faf Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 24 Dec 2014 16:49:01 +0100 Subject: [UnSkipOnFail] Rewritten --- module/plugins/hooks/UnSkipOnFail.py | 127 ++++++++++++++++++----------------- 1 file changed, 65 insertions(+), 62 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/UnSkipOnFail.py b/module/plugins/hooks/UnSkipOnFail.py index d3baccfc2..87c21dda7 100644 --- a/module/plugins/hooks/UnSkipOnFail.py +++ b/module/plugins/hooks/UnSkipOnFail.py @@ -1,22 +1,19 @@ # -*- coding: utf-8 -*- -from os.path import basename - from module.PyFile import PyFile from module.plugins.Hook import Hook -from module.utils import fs_encode class UnSkipOnFail(Hook): __name__ = "UnSkipOnFail" __type__ = "hook" - __version__ = "0.02" + __version__ = "0.03" __config__ = [("activated", "bool", "Activated", True)] - __description__ = """When a download fails, restart skipped duplicates""" + __description__ = """Queue skipped duplicates""" __license__ = "GPLv3" - __authors__ = [("hagg", None)] + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] #@TODO: Remove in 0.4.10 @@ -25,68 +22,74 @@ class UnSkipOnFail(Hook): def downloadFailed(self, pyfile): - pyfile_name = basename(pyfile.name) - pid = pyfile.package().id - msg = _('look for skipped duplicates for %s (pid:%s)') - self.logInfo(msg % (pyfile_name, pid)) - dups = self.findDuplicates(pyfile) - for link in dups: - # check if link is "skipped"(=4) - if link.status == 4: - lpid = link.packageID - self.logInfo(_('restart "%s" (pid:%s)') % (pyfile_name, lpid)) - self.setLinkStatus(link, "queued") - - - def findDuplicates(self, pyfile): + #: Check if pyfile is still "failed", + # maybe might has been restarted in meantime + if pyfile.status != 8: + return + + msg = _("Looking for skipped duplicates of: %s (pid:%s)") + self.logInfo(msg % (pyfile.name, pyfile.package().id)) + + dup = self.findDuplicate(pyfile) + if dup: + self.logInfo(_("Queue found duplicate: %s (pid:%s)") % (dup.name, dup.packageID)) + + #: Change status of "link" to "new_status". + # "link" has to be a valid FileData object, + # "new_status" has to be a valid status name + # (i.e. "queued" for this Plugin) + # It creates a temporary PyFile object using + # "link" data, changes its status, and tells + # the core.files-manager to save its data. + pylink = _pyfile(link) + + pylink.setCustomStatus("UnSkipOnFail", "queued") + + self.core.files.save() + pylink.release() + + else: + self.logInfo(_("No duplicates found")) + + + def findDuplicate(self, pyfile): """ Search all packages for duplicate links to "pyfile". Duplicates are links that would overwrite "pyfile". To test on duplicity the package-folder and link-name - of twolinks are compared (basename(link.name)). + of twolinks are compared (link.name). So this method returns a list of all links with equal package-folders and filenames as "pyfile", but except the data for "pyfile" iotselöf. It does MOT check the link's status. """ - dups = [] - pyfile_name = fs_encode(basename(pyfile.name)) - # get packages (w/o files, as most file data is useless here) - queue = self.core.api.getQueue() + queue = self.api.getQueue() #: get packages (w/o files, as most file data is useless here) + for package in queue: - # check if package-folder equals pyfile's package folder - if fs_encode(package.folder) == fs_encode(pyfile.package().folder): - # now get packaged data w/ files/links - pdata = self.core.api.getPackageData(package.pid) - if pdata.links: - for link in pdata.links: - link_name = fs_encode(basename(link.name)) - # check if link name collides with pdata's name - if link_name == pyfile_name: - # at last check if it is not pyfile itself - if link.fid != pyfile.id: - dups.append(link) - return dups - - - def setLinkStatus(self, link, new_status): - """ Change status of "link" to "new_status". - "link" has to be a valid FileData object, - "new_status" has to be a valid status name - (i.e. "queued" for this Plugin) - It creates a temporary PyFile object using - "link" data, changes its status, and tells - the core.files-manager to save its data. - """ - pyfile = PyFile(self.core.files, - link.fid, - link.url, - link.name, - link.size, - link.status, - link.error, - link.plugin, - link.packageID, - link.order) - pyfile.setStatus(new_status) - self.core.files.save() - pyfile.release() + #: check if package-folder equals pyfile's package folder + if package.folder != pyfile.package().folder: + continue + + #: now get packaged data w/ files/links + pdata = self.api.getPackageData(package.pid) + for link in pdata.links: + #: check if link is "skipped" + if link.status != 4: + continue + + #: check if link name collides with pdata's name + #: AND at last check if it is not pyfile itself + if link.name == pyfile.name and link.fid != pyfile.id: + return link + + + def _pyfile(self, link): + return PyFile(self.core.files, + link.fid, + link.url, + link.name, + link.size, + link.status, + link.error, + link.plugin, + link.packageID, + link.order) -- cgit v1.2.3 From 22285c54c80b59ac17dd6a74dcb2044729258f43 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 24 Dec 2014 16:50:22 +0100 Subject: [UnSkipOnFail] Rewritten (2) --- module/plugins/hooks/UnSkipOnFail.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/UnSkipOnFail.py b/module/plugins/hooks/UnSkipOnFail.py index 87c21dda7..fad29b17b 100644 --- a/module/plugins/hooks/UnSkipOnFail.py +++ b/module/plugins/hooks/UnSkipOnFail.py @@ -11,7 +11,7 @@ class UnSkipOnFail(Hook): __config__ = [("activated", "bool", "Activated", True)] - __description__ = """Queue skipped duplicates""" + __description__ = """Queue skipped duplicates when download fails""" __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] -- cgit v1.2.3 From 8930bf1dc4e3915c46b413d5d61868dabf7d24d3 Mon Sep 17 00:00:00 2001 From: pbr85at Date: Thu, 25 Dec 2014 12:46:13 +0100 Subject: Update UnSkipOnFail.py indent error --- module/plugins/hooks/UnSkipOnFail.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/UnSkipOnFail.py b/module/plugins/hooks/UnSkipOnFail.py index fad29b17b..37f193f5d 100644 --- a/module/plugins/hooks/UnSkipOnFail.py +++ b/module/plugins/hooks/UnSkipOnFail.py @@ -52,7 +52,7 @@ class UnSkipOnFail(Hook): self.logInfo(_("No duplicates found")) - def findDuplicate(self, pyfile): + def findDuplicate(self, pyfile): """ Search all packages for duplicate links to "pyfile". Duplicates are links that would overwrite "pyfile". To test on duplicity the package-folder and link-name -- cgit v1.2.3 From d442ce97a7ba66d90527cfbee313dc5640975def Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 25 Dec 2014 16:07:09 +0100 Subject: [ClickAndLoad] Revert initPeriodical --- module/plugins/hooks/ClickAndLoad.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py index 27d99c71c..04aac2f10 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickAndLoad.py @@ -52,7 +52,7 @@ def forward(source, destination): class ClickAndLoad(Hook): __name__ = "ClickAndLoad" __type__ = "hook" - __version__ = "0.23" + __version__ = "0.24" __config__ = [("activated", "bool", "Activated", True), ("extern", "bool", "Allow external link adding", False)] @@ -63,11 +63,6 @@ class ClickAndLoad(Hook): ("mkaay", "mkaay@mkaay.de")] - #@TODO: Remove in 0.4.10 - def initPeriodical(self): - pass - - def coreReady(self): self.port = int(self.config['webinterface']['port']) if self.config['webinterface']['activated']: -- cgit v1.2.3 From 37c4fdbe85bd193ec69e222330f05b7adf742145 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 25 Dec 2014 16:08:32 +0100 Subject: [UnSkipOnFail] Bump up version --- module/plugins/hooks/UnSkipOnFail.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/UnSkipOnFail.py b/module/plugins/hooks/UnSkipOnFail.py index 37f193f5d..88557e831 100644 --- a/module/plugins/hooks/UnSkipOnFail.py +++ b/module/plugins/hooks/UnSkipOnFail.py @@ -7,7 +7,7 @@ from module.plugins.Hook import Hook class UnSkipOnFail(Hook): __name__ = "UnSkipOnFail" __type__ = "hook" - __version__ = "0.03" + __version__ = "0.04" __config__ = [("activated", "bool", "Activated", True)] -- cgit v1.2.3 From 4c63928557398891c30d3e2b7c962a07b3483315 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 26 Dec 2014 04:18:41 +0100 Subject: Rename AbstractExtractor to Extractor --- module/plugins/hooks/ExtractArchive.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 8b3b4e310..af78ffc93 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -51,14 +51,14 @@ if os.name != "nt": from pwd import getpwnam from module.plugins.Hook import Hook, threaded, Expose -from module.plugins.internal.AbstractExtractor import ArchiveError, CRCError, PasswordError +from module.plugins.internal.Extractor import ArchiveError, CRCError, PasswordError from module.utils import save_join, uniqify class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.01" + __version__ = "1.02" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract full path" , True ), -- cgit v1.2.3 From 60c4c83ed84f5bf7f638f99d21e74af314935280 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 26 Dec 2014 04:20:27 +0100 Subject: [UnSkipOnFail] Fixup --- module/plugins/hooks/UnSkipOnFail.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/UnSkipOnFail.py b/module/plugins/hooks/UnSkipOnFail.py index 88557e831..1becb937a 100644 --- a/module/plugins/hooks/UnSkipOnFail.py +++ b/module/plugins/hooks/UnSkipOnFail.py @@ -7,7 +7,7 @@ from module.plugins.Hook import Hook class UnSkipOnFail(Hook): __name__ = "UnSkipOnFail" __type__ = "hook" - __version__ = "0.04" + __version__ = "0.05" __config__ = [("activated", "bool", "Activated", True)] @@ -62,7 +62,7 @@ class UnSkipOnFail(Hook): the data for "pyfile" iotselöf. It does MOT check the link's status. """ - queue = self.api.getQueue() #: get packages (w/o files, as most file data is useless here) + queue = self.core.api.getQueue() #: get packages (w/o files, as most file data is useless here) for package in queue: #: check if package-folder equals pyfile's package folder @@ -70,7 +70,7 @@ class UnSkipOnFail(Hook): continue #: now get packaged data w/ files/links - pdata = self.api.getPackageData(package.pid) + pdata = self.core.api.getPackageData(package.pid) for link in pdata.links: #: check if link is "skipped" if link.status != 4: -- cgit v1.2.3 From 575ce629081995766a231f0a9f3e97e3b79d23b1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 27 Dec 2014 21:20:59 +0100 Subject: Update MultiHook based hooks --- module/plugins/hooks/AlldebridCom.py | 11 +++++------ module/plugins/hooks/DebridItaliaCom.py | 13 ++++++------- module/plugins/hooks/EasybytezCom.py | 8 ++++---- module/plugins/hooks/FastixRu.py | 11 +++++------ module/plugins/hooks/FreeWayMe.py | 13 ++++++------- module/plugins/hooks/LinksnappyCom.py | 13 ++++++------- module/plugins/hooks/MegaDebridEu.py | 9 ++++----- module/plugins/hooks/MultishareCz.py | 11 +++++------ module/plugins/hooks/MyfastfileCom.py | 13 ++++++------- module/plugins/hooks/NoPremiumPl.py | 2 +- module/plugins/hooks/OverLoadMe.py | 13 ++++++------- module/plugins/hooks/PremiumTo.py | 11 +++++------ module/plugins/hooks/PremiumizeMe.py | 13 ++++++------- module/plugins/hooks/RPNetBiz.py | 13 ++++++------- module/plugins/hooks/RealdebridCom.py | 13 ++++++------- module/plugins/hooks/RehostTo.py | 13 ++++++------- module/plugins/hooks/SimplyPremiumCom.py | 13 ++++++------- module/plugins/hooks/SimplydebridCom.py | 11 +++++------ module/plugins/hooks/UnrestrictLi.py | 13 ++++++------- module/plugins/hooks/XFileSharingPro.py | 22 +++++++++++----------- module/plugins/hooks/ZeveraCom.py | 11 +++++------ 21 files changed, 116 insertions(+), 134 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/AlldebridCom.py b/module/plugins/hooks/AlldebridCom.py index d5986053f..88a637de7 100644 --- a/module/plugins/hooks/AlldebridCom.py +++ b/module/plugins/hooks/AlldebridCom.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- -from module.network.RequestFactory import getURL from module.plugins.internal.MultiHook import MultiHook @@ -10,9 +9,9 @@ class AlldebridCom(MultiHook): __version__ = "0.14" __config__ = [("https", "bool", "Enable HTTPS", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("hosterList", "str", "Hoster list (comma separated)", ""), - ("unloadFailing", "bool", "Revert to stanard download if download fails", False), + ("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + ("pluginlist", "str", "Hoster list (comma separated)", ""), + ("revertfailed", "bool", "Revert to stanard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24)] __description__ = """Alldebrid.com hook plugin""" @@ -20,8 +19,8 @@ class AlldebridCom(MultiHook): __authors__ = [("Andy Voigt", "spamsales@online.de")] - def getHoster(self): + def getHosters(self): https = "https" if self.getConfig("https") else "http" - page = getURL(https + "://www.alldebrid.com/api.php", get={'action': "get_host"}).replace("\"", "").strip() + page = self.getURL(https + "://www.alldebrid.com/api.php", get={'action': "get_host"}).replace("\"", "").strip() return [x.strip() for x in page.split(",") if x.strip()] diff --git a/module/plugins/hooks/DebridItaliaCom.py b/module/plugins/hooks/DebridItaliaCom.py index e31bc98d7..d18be5384 100644 --- a/module/plugins/hooks/DebridItaliaCom.py +++ b/module/plugins/hooks/DebridItaliaCom.py @@ -2,18 +2,17 @@ import re -from module.network.RequestFactory import getURL from module.plugins.internal.MultiHook import MultiHook class DebridItaliaCom(MultiHook): __name__ = "DebridItaliaCom" __type__ = "hook" - __version__ = "0.10" + __version__ = "0.11" - __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("hosterList", "str", "Hoster list (comma separated)", ""), - ("unloadFailing", "bool", "Revert to standard download if download fails", False), + __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + ("pluginlist", "str", "Hoster list (comma separated)", ""), + ("revertfailed", "bool", "Revert to standard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24)] __description__ = """Debriditalia.com hook plugin""" @@ -22,5 +21,5 @@ class DebridItaliaCom(MultiHook): ("Walter Purcaro", "vuolter@gmail.com")] - def getHoster(self): - return getURL("http://debriditalia.com/api.php", get={'hosts': ""}).replace('"', '').split(',') + def getHosters(self): + return self.getURL("http://debriditalia.com/api.php", get={'hosts': ""}).replace('"', '').split(',') diff --git a/module/plugins/hooks/EasybytezCom.py b/module/plugins/hooks/EasybytezCom.py index 0dab2a7fe..16149580c 100644 --- a/module/plugins/hooks/EasybytezCom.py +++ b/module/plugins/hooks/EasybytezCom.py @@ -8,17 +8,17 @@ from module.plugins.internal.MultiHook import MultiHook class EasybytezCom(MultiHook): __name__ = "EasybytezCom" __type__ = "hook" - __version__ = "0.04" + __version__ = "0.05" - __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("hosterList", "str", "Hoster list (comma separated)", "")] + __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + ("pluginlist", "str", "Hoster list (comma separated)", "")] __description__ = """EasyBytez.com hook plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - def getHoster(self): + def getHosters(self): self.account = self.core.accountManager.getAccountPlugin(self.__name__) user = self.account.selectAccount()[0] diff --git a/module/plugins/hooks/FastixRu.py b/module/plugins/hooks/FastixRu.py index 73297eb23..a4b423fb7 100644 --- a/module/plugins/hooks/FastixRu.py +++ b/module/plugins/hooks/FastixRu.py @@ -1,17 +1,16 @@ # -*- coding: utf-8 -*- from module.common.json_layer import json_loads -from module.network.RequestFactory import getURL from module.plugins.internal.MultiHook import MultiHook class FastixRu(MultiHook): __name__ = "FastixRu" __type__ = "hook" - __version__ = "0.03" + __version__ = "0.04" - __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("unloadFailing", "bool", "Revert to standard download if download fails", False), + __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + ("revertfailed", "bool", "Revert to standard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24)] __description__ = """Fastix.ru hook plugin""" @@ -19,8 +18,8 @@ class FastixRu(MultiHook): __authors__ = [("Massimo Rosamilia", "max@spiritix.eu")] - def getHoster(self): - page = getURL("http://fastix.ru/api_v2", + def getHosters(self): + page = self.getURL("http://fastix.ru/api_v2", get={'apikey': "5182964c3f8f9a7f0b00000a_kelmFB4n1IrnCDYuIFn2y", 'sub' : "allowed_sources"}) host_list = json_loads(page) diff --git a/module/plugins/hooks/FreeWayMe.py b/module/plugins/hooks/FreeWayMe.py index 0b71fc35b..f2a4f2d34 100644 --- a/module/plugins/hooks/FreeWayMe.py +++ b/module/plugins/hooks/FreeWayMe.py @@ -1,17 +1,16 @@ # -*- coding: utf-8 -*- -from module.network.RequestFactory import getURL from module.plugins.internal.MultiHook import MultiHook class FreeWayMe(MultiHook): __name__ = "FreeWayMe" __type__ = "hook" - __version__ = "0.12" + __version__ = "0.13" - __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), - ("hosterList", "str", "Hoster list (comma separated)", ""), - ("unloadFailing", "bool", "Revert to stanard download if download fails", False), + __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), + ("pluginlist", "str", "Hoster list (comma separated)", ""), + ("revertfailed", "bool", "Revert to stanard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24)] __description__ = """FreeWay.me hook plugin""" @@ -19,7 +18,7 @@ class FreeWayMe(MultiHook): __authors__ = [("Nicolas Giese", "james@free-way.me")] - def getHoster(self): - hostis = getURL("https://www.free-way.me/ajax/jd.php", get={'id': 3}).replace("\"", "").strip() + def getHosters(self): + hostis = self.getURL("https://www.free-way.me/ajax/jd.php", get={'id': 3}).replace("\"", "").strip() self.logDebug("Hosters", hostis) return [x.strip() for x in hostis.split(",") if x.strip()] diff --git a/module/plugins/hooks/LinksnappyCom.py b/module/plugins/hooks/LinksnappyCom.py index 96bf1c0d1..a1c4b90f7 100644 --- a/module/plugins/hooks/LinksnappyCom.py +++ b/module/plugins/hooks/LinksnappyCom.py @@ -1,18 +1,17 @@ # -*- coding: utf-8 -*- from module.common.json_layer import json_loads -from module.network.RequestFactory import getURL from module.plugins.internal.MultiHook import MultiHook class LinksnappyCom(MultiHook): __name__ = "LinksnappyCom" __type__ = "hook" - __version__ = "0.02" + __version__ = "0.03" - __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("hosterList", "str", "Hoster list (comma separated)", ""), - ("unloadFailing", "bool", "Revert to standard download if download fails", False), + __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + ("pluginlist", "str", "Hoster list (comma separated)", ""), + ("revertfailed", "bool", "Revert to standard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24)] __description__ = """Linksnappy.com hook plugin""" @@ -20,8 +19,8 @@ class LinksnappyCom(MultiHook): __authors__ = [("stickell", "l.stickell@yahoo.it")] - def getHoster(self): - json_data = getURL("http://gen.linksnappy.com/lseAPI.php", get={'act': "FILEHOSTS"}) + def getHosters(self): + json_data = self.getURL("http://gen.linksnappy.com/lseAPI.php", get={'act': "FILEHOSTS"}) json_data = json_loads(json_data) return json_data['return'].keys() diff --git a/module/plugins/hooks/MegaDebridEu.py b/module/plugins/hooks/MegaDebridEu.py index f3a0c31ea..5fb7e1ea6 100644 --- a/module/plugins/hooks/MegaDebridEu.py +++ b/module/plugins/hooks/MegaDebridEu.py @@ -1,24 +1,23 @@ # -*- coding: utf-8 -*- from module.common.json_layer import json_loads -from module.network.RequestFactory import getURL from module.plugins.internal.MultiHook import MultiHook class MegaDebridEu(MultiHook): __name__ = "MegaDebridEu" __type__ = "hook" - __version__ = "0.03" + __version__ = "0.04" - __config__ = [("unloadFailing", "bool", "Revert to standard download if download fails", False)] + __config__ = [("revertfailed", "bool", "Revert to standard download if download fails", False)] __description__ = """mega-debrid.eu hook plugin""" __license__ = "GPLv3" __authors__ = [("D.Ducatel", "dducatel@je-geek.fr")] - def getHoster(self): - reponse = getURL("http://www.mega-debrid.eu/api.php", get={'action': "getHosters"}) + def getHosters(self): + reponse = self.getURL("http://www.mega-debrid.eu/api.php", get={'action': "getHosters"}) json_data = json_loads(reponse) if json_data['response_code'] == "ok": diff --git a/module/plugins/hooks/MultishareCz.py b/module/plugins/hooks/MultishareCz.py index 5ec5b63b6..2dadf5dc1 100644 --- a/module/plugins/hooks/MultishareCz.py +++ b/module/plugins/hooks/MultishareCz.py @@ -2,17 +2,16 @@ import re -from module.network.RequestFactory import getURL from module.plugins.internal.MultiHook import MultiHook class MultishareCz(MultiHook): __name__ = "MultishareCz" __type__ = "hook" - __version__ = "0.05" + __version__ = "0.06" - __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("hosterList", "str", "Hoster list (comma separated)", "uloz.to")] + __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + ("pluginlist", "str", "Hoster list (comma separated)", "uloz.to")] __description__ = """MultiShare.cz hook plugin""" __license__ = "GPLv3" @@ -22,6 +21,6 @@ class MultishareCz(MultiHook): HOSTER_PATTERN = r']*?alt="([^"]+)">\s*[^>]*?alt="OK"' - def getHoster(self): - page = getURL("http://www.multishare.cz/monitoring/") + def getHosters(self): + page = self.getURL("http://www.multishare.cz/monitoring/") return re.findall(self.HOSTER_PATTERN, page) diff --git a/module/plugins/hooks/MyfastfileCom.py b/module/plugins/hooks/MyfastfileCom.py index ec7c4e55b..2fda0d3bf 100644 --- a/module/plugins/hooks/MyfastfileCom.py +++ b/module/plugins/hooks/MyfastfileCom.py @@ -1,18 +1,17 @@ # -*- coding: utf-8 -*- from module.common.json_layer import json_loads -from module.network.RequestFactory import getURL from module.plugins.internal.MultiHook import MultiHook class MyfastfileCom(MultiHook): __name__ = "MyfastfileCom" __type__ = "hook" - __version__ = "0.03" + __version__ = "0.04" - __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("hosterList", "str", "Hoster list (comma separated)", ""), - ("unloadFailing", "bool", "Revert to standard download if download fails", False), + __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + ("pluginlist", "str", "Hoster list (comma separated)", ""), + ("revertfailed", "bool", "Revert to standard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24)] __description__ = """Myfastfile.com hook plugin""" @@ -20,8 +19,8 @@ class MyfastfileCom(MultiHook): __authors__ = [("stickell", "l.stickell@yahoo.it")] - def getHoster(self): - json_data = getURL("http://myfastfile.com/api.php", get={'hosts': ""}, decode=True) + def getHosters(self): + json_data = self.getURL("http://myfastfile.com/api.php", get={'hosts': ""}, decode=True) self.logDebug("JSON data", json_data) json_data = json_loads(json_data) diff --git a/module/plugins/hooks/NoPremiumPl.py b/module/plugins/hooks/NoPremiumPl.py index f60cb3dd6..84a019b8d 100644 --- a/module/plugins/hooks/NoPremiumPl.py +++ b/module/plugins/hooks/NoPremiumPl.py @@ -3,7 +3,7 @@ from module.plugins.internal.MultiHoster import MultiHoster from module.network.RequestFactory import getURL from module.common.json_layer import json_loads as loads - + class NoPremiumPl(MultiHoster): __name__ = "NoPremiumPl" diff --git a/module/plugins/hooks/OverLoadMe.py b/module/plugins/hooks/OverLoadMe.py index 378ce0a65..eb3da319a 100644 --- a/module/plugins/hooks/OverLoadMe.py +++ b/module/plugins/hooks/OverLoadMe.py @@ -1,18 +1,17 @@ # -*- coding: utf-8 -*- -from module.network.RequestFactory import getURL from module.plugins.internal.MultiHook import MultiHook class OverLoadMe(MultiHook): __name__ = "OverLoadMe" __type__ = "hook" - __version__ = "0.02" + __version__ = "0.03" __config__ = [("https", "bool", "Enable HTTPS", True), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), - ("hosterList", "str", "Hoster list (comma separated)", ""), - ("unloadFailing", "bool", "Revert to standard download if download fails", False), + ("mode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), + ("pluginlist", "str", "Hoster list (comma separated)", ""), + ("revertfailed", "bool", "Revert to standard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 12)] __description__ = """Over-Load.me hook plugin""" @@ -20,9 +19,9 @@ class OverLoadMe(MultiHook): __authors__ = [("marley", "marley@over-load.me")] - def getHoster(self): + def getHosters(self): https = "https" if self.getConfig("https") else "http" - page = getURL(https + "://api.over-load.me/hoster.php", + page = self.getURL(https + "://api.over-load.me/hoster.php", get={'auth': "0001-cb1f24dadb3aa487bda5afd3b76298935329be7700cd7-5329be77-00cf-1ca0135f"}).replace("\"", "").strip() self.logDebug("Hosterlist", page) diff --git a/module/plugins/hooks/PremiumTo.py b/module/plugins/hooks/PremiumTo.py index 3087db552..348bb6789 100644 --- a/module/plugins/hooks/PremiumTo.py +++ b/module/plugins/hooks/PremiumTo.py @@ -1,16 +1,15 @@ # -*- coding: utf-8 -*- -from module.network.RequestFactory import getURL from module.plugins.internal.MultiHook import MultiHook class PremiumTo(MultiHook): __name__ = "PremiumTo" __type__ = "hook" - __version__ = "0.05" + __version__ = "0.06" - __config__ = [("hosterListMode", "all;listed;unlisted", "Use for downloads from supported hosters:", "all"), - ("hosterList", "str", "Hoster list (comma separated)", "")] + __config__ = [("mode", "all;listed;unlisted", "Use for downloads from supported hosters:", "all"), + ("pluginlist", "str", "Hoster list (comma separated)", "")] __description__ = """Premium.to hook plugin""" __license__ = "GPLv3" @@ -19,8 +18,8 @@ class PremiumTo(MultiHook): ("stickell", "l.stickell@yahoo.it")] - def getHoster(self): - page = getURL("http://premium.to/api/hosters.php", + def getHosters(self): + page = self.getURL("http://premium.to/api/hosters.php", get={'username': self.account.username, 'password': self.account.password}) return [x.strip() for x in page.replace("\"", "").split(";")] diff --git a/module/plugins/hooks/PremiumizeMe.py b/module/plugins/hooks/PremiumizeMe.py index b37728e06..e23f13895 100644 --- a/module/plugins/hooks/PremiumizeMe.py +++ b/module/plugins/hooks/PremiumizeMe.py @@ -1,18 +1,17 @@ # -*- coding: utf-8 -*- from module.common.json_layer import json_loads -from module.network.RequestFactory import getURL from module.plugins.internal.MultiHook import MultiHook class PremiumizeMe(MultiHook): __name__ = "PremiumizeMe" __type__ = "hook" - __version__ = "0.14" + __version__ = "0.15" - __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), - ("hosterList", "str", "Hoster list (comma separated)", ""), - ("unloadFailing", "bool", "Revert to stanard download if download fails", False), + __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), + ("pluginlist", "str", "Hoster list (comma separated)", ""), + ("revertfailed", "bool", "Revert to stanard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24)] __description__ = """Premiumize.me hook plugin""" @@ -20,7 +19,7 @@ class PremiumizeMe(MultiHook): __authors__ = [("Florian Franzen", "FlorianFranzen@gmail.com")] - def getHoster(self): + def getHosters(self): # If no accounts are available there will be no hosters available if not self.account or not self.account.canUse(): return [] @@ -30,7 +29,7 @@ class PremiumizeMe(MultiHook): # Get supported hosters list from premiumize.me using the # json API v1 (see https://secure.premiumize.me/?show=api) - answer = getURL("https://api.premiumize.me/pm-api/v1.php", + answer = self.getURL("https://api.premiumize.me/pm-api/v1.php", get={'method': "hosterlist", 'params[login]': user, 'params[pass]': data['password']}) data = json_loads(answer) diff --git a/module/plugins/hooks/RPNetBiz.py b/module/plugins/hooks/RPNetBiz.py index c54f7d445..5af355fcc 100644 --- a/module/plugins/hooks/RPNetBiz.py +++ b/module/plugins/hooks/RPNetBiz.py @@ -1,18 +1,17 @@ # -*- coding: utf-8 -*- from module.common.json_layer import json_loads -from module.network.RequestFactory import getURL from module.plugins.internal.MultiHook import MultiHook class RPNetBiz(MultiHook): __name__ = "RPNetBiz" __type__ = "hook" - __version__ = "0.11" + __version__ = "0.12" - __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), - ("hosterList", "str", "Hoster list (comma separated)", ""), - ("unloadFailing", "bool", "Revert to stanard download if download fails", False), + __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), + ("pluginlist", "str", "Hoster list (comma separated)", ""), + ("revertfailed", "bool", "Revert to stanard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24)] __description__ = """RPNet.biz hook plugin""" @@ -20,7 +19,7 @@ class RPNetBiz(MultiHook): __authors__ = [("Dman", "dmanugm@gmail.com")] - def getHoster(self): + def getHosters(self): # No hosts supported if no account if not self.account or not self.account.canUse(): return [] @@ -28,7 +27,7 @@ class RPNetBiz(MultiHook): # Get account data (user, data) = self.account.selectAccount() - res = getURL("https://premium.rpnet.biz/client_api.php", + res = self.getURL("https://premium.rpnet.biz/client_api.php", get={'username': user, 'password': data['password'], 'action': "showHosterList"}) hoster_list = json_loads(res) diff --git a/module/plugins/hooks/RealdebridCom.py b/module/plugins/hooks/RealdebridCom.py index 066aa52c4..05a6df1dd 100644 --- a/module/plugins/hooks/RealdebridCom.py +++ b/module/plugins/hooks/RealdebridCom.py @@ -1,18 +1,17 @@ # -*- coding: utf-8 -*- -from module.network.RequestFactory import getURL from module.plugins.internal.MultiHook import MultiHook class RealdebridCom(MultiHook): __name__ = "RealdebridCom" __type__ = "hook" - __version__ = "0.44" + __version__ = "0.45" __config__ = [("https", "bool", "Enable HTTPS", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), - ("hosterList", "str", "Hoster list (comma separated)", ""), - ("unloadFailing", "bool", "Revert to stanard download if download fails", False), + ("mode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), + ("pluginlist", "str", "Hoster list (comma separated)", ""), + ("revertfailed", "bool", "Revert to stanard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24)] __description__ = """Real-Debrid.com hook plugin""" @@ -20,8 +19,8 @@ class RealdebridCom(MultiHook): __authors__ = [("Devirex Hazzard", "naibaf_11@yahoo.de")] - def getHoster(self): + def getHosters(self): https = "https" if self.getConfig("https") else "http" - page = getURL(https + "://real-debrid.com/api/hosters.php").replace("\"", "").strip() + page = self.getURL(https + "://real-debrid.com/api/hosters.php").replace("\"", "").strip() return [x.strip() for x in page.split(",") if x.strip()] diff --git a/module/plugins/hooks/RehostTo.py b/module/plugins/hooks/RehostTo.py index 48afa2342..207449e6a 100644 --- a/module/plugins/hooks/RehostTo.py +++ b/module/plugins/hooks/RehostTo.py @@ -1,17 +1,16 @@ # -*- coding: utf-8 -*- -from module.network.RequestFactory import getURL from module.plugins.internal.MultiHook import MultiHook class RehostTo(MultiHook): __name__ = "RehostTo" __type__ = "hook" - __version__ = "0.44" + __version__ = "0.45" - __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("hosterList", "str", "Hoster list (comma separated)", ""), - ("unloadFailing", "bool", "Revert to stanard download if download fails", False), + __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + ("pluginlist", "str", "Hoster list (comma separated)", ""), + ("revertfailed", "bool", "Revert to stanard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24)] __description__ = """Rehost.to hook plugin""" @@ -19,8 +18,8 @@ class RehostTo(MultiHook): __authors__ = [("RaNaN", "RaNaN@pyload.org")] - def getHoster(self): - page = getURL("http://rehost.to/api.php", + def getHosters(self): + page = self.getURL("http://rehost.to/api.php", get={'cmd': "get_supported_och_dl", 'long_ses': self.long_ses}) return [x.strip() for x in page.replace("\"", "").split(",")] diff --git a/module/plugins/hooks/SimplyPremiumCom.py b/module/plugins/hooks/SimplyPremiumCom.py index 10a1655c2..5f2d2a42c 100644 --- a/module/plugins/hooks/SimplyPremiumCom.py +++ b/module/plugins/hooks/SimplyPremiumCom.py @@ -1,19 +1,18 @@ # -*- coding: utf-8 -*- from module.common.json_layer import json_loads -from module.network.RequestFactory import getURL from module.plugins.internal.MultiHook import MultiHook class SimplyPremiumCom(MultiHook): __name__ = "SimplyPremiumCom" __type__ = "hook" - __version__ = "0.03" + __version__ = "0.04" __config__ = [("activated", "bool", "Activated", "False"), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("hosterList", "str", "Hoster list (comma separated)", ""), - ("unloadFailing", "bool", "Revert to standard download if download fails", "False"), + ("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + ("pluginlist", "str", "Hoster list (comma separated)", ""), + ("revertfailed", "bool", "Revert to standard download if download fails", "False"), ("interval", "int", "Reload interval in hours (0 to disable)", "24")] __description__ = """Simply-Premium.com hook plugin""" @@ -21,8 +20,8 @@ class SimplyPremiumCom(MultiHook): __authors__ = [("EvolutionClip", "evolutionclip@live.de")] - def getHoster(self): - json_data = getURL("http://www.simply-premium.com/api/hosts.php", get={'format': "json", 'online': 1}) + def getHosters(self): + json_data = self.getURL("http://www.simply-premium.com/api/hosts.php", get={'format': "json", 'online': 1}) json_data = json_loads(json_data) host_list = [element['regex'] for element in json_data['result']] diff --git a/module/plugins/hooks/SimplydebridCom.py b/module/plugins/hooks/SimplydebridCom.py index 48568f870..13c957294 100644 --- a/module/plugins/hooks/SimplydebridCom.py +++ b/module/plugins/hooks/SimplydebridCom.py @@ -1,22 +1,21 @@ # -*- coding: utf-8 -*- -from module.network.RequestFactory import getURL from module.plugins.internal.MultiHook import MultiHook class SimplydebridCom(MultiHook): __name__ = "SimplydebridCom" __type__ = "hook" - __version__ = "0.02" + __version__ = "0.03" - __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("hosterList", "str", "Hoster list (comma separated)", "")] + __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + ("pluginlist", "str", "Hoster list (comma separated)", "")] __description__ = """Simply-Debrid.com hook plugin""" __license__ = "GPLv3" __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] - def getHoster(self): - page = getURL("http://simply-debrid.com/api.php", get={'list': 1}) + def getHosters(self): + page = self.getURL("http://simply-debrid.com/api.php", get={'list': 1}) return [x.strip() for x in page.rstrip(';').replace("\"", "").split(";")] diff --git a/module/plugins/hooks/UnrestrictLi.py b/module/plugins/hooks/UnrestrictLi.py index 245264d44..e481e8449 100644 --- a/module/plugins/hooks/UnrestrictLi.py +++ b/module/plugins/hooks/UnrestrictLi.py @@ -1,18 +1,17 @@ # -*- coding: utf-8 -*- from module.common.json_layer import json_loads -from module.network.RequestFactory import getURL from module.plugins.internal.MultiHook import MultiHook class UnrestrictLi(MultiHook): __name__ = "UnrestrictLi" __type__ = "hook" - __version__ = "0.03" + __version__ = "0.04" - __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("hosterList", "str", "Hoster list (comma separated)", ""), - ("unloadFailing", "bool", "Revert to standard download if download fails", False), + __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + ("pluginlist", "str", "Hoster list (comma separated)", ""), + ("revertfailed", "bool", "Revert to standard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24), ("history", "bool", "Delete History", False)] @@ -21,8 +20,8 @@ class UnrestrictLi(MultiHook): __authors__ = [("stickell", "l.stickell@yahoo.it")] - def getHoster(self): - json_data = getURL("http://unrestrict.li/api/jdownloader/hosts.php", get={'format': "json"}) + def getHosters(self): + json_data = self.getURL("http://unrestrict.li/api/jdownloader/hosts.php", get={'format': "json"}) json_data = json_loads(json_data) host_list = [element['host'] for element in json_data['result']] diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py index 589143547..79e373ad3 100644 --- a/module/plugins/hooks/XFileSharingPro.py +++ b/module/plugins/hooks/XFileSharingPro.py @@ -28,16 +28,16 @@ class XFileSharingPro(Hook): 'crypter': (r'https?://(?:www\.)?([\w.^_]+(?:\.[a-zA-Z]{2,})(?:\:\d+)?)/(?:user|folder)s?/\w+', r'https?://(?:[^/]+\.)?(%s)/(?:user|folder)s?/\w+')} - HOSTER_LIST = [#WORKING HOSTERS: - "eyesfile.ca", "file4safe.com", "fileband.com", "filedwon.com", "filevice.com", "hostingbulk.com", - "ravishare.com", "salefiles.com", "sharesix.com", "thefile.me", "verzend.be", "xvidstage.com", - #NOT TESTED: - "101shared.com", "4upfiles.com", "filemaze.ws", "filenuke.com", "linkzhost.com", "mightyupload.com", - "rockdizfile.com", "sharebeast.com", "sharerepo.com", "shareswift.com", "uploadbaz.com", "uploadc.com", - "vidbull.com", "zalaa.com", "zomgupload.com", - #NOT WORKING: - "amonshare.com", "banicrazy.info", "boosterking.com", "host4desi.com", "laoupload.com", "rd-fs.com"] - CRYPTER_LIST = [] + HOSTER_BUILTIN = [#WORKING HOSTERS: + "eyesfile.ca", "file4safe.com", "fileband.com", "filedwon.com", "filevice.com", "hostingbulk.com", + "ravishare.com", "salefiles.com", "sharesix.com", "thefile.me", "verzend.be", "xvidstage.com", + #NOT TESTED: + "101shared.com", "4upfiles.com", "filemaze.ws", "filenuke.com", "linkzhost.com", "mightyupload.com", + "rockdizfile.com", "sharebeast.com", "sharerepo.com", "shareswift.com", "uploadbaz.com", "uploadc.com", + "vidbull.com", "zalaa.com", "zomgupload.com", + #NOT WORKING: + "amonshare.com", "banicrazy.info", "boosterking.com", "host4desi.com", "laoupload.com", "rd-fs.com"] + CRYPTER_BUILTIN = [] # def pluginConfigChanged(self.__name__, plugin, name, value): @@ -68,7 +68,7 @@ class XFileSharingPro(Hook): plugin_list = set([x.strip() for x in s.split(',')]) if use_builtin_list: - plugin_list |= set([x.lower() for x in getattr(self, "%s_LIST" % type.upper())]) + plugin_list |= set([x.lower() for x in getattr(self, "%s_BUILTIN" % type.upper())]) plugin_list -= set(('', u'')) diff --git a/module/plugins/hooks/ZeveraCom.py b/module/plugins/hooks/ZeveraCom.py index 6ca696f38..51f759b1c 100644 --- a/module/plugins/hooks/ZeveraCom.py +++ b/module/plugins/hooks/ZeveraCom.py @@ -1,22 +1,21 @@ # -*- coding: utf-8 -*- -from module.network.RequestFactory import getURL from module.plugins.internal.MultiHook import MultiHook class ZeveraCom(MultiHook): __name__ = "ZeveraCom" __type__ = "hook" - __version__ = "0.03" + __version__ = "0.04" - __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("hosterList", "str", "Hoster list (comma separated)", "")] + __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + ("pluginlist", "str", "Hoster list (comma separated)", "")] __description__ = """Real-Debrid.com hook plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - def getHoster(self): - page = getURL("http://www.zevera.com/jDownloader.ashx", get={'cmd': "gethosters"}) + def getHosters(self): + page = self.getURL("http://www.zevera.com/jDownloader.ashx", get={'cmd': "gethosters"}) return [x.strip() for x in page.replace("\"", "").split(",")] -- cgit v1.2.3 From c0a7430ef5218da41787de001de04d3ded89d8b5 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 27 Dec 2014 21:21:47 +0100 Subject: [LinkdecrypterCom] Extend MultiHook --- module/plugins/hooks/LinkdecrypterCom.py | 64 +++++++------------------------- 1 file changed, 13 insertions(+), 51 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/LinkdecrypterCom.py b/module/plugins/hooks/LinkdecrypterCom.py index b0ce335d0..8592efd3d 100644 --- a/module/plugins/hooks/LinkdecrypterCom.py +++ b/module/plugins/hooks/LinkdecrypterCom.py @@ -2,64 +2,26 @@ import re -from module.network.RequestFactory import getURL -from module.plugins.Hook import Hook -from module.utils import remove_chars +from module.plugins.internal.MultiHook import MultiHook -class LinkdecrypterCom(Hook): +class LinkdecrypterCom(MultiHook): __name__ = "LinkdecrypterCom" __type__ = "hook" - __version__ = "0.21" + __version__ = "1.00" + + __config__ = [("mode" , "all;listed;unlisted", "Use for crypters (if supported)" , "all"), + ("pluginlist" , "str" , "Crypter list (comma separated)" , "" ), + ("interval" , "int" , "Reload interval in hours (0 to disable)" , 12 )] __description__ = """Linkdecrypter.com hook plugin""" __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - #@TODO: Remove in 0.4.10 - def initPeriodical(self): - pass - - def coreReady(self): + def getCrypters(self): try: - self.loadPatterns() - except Exception, e: - self.logError(e) - - - def loadPatterns(self): - html = getURL("http://linkdecrypter.com/") - - m = re.search(r'', 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.append("downloadserienjunkiesorg") - - crypter_pattern = re.compile("(\w[\w.-]+)") - online = [] - for crypter in m.group(1).split(', '): - m = re.match(crypter_pattern, crypter) - if m and remove_chars(m.group(1), "-.") not in builtin: - online.append(m.group(1).replace(".", "\\.")) - - if not online: - self.logError(_("Crypter list is empty")) - return - - regexp = r'https?://([^.]+\.)*?(%s)/.*' % '|'.join(online) - - dict = self.core.pluginManager.crypterPlugins[self.__name__] - dict['pattern'] = regexp - dict['re'] = re.compile(regexp) - - self.logDebug("Loaded pattern: %s" % regexp) + html = self.getURL("http://linkdecrypter.com/") + return re.search(r'>Supported\(\d+\)</b>: <i>(.+?) \+ RSDF', html).group(1).split(', ') + except Exception: + return list() -- cgit v1.2.3 From 9410d10fd0491fcd1b5a073109085f16917ec2aa Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sat, 27 Dec 2014 21:23:59 +0100 Subject: [AlldebridCom] Bump up version --- module/plugins/hooks/AlldebridCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/AlldebridCom.py b/module/plugins/hooks/AlldebridCom.py index 88a637de7..cd279e733 100644 --- a/module/plugins/hooks/AlldebridCom.py +++ b/module/plugins/hooks/AlldebridCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.MultiHook import MultiHook class AlldebridCom(MultiHook): __name__ = "AlldebridCom" __type__ = "hook" - __version__ = "0.14" + __version__ = "0.15" __config__ = [("https", "bool", "Enable HTTPS", False), ("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), -- cgit v1.2.3 From b9c2bcfc1862b4bef6feff224603420ab2eed6d9 Mon Sep 17 00:00:00 2001 From: synweap15 <shamdog+github@gmail.com> Date: Tue, 30 Dec 2014 21:25:24 +0100 Subject: fix MultiHoster to MultiHook transition --- module/plugins/hooks/NoPremiumPl.py | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/NoPremiumPl.py b/module/plugins/hooks/NoPremiumPl.py index 84a019b8d..7742e03f7 100644 --- a/module/plugins/hooks/NoPremiumPl.py +++ b/module/plugins/hooks/NoPremiumPl.py @@ -1,31 +1,28 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.MultiHoster import MultiHoster -from module.network.RequestFactory import getURL +from module.plugins.internal.MultiHook import MultiHook from module.common.json_layer import json_loads as loads -class NoPremiumPl(MultiHoster): +class NoPremiumPl(MultiHook): __name__ = "NoPremiumPl" __version__ = "0.01" __type__ = "hook" - __config__ = [("activated", "bool", "Activated", "False"), + __config__ = [("activated", "bool", "Activated", False), ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), ("hosterList", "str", "Hoster list (comma separated)", ""), - ("unloadFailing", "bool", "Try standard download if download fails", "False"), - ("interval", "int", "Reload supported hosts interval in hours (0 to disable)", "24")] + ("unloadFailing", "bool", "Try standard download if download fails", False), + ("interval", "int", "Reload supported hosts interval in hours (0 to disable)", 24)] __description__ = "NoPremium.pl hook" __license__ = "GPLv3" __authors__ = [("goddie", "dev@nopremium.pl")] - def getHoster(self): - hostings = loads(getURL("https://www.nopremium.pl/clipboard.php?json=3").strip()) - - return [domain for row in hostings for domain in row["domains"] if row["sdownload"] == "0"] - - def getHosterCached(self): - return self.getHoster() + def getHosters(self): + hostings = loads(self.getURL("https://www.nopremium.pl/clipboard.php?json=3").strip()) + hostings_domains = [domain for row in hostings for domain in row["domains"] if row["sdownload"] == "0"] + self.logDebug(hostings_domains) + return hostings_domains -- cgit v1.2.3 From 2a6404851c5ce4e9421b183805fd3c55cd5641f3 Mon Sep 17 00:00:00 2001 From: synweap15 <shamdog+github@gmail.com> Date: Tue, 30 Dec 2014 21:28:40 +0100 Subject: version bump --- module/plugins/hooks/NoPremiumPl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/NoPremiumPl.py b/module/plugins/hooks/NoPremiumPl.py index 7742e03f7..2347fc58a 100644 --- a/module/plugins/hooks/NoPremiumPl.py +++ b/module/plugins/hooks/NoPremiumPl.py @@ -6,7 +6,7 @@ from module.common.json_layer import json_loads as loads class NoPremiumPl(MultiHook): __name__ = "NoPremiumPl" - __version__ = "0.01" + __version__ = "0.02" __type__ = "hook" __config__ = [("activated", "bool", "Activated", False), -- cgit v1.2.3 From 90383d08cfc77253a645f10e56dd3ac322cb8507 Mon Sep 17 00:00:00 2001 From: synweap15 <shamdog+github@gmail.com> Date: Tue, 30 Dec 2014 21:37:20 +0100 Subject: transition to multihook fix --- module/plugins/hooks/RapideoPl.py | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/RapideoPl.py b/module/plugins/hooks/RapideoPl.py index a5d7a34a5..9eb454897 100644 --- a/module/plugins/hooks/RapideoPl.py +++ b/module/plugins/hooks/RapideoPl.py @@ -1,31 +1,28 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.MultiHoster import MultiHoster -from module.network.RequestFactory import getURL +from module.plugins.internal.MultiHook import MultiHook from module.common.json_layer import json_loads as loads -class RapideoPl(MultiHoster): +class RapideoPl(MultiHook): __name__ = "RapideoPl" - __version__ = "0.01" + __version__ = "0.02" __type__ = "hook" - __config__ = [("activated", "bool", "Activated", "False"), + __config__ = [("activated", "bool", "Activated", False), ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), ("hosterList", "str", "Hoster list (comma separated)", ""), - ("unloadFailing", "bool", "Try standard download if download fails", "False"), - ("interval", "int", "Reload supported hosts interval in hours (0 to disable)", "24")] + ("unloadFailing", "bool", "Try standard download if download fails", False), + ("interval", "int", "Reload supported hosts interval in hours (0 to disable)", 24)] __description__ = "Rapideo.pl hook" __license__ = "GPLv3" __authors__ = [("goddie", "dev@rapideo.pl")] - def getHoster(self): - hostings = loads(getURL("https://www.rapideo.pl/clipboard.php?json=3").strip()) - - return [domain for row in hostings for domain in row["domains"] if row["sdownload"] == "0"] - - def getHosterCached(self): - return self.getHoster() + def getHosters(self): + hostings = loads(self.getURL("https://www.rapideo.pl/clipboard.php?json=3").strip()) + hostings_domains = [domain for row in hostings for domain in row["domains"] if row["sdownload"] == "0"] + self.logDebug(hostings_domains) + return hostings_domains -- cgit v1.2.3 From be51f9235eb555be07b9d5cc0a34c73b75ac0cfe Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Wed, 31 Dec 2014 00:05:39 +0100 Subject: Handle methods get pyfile argument --- module/plugins/hooks/CaptchaBrotherhood.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index b6e38d8bb..6d4127871 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -94,10 +94,10 @@ class CaptchaBrotherhood(Hook): req = getRequest() url = "%ssendNewCaptcha.aspx?%s" % (self.API_URL, - urlencode({"username": self.getConfig("username"), - "password": self.getConfig("passkey"), - "captchaSource": "pyLoad", - "timeout": "80"})) + urlencode({'username' : self.getConfig("username"), + 'password' : self.getConfig("passkey"), + 'captchaSource': "pyLoad", + 'timeout' : "80"})) req.c.setopt(pycurl.URL, url) req.c.setopt(pycurl.POST, 1) -- cgit v1.2.3 From 8b50b2a435d20fd7e1211cdd8c651838993efff1 Mon Sep 17 00:00:00 2001 From: Lukas Kalbertodt <lukas.kalbertodt@gmail.com> Date: Wed, 31 Dec 2014 01:24:13 +0100 Subject: Update RealdebridCom.py --- module/plugins/hooks/RealdebridCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/RealdebridCom.py b/module/plugins/hooks/RealdebridCom.py index 05a6df1dd..bac18e6c3 100644 --- a/module/plugins/hooks/RealdebridCom.py +++ b/module/plugins/hooks/RealdebridCom.py @@ -11,7 +11,7 @@ class RealdebridCom(MultiHook): __config__ = [("https", "bool", "Enable HTTPS", False), ("mode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), ("pluginlist", "str", "Hoster list (comma separated)", ""), - ("revertfailed", "bool", "Revert to stanard download if download fails", False), + ("revertfailed", "bool", "Revert to standard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24)] __description__ = """Real-Debrid.com hook plugin""" -- cgit v1.2.3 From 08f9ab64b9e2f2b7f4c41cc1629a96af7febb740 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Wed, 31 Dec 2014 02:33:33 +0100 Subject: Tiny code cosmetics --- module/plugins/hooks/AlldebridCom.py | 2 +- module/plugins/hooks/FreeWayMe.py | 2 +- module/plugins/hooks/PremiumizeMe.py | 2 +- module/plugins/hooks/RPNetBiz.py | 2 +- module/plugins/hooks/RehostTo.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/AlldebridCom.py b/module/plugins/hooks/AlldebridCom.py index cd279e733..e1f63c31b 100644 --- a/module/plugins/hooks/AlldebridCom.py +++ b/module/plugins/hooks/AlldebridCom.py @@ -11,7 +11,7 @@ class AlldebridCom(MultiHook): __config__ = [("https", "bool", "Enable HTTPS", False), ("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("pluginlist", "str", "Hoster list (comma separated)", ""), - ("revertfailed", "bool", "Revert to stanard download if download fails", False), + ("revertfailed", "bool", "Revert to standard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24)] __description__ = """Alldebrid.com hook plugin""" diff --git a/module/plugins/hooks/FreeWayMe.py b/module/plugins/hooks/FreeWayMe.py index f2a4f2d34..6cbea3417 100644 --- a/module/plugins/hooks/FreeWayMe.py +++ b/module/plugins/hooks/FreeWayMe.py @@ -10,7 +10,7 @@ class FreeWayMe(MultiHook): __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), ("pluginlist", "str", "Hoster list (comma separated)", ""), - ("revertfailed", "bool", "Revert to stanard download if download fails", False), + ("revertfailed", "bool", "Revert to standard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24)] __description__ = """FreeWay.me hook plugin""" diff --git a/module/plugins/hooks/PremiumizeMe.py b/module/plugins/hooks/PremiumizeMe.py index e23f13895..c0717afc7 100644 --- a/module/plugins/hooks/PremiumizeMe.py +++ b/module/plugins/hooks/PremiumizeMe.py @@ -11,7 +11,7 @@ class PremiumizeMe(MultiHook): __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), ("pluginlist", "str", "Hoster list (comma separated)", ""), - ("revertfailed", "bool", "Revert to stanard download if download fails", False), + ("revertfailed", "bool", "Revert to standard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24)] __description__ = """Premiumize.me hook plugin""" diff --git a/module/plugins/hooks/RPNetBiz.py b/module/plugins/hooks/RPNetBiz.py index 5af355fcc..bbbe8e128 100644 --- a/module/plugins/hooks/RPNetBiz.py +++ b/module/plugins/hooks/RPNetBiz.py @@ -11,7 +11,7 @@ class RPNetBiz(MultiHook): __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), ("pluginlist", "str", "Hoster list (comma separated)", ""), - ("revertfailed", "bool", "Revert to stanard download if download fails", False), + ("revertfailed", "bool", "Revert to standard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24)] __description__ = """RPNet.biz hook plugin""" diff --git a/module/plugins/hooks/RehostTo.py b/module/plugins/hooks/RehostTo.py index 207449e6a..c3b626bf7 100644 --- a/module/plugins/hooks/RehostTo.py +++ b/module/plugins/hooks/RehostTo.py @@ -10,7 +10,7 @@ class RehostTo(MultiHook): __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("pluginlist", "str", "Hoster list (comma separated)", ""), - ("revertfailed", "bool", "Revert to stanard download if download fails", False), + ("revertfailed", "bool", "Revert to standard download if download fails", False), ("interval", "int", "Reload interval in hours (0 to disable)", 24)] __description__ = """Rehost.to hook plugin""" -- cgit v1.2.3 From d5ad6ab1c1b8b088e7a4083b1fb7bab72d5679c3 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Wed, 31 Dec 2014 18:44:38 +0100 Subject: [ExtractArchive] Fix https://github.com/pyload/pyload/issues/778 --- module/plugins/hooks/ExtractArchive.py | 50 ++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 15 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index af78ffc93..73d8bdb0b 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -58,7 +58,7 @@ from module.utils import save_join, uniqify class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.02" + __version__ = "1.03" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract full path" , True ), @@ -72,7 +72,7 @@ class ExtractArchive(Hook): ("extensions" , "str" , "Extract the following extensions" , "7z,bz2,bzip2,gz,gzip,lha,lzh,lzma,rar,tar,taz,tbz,tbz2,tgz,xar,xz,z,zip"), ("excludefiles" , "str" , "Don't extract the following files" , "*.nfo,*.DS_Store,index.dat,thumb.db" ), ("recursive" , "bool" , "Extract archives in archives" , True ), - ("queue" , "bool" , "Wait for all downloads to be finished" , True ), + ("queue" , "bool" , "Wait for all downloads to be finished" , False ), ("renice" , "int" , "CPU Priority" , 0 )] __description__ = """Extract different kind of archives""" @@ -88,6 +88,10 @@ class ExtractArchive(Hook): pass + def coreReady(self): + self.extracting = False + + def setup(self): self.plugins = [] self.passwords = [] @@ -123,34 +127,50 @@ class ExtractArchive(Hook): self.queue = [] + def periodical(self): + if not self.queue or self.extracting: + return + + local = copy(self.queue) + self.queue[:] = [] + + self.extractPackages(*local) + + @Expose def extractPackage(self, id): - """ Extract package with given id""" - self.manager.startThread(self.extract, [id]) + """ Extract package wrapper""" + self.extractPackages(id) + + + @Expose + def extractPackages(self, *ids): + """ Extract packages with given id""" + self.manager.startThread(self.extract, ids) def packageFinished(self, pypack): - pid = pypack.id - if self.getConfig("queue"): + if self.getConfig("queue") or self.extracting: self.logInfo(_("Package %s queued for later extracting") % pypack.name) - self.queue.append(pid) + self.queue.append(pypack.id) else: - self.extractPackage(pid) + self.extractPackage(pypack.id) @threaded def allDownloadsProcessed(self, thread): local = copy(self.queue) + self.queue[:] = [] - del self.queue[:] - - if self.extract(local, thread): #: check only if all gone fine, no failed reporting for now + if self.extract(local): #: check only if all gone fine, no failed reporting for now self.manager.dispatchEvent("all_archives_extracted") self.manager.dispatchEvent("all_archives_processed") - def extract(self, ids, thread=None): + def extract(self, ids): + self.extracting = True + processed = [] extracted = [] failed = [] @@ -232,7 +252,7 @@ class ExtractArchive(Hook): keepbroken) klass.init() - new_files = self._extract(klass, fid, thread) + new_files = self._extract(klass, fid) except Exception, e: self.logError(basename(target), e) @@ -271,14 +291,14 @@ class ExtractArchive(Hook): except OSError: pass + self.extracting = False return True if not failed else False - def _extract(self, plugin, fid, thread): + def _extract(self, plugin, fid): pyfile = self.core.files.getFile(fid) pyfile.setCustomStatus(_("extracting")) - thread.addActive(pyfile) # keep this file until everything is done try: progress = lambda x: pyfile.setProgress(x) -- cgit v1.2.3 From 60e9c46f32d97d01d728c8515985b58ba33fdafd Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Thu, 1 Jan 2015 01:48:37 +0100 Subject: [SimpleHoster] Fix https://github.com/pyload/pyload/issues/997 --- module/plugins/hooks/ExtractArchive.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 73d8bdb0b..2e9efa2b0 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -189,7 +189,7 @@ class ExtractArchive(Hook): keepbroken = self.getConfig("keepbroken") if extensions: - self.logDebug("Extensions allowed: %s" % "|.".join(extensions)) + self.logDebug("Extensions: %s" % "|.".join(extensions)) # reload from txt file self.reloadPasswords() -- cgit v1.2.3 From e0cba81ae8d59ee24e1cd1f1cf1697c5e61118ce Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Fri, 2 Jan 2015 02:37:18 +0100 Subject: [PremiumTo] Fixup --- module/plugins/hooks/PremiumTo.py | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/PremiumTo.py b/module/plugins/hooks/PremiumTo.py index 348bb6789..a4203c8bb 100644 --- a/module/plugins/hooks/PremiumTo.py +++ b/module/plugins/hooks/PremiumTo.py @@ -6,7 +6,7 @@ from module.plugins.internal.MultiHook import MultiHook class PremiumTo(MultiHook): __name__ = "PremiumTo" __type__ = "hook" - __version__ = "0.06" + __version__ = "0.07" __config__ = [("mode", "all;listed;unlisted", "Use for downloads from supported hosters:", "all"), ("pluginlist", "str", "Hoster list (comma separated)", "")] @@ -22,15 +22,3 @@ class PremiumTo(MultiHook): page = self.getURL("http://premium.to/api/hosters.php", get={'username': self.account.username, 'password': self.account.password}) return [x.strip() for x in page.replace("\"", "").split(";")] - - - def coreReady(self): - self.account = self.core.accountManager.getAccountPlugin("PremiumTo") - - user = self.account.selectAccount()[0] - - if not user: - self.logError(_("Please add your premium.to account first and restart pyLoad")) - return - - return MultiHook.coreReady(self) -- cgit v1.2.3 From 354ecbc78898efb4a31a7272e5ea1f5e00a53327 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sun, 4 Jan 2015 19:52:02 +0100 Subject: [ClickAndLoad] Updated --- module/plugins/hooks/ClickAndLoad.py | 104 ++++++++++++++++++----------------- 1 file changed, 54 insertions(+), 50 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py index 04aac2f10..8ef31ec1e 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickAndLoad.py @@ -1,41 +1,10 @@ # -*- coding: utf-8 -*- import socket -import thread - -from module.plugins.Hook import Hook - - -def proxy(self, *settings): - thread.start_new_thread(server, (self,) + settings) - lock = thread.allocate_lock() - lock.acquire() - lock.acquire() - - -def server(self, *settings): - try: - dock_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - dock_socket.bind((settings[0], settings[2])) - dock_socket.listen(5) - while True: - client_socket = dock_socket.accept()[0] - server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - server_socket.connect(("127.0.0.1", settings[1])) - thread.start_new_thread(forward, (client_socket, server_socket)) - thread.start_new_thread(forward, (server_socket, client_socket)) - except socket.error, e: - if hasattr(e, "errno"): - errno = e.errno - else: - errno = e.args[0] - if errno == 98: - self.logWarning(_("Click'N'Load: Port 9666 already in use")) - return - thread.start_new_thread(server, (self,) + settings) - except: - thread.start_new_thread(server, (self,) + settings) +from threading import Thread, Lock + +from module.plugins.Hook import Hook, threaded def forward(source, destination): @@ -45,33 +14,68 @@ def forward(source, destination): if string: destination.sendall(string) else: - #source.shutdown(socket.SHUT_RD) destination.shutdown(socket.SHUT_WR) class ClickAndLoad(Hook): __name__ = "ClickAndLoad" __type__ = "hook" - __version__ = "0.24" + __version__ = "0.25" - __config__ = [("activated", "bool", "Activated", True), - ("extern", "bool", "Allow external link adding", False)] + __config__ = [("activated", "bool", "Activated" , True ), + ("port" , "int" , "Port" , 9666 ), + ("extern" , "bool", "Listen for requests coming from WAN (internet)", False)] __description__ = """Click'N'Load hook plugin""" __license__ = "GPLv3" __authors__ = [("RaNaN", "RaNaN@pyload.de"), - ("mkaay", "mkaay@mkaay.de")] + ("Walter Purcaro", "vuolter@gmail.com")] def coreReady(self): - self.port = int(self.config['webinterface']['port']) - if self.config['webinterface']['activated']: - try: - if self.getConfig("extern"): - ip = "0.0.0.0" - else: - ip = "127.0.0.1" - - thread.start_new_thread(proxy, (self, ip, self.port, 9666)) - except: - self.logError(_("ClickAndLoad port already in use")) + if not self.config['webinterface']['activated']: + return + + ip = "0.0.0.0" if self.getConfig("extern") else "127.0.0.1" + webport = int(self.config['webinterface']['port']) + cnlport = self.getConfig('port') + + self.proxy(ip, webport, cnlport) + + + @threaded + def proxy(self, ip, webport, cnlport): + hookManager.startThread(self.server, ip, webport, cnlport) + lock = Lock() + lock.acquire() + lock.acquire() + + + def server(self, ip, webport, cnlport): + try: + dock_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + dock_socket.bind((ip, cnlport)) + dock_socket.listen(5) + + while True: + server_socket = dock_socket.accept()[0] + client_socket = socket.create_connection(("127.0.0.1", webport)) + + hookManager.startThread(forward, server_socket, client_socket) + hookManager.startThread(forward, client_socket, server_socket) + + except socket.error, e: + if hasattr(e, "errno"): + errno = e.errno + else: + errno = e.args[0] + + if errno == 98: + self.logWarning(_("Port %s already in use") % cnlport) + else: + self.logError(e) + self.server(ip, webport, cnlport) + + except Exception, e: + self.logError(e) + self.server(ip, webport, cnlport) -- cgit v1.2.3 From 80ecab8f0c664bc43b9db10bee0cb815a96c1039 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sun, 4 Jan 2015 20:20:34 +0100 Subject: Improve processCaptcha thread in hook plugins --- module/plugins/hooks/BypassCaptcha.py | 10 +++++----- module/plugins/hooks/Captcha9kw.py | 6 +++--- module/plugins/hooks/CaptchaBrotherhood.py | 10 +++++----- module/plugins/hooks/DeathByCaptcha.py | 10 +++++----- module/plugins/hooks/ExpertDecoders.py | 10 +++++----- module/plugins/hooks/ImageTyperz.py | 10 +++++----- 6 files changed, 28 insertions(+), 28 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/BypassCaptcha.py b/module/plugins/hooks/BypassCaptcha.py index a32de7f42..8e0d9d36e 100644 --- a/module/plugins/hooks/BypassCaptcha.py +++ b/module/plugins/hooks/BypassCaptcha.py @@ -1,11 +1,10 @@ # -*- coding: utf-8 -*- from pycurl import FORM_FILE, LOW_SPEED_TIME -from thread import start_new_thread from module.network.HTTPRequest import BadHeader from module.network.RequestFactory import getURL, getRequest -from module.plugins.Hook import Hook +from module.plugins.Hook import Hook, threaded class BypassCaptchaException(Exception): @@ -29,7 +28,7 @@ class BypassCaptchaException(Exception): class BypassCaptcha(Hook): __name__ = "BypassCaptcha" __type__ = "hook" - __version__ = "0.05" + __version__ = "0.06" __config__ = [("force", "bool", "Force BC even if client is connected", False), ("passkey", "password", "Passkey", "")] @@ -116,7 +115,7 @@ class BypassCaptcha(Hook): task.handler.append(self) task.data['service'] = self.__name__ task.setWaiting(100) - start_new_thread(self.processCaptcha, (task,)) + self._processCaptcha(task) else: self.logInfo(_("Your %s account has not enough credits") % self.__name__) @@ -132,7 +131,8 @@ class BypassCaptcha(Hook): self.respond(task.data['ticket'], False) - def processCaptcha(self, task): + @threaded + def _processCaptcha(self, task): c = task.captchaFile try: ticket, result = self.submit(c) diff --git a/module/plugins/hooks/Captcha9kw.py b/module/plugins/hooks/Captcha9kw.py index 33ad00c49..6eb4ef305 100755 --- a/module/plugins/hooks/Captcha9kw.py +++ b/module/plugins/hooks/Captcha9kw.py @@ -5,19 +5,18 @@ from __future__ import with_statement import re from base64 import b64encode -from thread import start_new_thread from time import sleep from module.network.HTTPRequest import BadHeader from module.network.RequestFactory import getURL -from module.plugins.Hook import Hook +from module.plugins.Hook import Hook, threaded class Captcha9kw(Hook): __name__ = "Captcha9kw" __type__ = "hook" - __version__ = "0.26" + __version__ = "0.27" __config__ = [("activated" , "bool" , "Activated" , True ), ("ssl" , "bool" , "Use HTTPS" , True ), @@ -68,6 +67,7 @@ class Captcha9kw(Hook): return 0 + @threaded def _processCaptcha(self, task): try: with open(task.captchaFile, 'rb') as f: diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index 6d4127871..9a9f05b29 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -10,12 +10,11 @@ try: except ImportError: import Image -from thread import start_new_thread from time import sleep from urllib import urlencode from module.network.RequestFactory import getURL, getRequest -from module.plugins.Hook import Hook +from module.plugins.Hook import Hook, threaded class CaptchaBrotherhoodException(Exception): @@ -39,7 +38,7 @@ class CaptchaBrotherhoodException(Exception): class CaptchaBrotherhood(Hook): __name__ = "CaptchaBrotherhood" __type__ = "hook" - __version__ = "0.06" + __version__ = "0.07" __config__ = [("username", "str", "Username", ""), ("force", "bool", "Force CT even if client is connected", False), @@ -154,7 +153,7 @@ class CaptchaBrotherhood(Hook): task.handler.append(self) task.data['service'] = self.__name__ task.setWaiting(100) - start_new_thread(self.processCaptcha, (task,)) + self._processCaptcha(task) else: self.logInfo(_("Your CaptchaBrotherhood Account has not enough credits")) @@ -164,7 +163,8 @@ class CaptchaBrotherhood(Hook): res = self.get_api("complainCaptcha", task.data['ticket']) - def processCaptcha(self, task): + @threaded + def _processCaptcha(self, task): c = task.captchaFile try: ticket, result = self.submit(c) diff --git a/module/plugins/hooks/DeathByCaptcha.py b/module/plugins/hooks/DeathByCaptcha.py index f03ac4567..98412c218 100644 --- a/module/plugins/hooks/DeathByCaptcha.py +++ b/module/plugins/hooks/DeathByCaptcha.py @@ -6,13 +6,12 @@ import re from base64 import b64encode from pycurl import FORM_FILE, HTTPHEADER -from thread import start_new_thread from time import sleep from module.common.json_layer import json_loads from module.network.HTTPRequest import BadHeader from module.network.RequestFactory import getRequest -from module.plugins.Hook import Hook +from module.plugins.Hook import Hook, threaded class DeathByCaptchaException(Exception): @@ -52,7 +51,7 @@ class DeathByCaptchaException(Exception): class DeathByCaptcha(Hook): __name__ = "DeathByCaptcha" __type__ = "hook" - __version__ = "0.04" + __version__ = "0.05" __config__ = [("username", "str", "Username", ""), ("passkey", "password", "Password", ""), @@ -195,7 +194,7 @@ class DeathByCaptcha(Hook): task.handler.append(self) task.data['service'] = self.__name__ task.setWaiting(180) - start_new_thread(self.processCaptcha, (task,)) + self._processCaptcha(task) def captchaInvalid(self, task): @@ -210,7 +209,8 @@ class DeathByCaptcha(Hook): self.logError(e) - def processCaptcha(self, task): + @threaded + def _processCaptcha(self, task): c = task.captchaFile try: ticket, result = self.submit(c) diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py index 54de8eb53..c80401003 100644 --- a/module/plugins/hooks/ExpertDecoders.py +++ b/module/plugins/hooks/ExpertDecoders.py @@ -4,18 +4,17 @@ from __future__ import with_statement from base64 import b64encode from pycurl import LOW_SPEED_TIME -from thread import start_new_thread from uuid import uuid4 from module.network.HTTPRequest import BadHeader from module.network.RequestFactory import getURL, getRequest -from module.plugins.Hook import Hook +from module.plugins.Hook import Hook, threaded class ExpertDecoders(Hook): __name__ = "ExpertDecoders" __type__ = "hook" - __version__ = "0.03" + __version__ = "0.04" __config__ = [("force", "bool", "Force CT even if client is connected", False), ("passkey", "password", "Access key", "")] @@ -50,7 +49,8 @@ class ExpertDecoders(Hook): return 0 - def processCaptcha(self, task): + @threaded + def _processCaptcha(self, task): task.data['ticket'] = ticket = uuid4() result = None @@ -85,7 +85,7 @@ class ExpertDecoders(Hook): if self.getCredits() > 0: task.handler.append(self) task.setWaiting(100) - start_new_thread(self.processCaptcha, (task,)) + self._processCaptcha(task) else: self.logInfo(_("Your ExpertDecoders Account has not enough credits")) diff --git a/module/plugins/hooks/ImageTyperz.py b/module/plugins/hooks/ImageTyperz.py index f89d64c37..d448d1be9 100644 --- a/module/plugins/hooks/ImageTyperz.py +++ b/module/plugins/hooks/ImageTyperz.py @@ -6,10 +6,9 @@ import re from base64 import b64encode from pycurl import FORM_FILE, LOW_SPEED_TIME -from thread import start_new_thread from module.network.RequestFactory import getURL, getRequest -from module.plugins.Hook import Hook +from module.plugins.Hook import Hook, threaded class ImageTyperzException(Exception): @@ -33,7 +32,7 @@ class ImageTyperzException(Exception): class ImageTyperz(Hook): __name__ = "ImageTyperz" __type__ = "hook" - __version__ = "0.05" + __version__ = "0.06" __config__ = [("username", "str", "Username", ""), ("passkey", "password", "Password", ""), @@ -130,7 +129,7 @@ class ImageTyperz(Hook): task.handler.append(self) task.data['service'] = self.__name__ task.setWaiting(100) - start_new_thread(self.processCaptcha, (task,)) + self._processCaptcha(task) else: self.logInfo(_("Your %s account has not enough credits") % self.__name__) @@ -150,7 +149,8 @@ class ImageTyperz(Hook): self.logError(_("Bad captcha solution received, refund request failed"), res) - def processCaptcha(self, task): + @threaded + def _processCaptcha(self, task): c = task.captchaFile try: ticket, result = self.submit(c) -- cgit v1.2.3 From 7979d0833573a107baae8c45330b8b5874630a76 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sun, 4 Jan 2015 20:26:13 +0100 Subject: Spare code improvements --- module/plugins/hooks/EasybytezCom.py | 5 ++--- module/plugins/hooks/PremiumizeMe.py | 20 ++------------------ module/plugins/hooks/RPNetBiz.py | 20 ++------------------ module/plugins/hooks/RehostTo.py | 15 ++++----------- 4 files changed, 10 insertions(+), 50 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/EasybytezCom.py b/module/plugins/hooks/EasybytezCom.py index 16149580c..1606c9f30 100644 --- a/module/plugins/hooks/EasybytezCom.py +++ b/module/plugins/hooks/EasybytezCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.MultiHook import MultiHook class EasybytezCom(MultiHook): __name__ = "EasybytezCom" __type__ = "hook" - __version__ = "0.05" + __version__ = "0.06" __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("pluginlist", "str", "Hoster list (comma separated)", "")] @@ -19,8 +19,7 @@ class EasybytezCom(MultiHook): def getHosters(self): - self.account = self.core.accountManager.getAccountPlugin(self.__name__) - user = self.account.selectAccount()[0] + user, data = self.account.selectAccount() try: req = self.account.getAccountRequest(user) diff --git a/module/plugins/hooks/PremiumizeMe.py b/module/plugins/hooks/PremiumizeMe.py index c0717afc7..d334ddd25 100644 --- a/module/plugins/hooks/PremiumizeMe.py +++ b/module/plugins/hooks/PremiumizeMe.py @@ -7,7 +7,7 @@ from module.plugins.internal.MultiHook import MultiHook class PremiumizeMe(MultiHook): __name__ = "PremiumizeMe" __type__ = "hook" - __version__ = "0.15" + __version__ = "0.16" __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), ("pluginlist", "str", "Hoster list (comma separated)", ""), @@ -20,12 +20,8 @@ class PremiumizeMe(MultiHook): def getHosters(self): - # If no accounts are available there will be no hosters available - if not self.account or not self.account.canUse(): - return [] - # Get account data - (user, data) = self.account.selectAccount() + user, data = self.account.selectAccount() # Get supported hosters list from premiumize.me using the # json API v1 (see https://secure.premiumize.me/?show=api) @@ -39,15 +35,3 @@ class PremiumizeMe(MultiHook): # Extract hosters from json file return data['result']['hosterlist'] - - - def coreReady(self): - # Get account plugin and check if there is a valid account available - self.account = self.core.accountManager.getAccountPlugin("PremiumizeMe") - if not self.account.canUse(): - self.account = None - self.logError(_("Please add a valid premiumize.me account first and restart pyLoad")) - return - - # Run the overwriten core ready which actually enables the multihoster hook - return MultiHook.coreReady(self) diff --git a/module/plugins/hooks/RPNetBiz.py b/module/plugins/hooks/RPNetBiz.py index bbbe8e128..9c88e6c01 100644 --- a/module/plugins/hooks/RPNetBiz.py +++ b/module/plugins/hooks/RPNetBiz.py @@ -7,7 +7,7 @@ from module.plugins.internal.MultiHook import MultiHook class RPNetBiz(MultiHook): __name__ = "RPNetBiz" __type__ = "hook" - __version__ = "0.12" + __version__ = "0.13" __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), ("pluginlist", "str", "Hoster list (comma separated)", ""), @@ -20,12 +20,8 @@ class RPNetBiz(MultiHook): def getHosters(self): - # No hosts supported if no account - if not self.account or not self.account.canUse(): - return [] - # Get account data - (user, data) = self.account.selectAccount() + user, data = self.account.selectAccount() res = self.getURL("https://premium.rpnet.biz/client_api.php", get={'username': user, 'password': data['password'], 'action': "showHosterList"}) @@ -37,15 +33,3 @@ class RPNetBiz(MultiHook): # Extract hosters from json file return hoster_list['hosters'] - - - def coreReady(self): - # Get account plugin and check if there is a valid account available - self.account = self.core.accountManager.getAccountPlugin("RPNetBiz") - if not self.account.canUse(): - self.account = None - self.logError(_("Please enter your %s account or deactivate this plugin") % "rpnet") - return - - # Run the overwriten core ready which actually enables the multihoster hook - return MultiHook.coreReady(self) diff --git a/module/plugins/hooks/RehostTo.py b/module/plugins/hooks/RehostTo.py index c3b626bf7..527770eb6 100644 --- a/module/plugins/hooks/RehostTo.py +++ b/module/plugins/hooks/RehostTo.py @@ -6,7 +6,7 @@ from module.plugins.internal.MultiHook import MultiHook class RehostTo(MultiHook): __name__ = "RehostTo" __type__ = "hook" - __version__ = "0.45" + __version__ = "0.46" __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("pluginlist", "str", "Hoster list (comma separated)", ""), @@ -25,16 +25,9 @@ class RehostTo(MultiHook): def coreReady(self): - self.account = self.core.accountManager.getAccountPlugin("RehostTo") + super(RehostTo, self).coreReady() - user = self.account.selectAccount()[0] + user, data = self.account.selectAccount() - if not user: - self.logError(_("Please add your rehost.to account first and restart pyLoad")) - return - - data = self.account.getAccountInfo(user) - self.ses = data['ses'] + self.ses = data['ses'] self.long_ses = data['long_ses'] - - return MultiHook.coreReady(self) -- cgit v1.2.3 From 75b6540be746d66d3fba3ab364c78addbc50c485 Mon Sep 17 00:00:00 2001 From: Smoozed <github@smoozed.com> Date: Mon, 5 Jan 2015 16:49:39 +0100 Subject: Added multihoster smoozed.com --- module/plugins/hooks/SmoozedCom.py | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 module/plugins/hooks/SmoozedCom.py (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/SmoozedCom.py b/module/plugins/hooks/SmoozedCom.py new file mode 100644 index 000000000..0aff36c0f --- /dev/null +++ b/module/plugins/hooks/SmoozedCom.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.MultiHook import MultiHook + + +class SmoozedCom(MultiHook): + __name__ = "SmoozedCom" + __type__ = "hook" + __version__ = "0.01" + + __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), + ("hosterList", "str", "Hoster list (comma separated)", ""), + ("unloadFailing", "bool", "Revert to stanard download if download fails", False), + ("interval", "int", "Reload interval in hours (0 to disable)", 24)] + + __description__ = """Smoozed.com hook plugin""" + __license__ = "GPLv3" + __authors__ = [] + + + def getHosters(self): + # If no accounts are available there will be no hosters available + if not self.account or not self.account.canUse(): + return [] + + # Get account data + (user, data) = self.account.selectAccount() + account_info = self.account.getAccountInfo(user, True) + + # Return hoster list + return account_info["hoster"] + + + def coreReady(self): + # Get account plugin and check if there is a valid account available + self.account = self.core.accountManager.getAccountPlugin("SmoozedCom") + if not self.account.canUse(): + self.account = None + self.logError(_("Please add a valid premiumize.me account first and restart pyLoad")) + return + + # Run the overwriten core ready which actually enables the multihook hook + return MultiHook.coreReady(self) -- cgit v1.2.3 From e977be3c78ea9d976e9b2338244b214a4b3a5199 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Thu, 8 Jan 2015 23:40:17 +0100 Subject: "New Year" Update: hook plugins --- module/plugins/hooks/AlldebridCom.py | 17 +++++++------ module/plugins/hooks/CaptchaBrotherhood.py | 8 +++--- module/plugins/hooks/DeathByCaptcha.py | 14 +++++------ module/plugins/hooks/DebridItaliaCom.py | 15 +++++++----- module/plugins/hooks/EasybytezCom.py | 13 +++++++--- module/plugins/hooks/FastixRu.py | 12 ++++++--- module/plugins/hooks/FreeWayMe.py | 13 ++++++---- module/plugins/hooks/LinkdecrypterCom.py | 9 ++++--- module/plugins/hooks/LinksnappyCom.py | 15 +++++++----- module/plugins/hooks/MegaDebridEu.py | 12 ++++++--- module/plugins/hooks/MultihostersCom.py | 30 ++++++++++------------- module/plugins/hooks/MultishareCz.py | 13 +++++++--- module/plugins/hooks/MyfastfileCom.py | 15 +++++++----- module/plugins/hooks/NoPremiumPl.py | 33 +++++++++++++------------ module/plugins/hooks/OverLoadMe.py | 17 +++++++------ module/plugins/hooks/PremiumTo.py | 11 ++++++--- module/plugins/hooks/PremiumizeMe.py | 15 +++++++----- module/plugins/hooks/PutdriveCom.py | 18 ++++++++++++++ module/plugins/hooks/RPNetBiz.py | 15 +++++++----- module/plugins/hooks/RapideoPl.py | 33 +++++++++++++------------ module/plugins/hooks/RealdebridCom.py | 17 +++++++------ module/plugins/hooks/RehostTo.py | 15 +++++++----- module/plugins/hooks/SimplyPremiumCom.py | 16 ++++++------ module/plugins/hooks/SimplydebridCom.py | 11 ++++++--- module/plugins/hooks/SmoozedCom.py | 39 +++++++++--------------------- module/plugins/hooks/UnrestrictLi.py | 19 ++++++++------- module/plugins/hooks/XFileSharingPro.py | 21 ++++++++-------- module/plugins/hooks/ZeveraCom.py | 20 +++++++++------ 28 files changed, 280 insertions(+), 206 deletions(-) create mode 100644 module/plugins/hooks/PutdriveCom.py (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/AlldebridCom.py b/module/plugins/hooks/AlldebridCom.py index e1f63c31b..dddd97c0c 100644 --- a/module/plugins/hooks/AlldebridCom.py +++ b/module/plugins/hooks/AlldebridCom.py @@ -6,13 +6,16 @@ from module.plugins.internal.MultiHook import MultiHook class AlldebridCom(MultiHook): __name__ = "AlldebridCom" __type__ = "hook" - __version__ = "0.15" + __version__ = "0.16" - __config__ = [("https", "bool", "Enable HTTPS", False), - ("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", ""), - ("revertfailed", "bool", "Revert to standard download if download fails", False), - ("interval", "int", "Reload interval in hours (0 to disable)", 24)] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 ), + ("ssl" , "bool" , "Use HTTPS" , True )] __description__ = """Alldebrid.com hook plugin""" __license__ = "GPLv3" @@ -20,7 +23,7 @@ class AlldebridCom(MultiHook): def getHosters(self): - https = "https" if self.getConfig("https") else "http" + https = "https" if self.getConfig("ssl") else "http" page = self.getURL(https + "://www.alldebrid.com/api.php", get={'action': "get_host"}).replace("\"", "").strip() return [x.strip() for x in page.split(",") if x.strip()] diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index 9a9f05b29..3c08f5e36 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -38,7 +38,7 @@ class CaptchaBrotherhoodException(Exception): class CaptchaBrotherhood(Hook): __name__ = "CaptchaBrotherhood" __type__ = "hook" - __version__ = "0.07" + __version__ = "0.08" __config__ = [("username", "str", "Username", ""), ("force", "bool", "Force CT even if client is connected", False), @@ -118,14 +118,14 @@ class CaptchaBrotherhood(Hook): for _i in xrange(15): sleep(5) - res = self.get_api("askCaptchaResult", ticket) + res = self.api_response("askCaptchaResult", ticket) if res.startswith("OK-answered"): return ticket, res[12:] raise CaptchaBrotherhoodException("No solution received in time") - def get_api(self, api, ticket): + def api_response(self, api, ticket): res = getURL("%s%s.aspx" % (self.API_URL, api), get={"username": self.getConfig("username"), "password": self.getConfig("passkey"), @@ -160,7 +160,7 @@ class CaptchaBrotherhood(Hook): def captchaInvalid(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: - res = self.get_api("complainCaptcha", task.data['ticket']) + res = self.api_response("complainCaptcha", task.data['ticket']) @threaded diff --git a/module/plugins/hooks/DeathByCaptcha.py b/module/plugins/hooks/DeathByCaptcha.py index 98412c218..050b6fe15 100644 --- a/module/plugins/hooks/DeathByCaptcha.py +++ b/module/plugins/hooks/DeathByCaptcha.py @@ -51,7 +51,7 @@ class DeathByCaptchaException(Exception): class DeathByCaptcha(Hook): __name__ = "DeathByCaptcha" __type__ = "hook" - __version__ = "0.05" + __version__ = "0.06" __config__ = [("username", "str", "Username", ""), ("passkey", "password", "Password", ""), @@ -75,7 +75,7 @@ class DeathByCaptcha(Hook): self.info = {} #@TODO: Remove in 0.4.10 - def call_api(self, api="captcha", post=False, multipart=False): + def api_response(self, api="captcha", post=False, multipart=False): req = getRequest() req.c.setopt(HTTPHEADER, ["Accept: application/json", "User-Agent: pyLoad %s" % self.core.version]) @@ -117,7 +117,7 @@ class DeathByCaptcha(Hook): def getCredits(self): - res = self.call_api("user", True) + res = self.api_response("user", True) if 'is_banned' in res and res['is_banned']: raise DeathByCaptchaException('banned') @@ -128,7 +128,7 @@ class DeathByCaptcha(Hook): def getStatus(self): - res = self.call_api("status", False) + res = self.api_response("status", False) if 'is_service_overloaded' in res and res['is_service_overloaded']: raise DeathByCaptchaException('service-overload') @@ -145,7 +145,7 @@ class DeathByCaptcha(Hook): data = f.read() data = "base64:" + b64encode(data) - res = self.call_api("captcha", {"captchafile": data}, multipart) + res = self.api_response("captcha", {"captchafile": data}, multipart) if "captcha" not in res: raise DeathByCaptchaException(res) @@ -153,7 +153,7 @@ class DeathByCaptcha(Hook): for _i in xrange(24): sleep(5) - res = self.call_api("captcha/%d" % ticket, False) + res = self.api_response("captcha/%d" % ticket, False) if res['text'] and res['is_correct']: break else: @@ -200,7 +200,7 @@ class DeathByCaptcha(Hook): def captchaInvalid(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: try: - res = self.call_api("captcha/%d/report" % task.data['ticket'], True) + res = self.api_response("captcha/%d/report" % task.data['ticket'], True) except DeathByCaptchaException, e: self.logError(e.getDesc()) diff --git a/module/plugins/hooks/DebridItaliaCom.py b/module/plugins/hooks/DebridItaliaCom.py index d18be5384..719f3dd3a 100644 --- a/module/plugins/hooks/DebridItaliaCom.py +++ b/module/plugins/hooks/DebridItaliaCom.py @@ -8,12 +8,15 @@ from module.plugins.internal.MultiHook import MultiHook class DebridItaliaCom(MultiHook): __name__ = "DebridItaliaCom" __type__ = "hook" - __version__ = "0.11" - - __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", ""), - ("revertfailed", "bool", "Revert to standard download if download fails", False), - ("interval", "int", "Reload interval in hours (0 to disable)", 24)] + __version__ = "0.12" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """Debriditalia.com hook plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hooks/EasybytezCom.py b/module/plugins/hooks/EasybytezCom.py index 1606c9f30..c460de7b7 100644 --- a/module/plugins/hooks/EasybytezCom.py +++ b/module/plugins/hooks/EasybytezCom.py @@ -8,10 +8,15 @@ from module.plugins.internal.MultiHook import MultiHook class EasybytezCom(MultiHook): __name__ = "EasybytezCom" __type__ = "hook" - __version__ = "0.06" - - __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", "")] + __version__ = "0.07" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """EasyBytez.com hook plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hooks/FastixRu.py b/module/plugins/hooks/FastixRu.py index a4b423fb7..25126fbd3 100644 --- a/module/plugins/hooks/FastixRu.py +++ b/module/plugins/hooks/FastixRu.py @@ -7,11 +7,15 @@ from module.plugins.internal.MultiHook import MultiHook class FastixRu(MultiHook): __name__ = "FastixRu" __type__ = "hook" - __version__ = "0.04" + __version__ = "0.05" - __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("revertfailed", "bool", "Revert to standard download if download fails", False), - ("interval", "int", "Reload interval in hours (0 to disable)", 24)] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """Fastix.ru hook plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hooks/FreeWayMe.py b/module/plugins/hooks/FreeWayMe.py index 6cbea3417..6fec037d8 100644 --- a/module/plugins/hooks/FreeWayMe.py +++ b/module/plugins/hooks/FreeWayMe.py @@ -6,12 +6,15 @@ from module.plugins.internal.MultiHook import MultiHook class FreeWayMe(MultiHook): __name__ = "FreeWayMe" __type__ = "hook" - __version__ = "0.13" + __version__ = "0.14" - __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", ""), - ("revertfailed", "bool", "Revert to standard download if download fails", False), - ("interval", "int", "Reload interval in hours (0 to disable)", 24)] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """FreeWay.me hook plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hooks/LinkdecrypterCom.py b/module/plugins/hooks/LinkdecrypterCom.py index 8592efd3d..d4924a687 100644 --- a/module/plugins/hooks/LinkdecrypterCom.py +++ b/module/plugins/hooks/LinkdecrypterCom.py @@ -8,11 +8,12 @@ from module.plugins.internal.MultiHook import MultiHook class LinkdecrypterCom(MultiHook): __name__ = "LinkdecrypterCom" __type__ = "hook" - __version__ = "1.00" + __version__ = "1.01" - __config__ = [("mode" , "all;listed;unlisted", "Use for crypters (if supported)" , "all"), - ("pluginlist" , "str" , "Crypter list (comma separated)" , "" ), - ("interval" , "int" , "Reload interval in hours (0 to disable)" , 12 )] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """Linkdecrypter.com hook plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hooks/LinksnappyCom.py b/module/plugins/hooks/LinksnappyCom.py index a1c4b90f7..5eb0c7f6d 100644 --- a/module/plugins/hooks/LinksnappyCom.py +++ b/module/plugins/hooks/LinksnappyCom.py @@ -7,12 +7,15 @@ from module.plugins.internal.MultiHook import MultiHook class LinksnappyCom(MultiHook): __name__ = "LinksnappyCom" __type__ = "hook" - __version__ = "0.03" - - __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", ""), - ("revertfailed", "bool", "Revert to standard download if download fails", False), - ("interval", "int", "Reload interval in hours (0 to disable)", 24)] + __version__ = "0.04" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """Linksnappy.com hook plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hooks/MegaDebridEu.py b/module/plugins/hooks/MegaDebridEu.py index 5fb7e1ea6..f67fa7ac0 100644 --- a/module/plugins/hooks/MegaDebridEu.py +++ b/module/plugins/hooks/MegaDebridEu.py @@ -7,11 +7,17 @@ from module.plugins.internal.MultiHook import MultiHook class MegaDebridEu(MultiHook): __name__ = "MegaDebridEu" __type__ = "hook" - __version__ = "0.04" + __version__ = "0.05" - __config__ = [("revertfailed", "bool", "Revert to standard download if download fails", False)] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - __description__ = """mega-debrid.eu hook plugin""" + __description__ = """Mega-debrid.eu hook plugin""" __license__ = "GPLv3" __authors__ = [("D.Ducatel", "dducatel@je-geek.fr")] diff --git a/module/plugins/hooks/MultihostersCom.py b/module/plugins/hooks/MultihostersCom.py index 5ada3aa56..bf88cfae7 100644 --- a/module/plugins/hooks/MultihostersCom.py +++ b/module/plugins/hooks/MultihostersCom.py @@ -1,22 +1,18 @@ # -*- coding: utf-8 -*- -from module.network.RequestFactory import getURL -from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.hooks.ZeveraCom import ZeveraCom -class MultihostersCom(MultiHoster): - __name__ = "MultihostersCom" - __version__ = "0.01" - __type__ = "hook" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("hosterList", "str", "Hoster list (comma separated)", ""), - ("unloadFailing", "bool", "Revert to standard download if download fails", False), - ("interval", "int", "Reload interval in hours (0 to disable)", 24)] - __description__ = """Multihosters.com hook plugin""" - __author_name__ = "tjeh" - __author_mail__ = "tjeh@gmx.net" +class MultihostersCom(ZeveraCom): + __name__ = "MultihostersCom" + __type__ = "hook" + __version__ = "0.02" + + __config__ = [("mode" , "all;listed;unlisted", "Use for plugins (if supported)" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed", "bool" , "Revert to standard download if download fails", False), + ("interval" , "int" , "Reload interval in hours (0 to disable)" , 12 )] - def getHoster(self): - page = getURL("http://www.multihosters.com/jDownloader.ashx?cmd=gethosters") - return [x.strip() for x in page.split(",")] \ No newline at end of file + __description__ = """Multihosters.com hook plugin""" + __license__ = "GPLv3" + __authors__ = [("tjeh", "tjeh@gmx.net")] diff --git a/module/plugins/hooks/MultishareCz.py b/module/plugins/hooks/MultishareCz.py index 2dadf5dc1..8349e0de8 100644 --- a/module/plugins/hooks/MultishareCz.py +++ b/module/plugins/hooks/MultishareCz.py @@ -8,10 +8,15 @@ from module.plugins.internal.MultiHook import MultiHook class MultishareCz(MultiHook): __name__ = "MultishareCz" __type__ = "hook" - __version__ = "0.06" - - __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", "uloz.to")] + __version__ = "0.07" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """MultiShare.cz hook plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hooks/MyfastfileCom.py b/module/plugins/hooks/MyfastfileCom.py index 2fda0d3bf..86408cb6d 100644 --- a/module/plugins/hooks/MyfastfileCom.py +++ b/module/plugins/hooks/MyfastfileCom.py @@ -7,12 +7,15 @@ from module.plugins.internal.MultiHook import MultiHook class MyfastfileCom(MultiHook): __name__ = "MyfastfileCom" __type__ = "hook" - __version__ = "0.04" - - __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", ""), - ("revertfailed", "bool", "Revert to standard download if download fails", False), - ("interval", "int", "Reload interval in hours (0 to disable)", 24)] + __version__ = "0.05" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """Myfastfile.com hook plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hooks/NoPremiumPl.py b/module/plugins/hooks/NoPremiumPl.py index 2347fc58a..1727bec70 100644 --- a/module/plugins/hooks/NoPremiumPl.py +++ b/module/plugins/hooks/NoPremiumPl.py @@ -1,28 +1,31 @@ # -*- coding: utf-8 -*- +from module.common.json_layer import json_loads from module.plugins.internal.MultiHook import MultiHook -from module.common.json_layer import json_loads as loads class NoPremiumPl(MultiHook): - __name__ = "NoPremiumPl" - __version__ = "0.02" - __type__ = "hook" + __name__ = "NoPremiumPl" + __type__ = "hook" + __version__ = "0.03" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), - ("hosterList", "str", "Hoster list (comma separated)", ""), - ("unloadFailing", "bool", "Try standard download if download fails", False), - ("interval", "int", "Reload supported hosts interval in hours (0 to disable)", 24)] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] + + __description__ = """NoPremium.pl hook plugin""" + __license__ = "GPLv3" + __authors__ = [("goddie", "dev@nopremium.pl")] - __description__ = "NoPremium.pl hook" - __license__ = "GPLv3" - __authors__ = [("goddie", "dev@nopremium.pl")] def getHosters(self): - hostings = loads(self.getURL("https://www.nopremium.pl/clipboard.php?json=3").strip()) + hostings = json_loads(self.getURL("https://www.nopremium.pl/clipboard.php?json=3").strip()) hostings_domains = [domain for row in hostings for domain in row["domains"] if row["sdownload"] == "0"] - self.logDebug(hostings_domains) - return hostings_domains + self.logDebug(hostings_domains) + return hostings_domains diff --git a/module/plugins/hooks/OverLoadMe.py b/module/plugins/hooks/OverLoadMe.py index eb3da319a..1872f8ccb 100644 --- a/module/plugins/hooks/OverLoadMe.py +++ b/module/plugins/hooks/OverLoadMe.py @@ -6,13 +6,16 @@ from module.plugins.internal.MultiHook import MultiHook class OverLoadMe(MultiHook): __name__ = "OverLoadMe" __type__ = "hook" - __version__ = "0.03" + __version__ = "0.04" - __config__ = [("https", "bool", "Enable HTTPS", True), - ("mode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", ""), - ("revertfailed", "bool", "Revert to standard download if download fails", False), - ("interval", "int", "Reload interval in hours (0 to disable)", 12)] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 ), + ("ssl" , "bool" , "Use HTTPS" , True )] __description__ = """Over-Load.me hook plugin""" __license__ = "GPLv3" @@ -20,7 +23,7 @@ class OverLoadMe(MultiHook): def getHosters(self): - https = "https" if self.getConfig("https") else "http" + https = "https" if self.getConfig("ssl") else "http" page = self.getURL(https + "://api.over-load.me/hoster.php", get={'auth': "0001-cb1f24dadb3aa487bda5afd3b76298935329be7700cd7-5329be77-00cf-1ca0135f"}).replace("\"", "").strip() self.logDebug("Hosterlist", page) diff --git a/module/plugins/hooks/PremiumTo.py b/module/plugins/hooks/PremiumTo.py index a4203c8bb..844ecc89d 100644 --- a/module/plugins/hooks/PremiumTo.py +++ b/module/plugins/hooks/PremiumTo.py @@ -6,10 +6,15 @@ from module.plugins.internal.MultiHook import MultiHook class PremiumTo(MultiHook): __name__ = "PremiumTo" __type__ = "hook" - __version__ = "0.07" + __version__ = "0.08" - __config__ = [("mode", "all;listed;unlisted", "Use for downloads from supported hosters:", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", "")] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """Premium.to hook plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hooks/PremiumizeMe.py b/module/plugins/hooks/PremiumizeMe.py index d334ddd25..293fcf339 100644 --- a/module/plugins/hooks/PremiumizeMe.py +++ b/module/plugins/hooks/PremiumizeMe.py @@ -7,12 +7,15 @@ from module.plugins.internal.MultiHook import MultiHook class PremiumizeMe(MultiHook): __name__ = "PremiumizeMe" __type__ = "hook" - __version__ = "0.16" - - __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", ""), - ("revertfailed", "bool", "Revert to standard download if download fails", False), - ("interval", "int", "Reload interval in hours (0 to disable)", 24)] + __version__ = "0.17" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """Premiumize.me hook plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hooks/PutdriveCom.py b/module/plugins/hooks/PutdriveCom.py new file mode 100644 index 000000000..f665dabee --- /dev/null +++ b/module/plugins/hooks/PutdriveCom.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +from module.plugins.hooks.ZeveraCom import ZeveraCom + + +class PutdriveCom(ZeveraCom): + __name__ = "PutdriveCom" + __type__ = "hook" + __version__ = "0.01" + + __config__ = [("mode" , "all;listed;unlisted", "Use for plugins (if supported)" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed", "bool" , "Revert to standard download if download fails", False), + ("interval" , "int" , "Reload interval in hours (0 to disable)" , 12 )] + + __description__ = """Putdrive.com hook plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] diff --git a/module/plugins/hooks/RPNetBiz.py b/module/plugins/hooks/RPNetBiz.py index 9c88e6c01..0768bd6cd 100644 --- a/module/plugins/hooks/RPNetBiz.py +++ b/module/plugins/hooks/RPNetBiz.py @@ -7,12 +7,15 @@ from module.plugins.internal.MultiHook import MultiHook class RPNetBiz(MultiHook): __name__ = "RPNetBiz" __type__ = "hook" - __version__ = "0.13" - - __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", ""), - ("revertfailed", "bool", "Revert to standard download if download fails", False), - ("interval", "int", "Reload interval in hours (0 to disable)", 24)] + __version__ = "0.14" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """RPNet.biz hook plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hooks/RapideoPl.py b/module/plugins/hooks/RapideoPl.py index 9eb454897..b605eca17 100644 --- a/module/plugins/hooks/RapideoPl.py +++ b/module/plugins/hooks/RapideoPl.py @@ -1,28 +1,31 @@ # -*- coding: utf-8 -*- +from module.common.json_layer import json_loads from module.plugins.internal.MultiHook import MultiHook -from module.common.json_layer import json_loads as loads class RapideoPl(MultiHook): - __name__ = "RapideoPl" - __version__ = "0.02" - __type__ = "hook" + __name__ = "RapideoPl" + __type__ = "hook" + __version__ = "0.03" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), - ("hosterList", "str", "Hoster list (comma separated)", ""), - ("unloadFailing", "bool", "Try standard download if download fails", False), - ("interval", "int", "Reload supported hosts interval in hours (0 to disable)", 24)] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] + + __description__ = """Rapideo.pl hook plugin""" + __license__ = "GPLv3" + __authors__ = [("goddie", "dev@rapideo.pl")] - __description__ = "Rapideo.pl hook" - __license__ = "GPLv3" - __authors__ = [("goddie", "dev@rapideo.pl")] def getHosters(self): - hostings = loads(self.getURL("https://www.rapideo.pl/clipboard.php?json=3").strip()) + hostings = json_loads(self.getURL("https://www.rapideo.pl/clipboard.php?json=3").strip()) hostings_domains = [domain for row in hostings for domain in row["domains"] if row["sdownload"] == "0"] - self.logDebug(hostings_domains) - return hostings_domains + self.logDebug(hostings_domains) + return hostings_domains diff --git a/module/plugins/hooks/RealdebridCom.py b/module/plugins/hooks/RealdebridCom.py index bac18e6c3..cff97c2f9 100644 --- a/module/plugins/hooks/RealdebridCom.py +++ b/module/plugins/hooks/RealdebridCom.py @@ -6,13 +6,16 @@ from module.plugins.internal.MultiHook import MultiHook class RealdebridCom(MultiHook): __name__ = "RealdebridCom" __type__ = "hook" - __version__ = "0.45" + __version__ = "0.46" - __config__ = [("https", "bool", "Enable HTTPS", False), - ("mode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", ""), - ("revertfailed", "bool", "Revert to standard download if download fails", False), - ("interval", "int", "Reload interval in hours (0 to disable)", 24)] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 ), + ("ssl" , "bool" , "Use HTTPS" , True )] __description__ = """Real-Debrid.com hook plugin""" __license__ = "GPLv3" @@ -20,7 +23,7 @@ class RealdebridCom(MultiHook): def getHosters(self): - https = "https" if self.getConfig("https") else "http" + https = "https" if self.getConfig("ssl") else "http" page = self.getURL(https + "://real-debrid.com/api/hosters.php").replace("\"", "").strip() return [x.strip() for x in page.split(",") if x.strip()] diff --git a/module/plugins/hooks/RehostTo.py b/module/plugins/hooks/RehostTo.py index 527770eb6..81cb26f2f 100644 --- a/module/plugins/hooks/RehostTo.py +++ b/module/plugins/hooks/RehostTo.py @@ -6,12 +6,15 @@ from module.plugins.internal.MultiHook import MultiHook class RehostTo(MultiHook): __name__ = "RehostTo" __type__ = "hook" - __version__ = "0.46" - - __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", ""), - ("revertfailed", "bool", "Revert to standard download if download fails", False), - ("interval", "int", "Reload interval in hours (0 to disable)", 24)] + __version__ = "0.47" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """Rehost.to hook plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hooks/SimplyPremiumCom.py b/module/plugins/hooks/SimplyPremiumCom.py index 5f2d2a42c..843a3aa82 100644 --- a/module/plugins/hooks/SimplyPremiumCom.py +++ b/module/plugins/hooks/SimplyPremiumCom.py @@ -7,13 +7,15 @@ from module.plugins.internal.MultiHook import MultiHook class SimplyPremiumCom(MultiHook): __name__ = "SimplyPremiumCom" __type__ = "hook" - __version__ = "0.04" - - __config__ = [("activated", "bool", "Activated", "False"), - ("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", ""), - ("revertfailed", "bool", "Revert to standard download if download fails", "False"), - ("interval", "int", "Reload interval in hours (0 to disable)", "24")] + __version__ = "0.05" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """Simply-Premium.com hook plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hooks/SimplydebridCom.py b/module/plugins/hooks/SimplydebridCom.py index 13c957294..10c613fb5 100644 --- a/module/plugins/hooks/SimplydebridCom.py +++ b/module/plugins/hooks/SimplydebridCom.py @@ -6,10 +6,15 @@ from module.plugins.internal.MultiHook import MultiHook class SimplydebridCom(MultiHook): __name__ = "SimplydebridCom" __type__ = "hook" - __version__ = "0.03" + __version__ = "0.04" - __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", "")] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """Simply-Debrid.com hook plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hooks/SmoozedCom.py b/module/plugins/hooks/SmoozedCom.py index 0aff36c0f..4e706c959 100644 --- a/module/plugins/hooks/SmoozedCom.py +++ b/module/plugins/hooks/SmoozedCom.py @@ -6,38 +6,21 @@ from module.plugins.internal.MultiHook import MultiHook class SmoozedCom(MultiHook): __name__ = "SmoozedCom" __type__ = "hook" - __version__ = "0.01" + __version__ = "0.02" - __config__ = [("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), - ("hosterList", "str", "Hoster list (comma separated)", ""), - ("unloadFailing", "bool", "Revert to stanard download if download fails", False), - ("interval", "int", "Reload interval in hours (0 to disable)", 24)] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """Smoozed.com hook plugin""" __license__ = "GPLv3" - __authors__ = [] + __authors__ = [("", "")] def getHosters(self): - # If no accounts are available there will be no hosters available - if not self.account or not self.account.canUse(): - return [] - - # Get account data - (user, data) = self.account.selectAccount() - account_info = self.account.getAccountInfo(user, True) - - # Return hoster list - return account_info["hoster"] - - - def coreReady(self): - # Get account plugin and check if there is a valid account available - self.account = self.core.accountManager.getAccountPlugin("SmoozedCom") - if not self.account.canUse(): - self.account = None - self.logError(_("Please add a valid premiumize.me account first and restart pyLoad")) - return - - # Run the overwriten core ready which actually enables the multihook hook - return MultiHook.coreReady(self) + user, data = self.account.selectAccount() + return self.account.getAccountData(user)["hosters"] diff --git a/module/plugins/hooks/UnrestrictLi.py b/module/plugins/hooks/UnrestrictLi.py index e481e8449..cb5abb26e 100644 --- a/module/plugins/hooks/UnrestrictLi.py +++ b/module/plugins/hooks/UnrestrictLi.py @@ -7,13 +7,16 @@ from module.plugins.internal.MultiHook import MultiHook class UnrestrictLi(MultiHook): __name__ = "UnrestrictLi" __type__ = "hook" - __version__ = "0.04" + __version__ = "0.05" - __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", ""), - ("revertfailed", "bool", "Revert to standard download if download fails", False), - ("interval", "int", "Reload interval in hours (0 to disable)", 24), - ("history", "bool", "Delete History", False)] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 ), + ("history" , "bool" , "Delete History" , False)] __description__ = """Unrestrict.li hook plugin""" __license__ = "GPLv3" @@ -24,6 +27,4 @@ class UnrestrictLi(MultiHook): json_data = self.getURL("http://unrestrict.li/api/jdownloader/hosts.php", get={'format': "json"}) json_data = json_loads(json_data) - host_list = [element['host'] for element in json_data['result']] - - return host_list + return [element['host'] for element in json_data['result']] diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py index 79e373ad3..73cb0b0eb 100644 --- a/module/plugins/hooks/XFileSharingPro.py +++ b/module/plugins/hooks/XFileSharingPro.py @@ -8,7 +8,7 @@ from module.plugins.Hook import Hook class XFileSharingPro(Hook): __name__ = "XFileSharingPro" __type__ = "hook" - __version__ = "0.28" + __version__ = "0.29" __config__ = [("activated" , "bool", "Activated" , True ), ("use_hoster_list" , "bool", "Load listed hosters only" , False), @@ -23,14 +23,15 @@ class XFileSharingPro(Hook): # event_list = ["pluginConfigChanged"] - regexp = {'hoster' : (r'https?://(?:www\.)?([\w.^_]+(?:\.[a-zA-Z]{2,})(?:\:\d+)?)/(?:embed-)?\w{12}(?:\W|$)', - r'https?://(?:[^/]+\.)?(%s)/(?:embed-)?\w+'), - 'crypter': (r'https?://(?:www\.)?([\w.^_]+(?:\.[a-zA-Z]{2,})(?:\:\d+)?)/(?:user|folder)s?/\w+', - r'https?://(?:[^/]+\.)?(%s)/(?:user|folder)s?/\w+')} + regexp = {'hoster' : (r'https?://(?:www\.)?(?P<DOMAIN>[\w.^_]+(?:\.[a-zA-Z]{2,})(?:\:\d+)?)/(?:embed-)?\w{12}(?:\W|$)', + r'https?://(?:[^/]+\.)?(?P<DOMAIN>%s)/(?:embed-)?\w+'), + 'crypter': (r'https?://(?:www\.)?(?P<DOMAIN>[\w.^_]+(?:\.[a-zA-Z]{2,})(?:\:\d+)?)/(?:user|folder)s?/\w+', + r'https?://(?:[^/]+\.)?(?P<DOMAIN>%s)/(?:user|folder)s?/\w+')} HOSTER_BUILTIN = [#WORKING HOSTERS: - "eyesfile.ca", "file4safe.com", "fileband.com", "filedwon.com", "filevice.com", "hostingbulk.com", - "ravishare.com", "salefiles.com", "sharesix.com", "thefile.me", "verzend.be", "xvidstage.com", + "180upload.com", "backin.net", "eyesfile.ca", "file4safe.com", "fileband.com", "filedwon.com", + "fileparadox.in", "filevice.com", "hostingbulk.com", "linestorage.com", "ravishare.com", "salefiles.com", + "sendmyway.com", "sharesix.com", "thefile.me", "verzend.be", "xvidstage.com", #NOT TESTED: "101shared.com", "4upfiles.com", "filemaze.ws", "filenuke.com", "linkzhost.com", "mightyupload.com", "rockdizfile.com", "sharebeast.com", "sharerepo.com", "shareswift.com", "uploadbaz.com", "uploadc.com", @@ -82,7 +83,7 @@ class XFileSharingPro(Hook): len_match_list = len(plugin_list) self.logInfo(_("Handling %d %s%s: %s") % (len_match_list, type, - "" if len_match_list is 1 else "s", + "" if len_match_list == 1 else "s", match_list.replace('|', ', '))) pattern = self.regexp[type][1] % match_list.replace('.', '\.') @@ -109,7 +110,7 @@ class XFileSharingPro(Hook): def unloadHoster(self, hoster): hdict = self.core.pluginManager.hosterPlugins[hoster] - if "new_name" in hdict and hdict['new_name'] is "XFileSharingPro": + if "new_name" in hdict and hdict['new_name'] == "XFileSharingPro": if "module" in hdict: del hdict['module'] @@ -123,7 +124,7 @@ class XFileSharingPro(Hook): # def downloadFailed(self, pyfile): - # if pyfile.pluginname is "BasePlugin" \ + # if pyfile.pluginname == "BasePlugin" \ # and pyfile.hasStatus("failed") \ # and not self.getConfig("use_hoster_list") \ # and self.unloadHoster("BasePlugin"): diff --git a/module/plugins/hooks/ZeveraCom.py b/module/plugins/hooks/ZeveraCom.py index 51f759b1c..215ec3673 100644 --- a/module/plugins/hooks/ZeveraCom.py +++ b/module/plugins/hooks/ZeveraCom.py @@ -6,16 +6,22 @@ from module.plugins.internal.MultiHook import MultiHook class ZeveraCom(MultiHook): __name__ = "ZeveraCom" __type__ = "hook" - __version__ = "0.04" + __version__ = "0.05" - __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", "")] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - __description__ = """Real-Debrid.com hook plugin""" + __description__ = """Zevera.com hook plugin""" __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com")] def getHosters(self): - page = self.getURL("http://www.zevera.com/jDownloader.ashx", get={'cmd': "gethosters"}) - return [x.strip() for x in page.replace("\"", "").split(",")] + html = self.account.api_response(pyreq.getHTTPRequest(timeout=120), cmd="gethosters") + return [x.strip() for x in html.split(",")] -- cgit v1.2.3 From 73b7584189b091006893f27ca91e79472ddb77ad Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Fri, 9 Jan 2015 17:32:26 +0100 Subject: [SkipRev] Improve file name grabbing --- module/plugins/hooks/SkipRev.py | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index cc32c365e..ad6d7dacd 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -18,7 +18,7 @@ def _setup(self): class SkipRev(Hook): __name__ = "SkipRev" __type__ = "hook" - __version__ = "0.21" + __version__ = "0.22" __config__ = [("tokeep", "int", "Number of rev files to keep for package (-1 to auto)", -1)] @@ -33,23 +33,11 @@ class SkipRev(Hook): def _pyname(self, pyfile): - url = pyfile.url - plugin = pyfile.plugin - - if hasattr(plugin, "info") and 'name' in plugin.info and plugin.info['name']: - name = plugin.info['name'] - - elif hasattr(plugin, "parseInfos"): - name = next(plugin.parseInfos([url]))['name'] - - elif hasattr(plugin, "getInfo"): #@NOTE: if parseInfos was not found, getInfo should be missing too - name = plugin.getInfo(url)['name'] - + if hasattr(pyfile.pluginmodule, "getInfo"): + return getattr(pyfile.pluginmodule, "getInfo")([pyfile.url])[0][0] else: self.logWarning("Unable to grab file name") - name = urlparse(unquote(url)).path.split('/')[-1] - - return name + return urlparse(unquote(pyfile.url)).path.split('/')[-1] def _pyfile(self, link): -- cgit v1.2.3 From b4a26e4bdcfa697b833abac4b2a500000f24684f Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Fri, 9 Jan 2015 17:35:08 +0100 Subject: Fix some plugins name --- module/plugins/hooks/Captcha9kw.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/Captcha9kw.py b/module/plugins/hooks/Captcha9kw.py index 6eb4ef305..600694e78 100755 --- a/module/plugins/hooks/Captcha9kw.py +++ b/module/plugins/hooks/Captcha9kw.py @@ -13,8 +13,8 @@ from module.network.RequestFactory import getURL from module.plugins.Hook import Hook, threaded -class Captcha9kw(Hook): - __name__ = "Captcha9kw" +class Captcha9Kw(Hook): + __name__ = "Captcha9Kw" __type__ = "hook" __version__ = "0.27" -- cgit v1.2.3 From 21446b75ee240f2aee137aa1998ee0184fe47bf4 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sat, 10 Jan 2015 01:51:06 +0100 Subject: [RyushareCom] Update --- module/plugins/hooks/XFileSharingPro.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py index 73cb0b0eb..0745a6c7e 100644 --- a/module/plugins/hooks/XFileSharingPro.py +++ b/module/plugins/hooks/XFileSharingPro.py @@ -8,7 +8,7 @@ from module.plugins.Hook import Hook class XFileSharingPro(Hook): __name__ = "XFileSharingPro" __type__ = "hook" - __version__ = "0.29" + __version__ = "0.30" __config__ = [("activated" , "bool", "Activated" , True ), ("use_hoster_list" , "bool", "Load listed hosters only" , False), @@ -30,8 +30,8 @@ class XFileSharingPro(Hook): HOSTER_BUILTIN = [#WORKING HOSTERS: "180upload.com", "backin.net", "eyesfile.ca", "file4safe.com", "fileband.com", "filedwon.com", - "fileparadox.in", "filevice.com", "hostingbulk.com", "linestorage.com", "ravishare.com", "salefiles.com", - "sendmyway.com", "sharesix.com", "thefile.me", "verzend.be", "xvidstage.com", + "fileparadox.in", "filevice.com", "hostingbulk.com", "linestorage.com", "ravishare.com", "ryushare.com", + "salefiles.com", "sendmyway.com", "sharesix.com", "thefile.me", "verzend.be", "xvidstage.com", #NOT TESTED: "101shared.com", "4upfiles.com", "filemaze.ws", "filenuke.com", "linkzhost.com", "mightyupload.com", "rockdizfile.com", "sharebeast.com", "sharerepo.com", "shareswift.com", "uploadbaz.com", "uploadc.com", -- cgit v1.2.3 From b617325d793a55d25f4812b1c6a7b9e656b9c73f Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sat, 10 Jan 2015 15:55:06 +0100 Subject: [RehostTo] Fix https://github.com/pyload/pyload/issues/1009 --- module/plugins/hooks/RehostTo.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/RehostTo.py b/module/plugins/hooks/RehostTo.py index 81cb26f2f..d2383cf98 100644 --- a/module/plugins/hooks/RehostTo.py +++ b/module/plugins/hooks/RehostTo.py @@ -6,7 +6,7 @@ from module.plugins.internal.MultiHook import MultiHook class RehostTo(MultiHook): __name__ = "RehostTo" __type__ = "hook" - __version__ = "0.47" + __version__ = "0.48" __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), @@ -22,15 +22,8 @@ class RehostTo(MultiHook): def getHosters(self): + user, data = self.account.selectAccount() page = self.getURL("http://rehost.to/api.php", - get={'cmd': "get_supported_och_dl", 'long_ses': self.long_ses}) + get={'cmd' : "get_supported_och_dl", + 'long_ses': self.getAccountData(user)['session']}) return [x.strip() for x in page.replace("\"", "").split(",")] - - - def coreReady(self): - super(RehostTo, self).coreReady() - - user, data = self.account.selectAccount() - - self.ses = data['ses'] - self.long_ses = data['long_ses'] -- cgit v1.2.3 From 615e713cc874ffe4a1d15b2607c67b24ab2b4297 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sat, 10 Jan 2015 17:27:00 +0100 Subject: [RehostTo] Fix typo (2) --- module/plugins/hooks/RehostTo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/RehostTo.py b/module/plugins/hooks/RehostTo.py index d2383cf98..0cb736d9c 100644 --- a/module/plugins/hooks/RehostTo.py +++ b/module/plugins/hooks/RehostTo.py @@ -6,7 +6,7 @@ from module.plugins.internal.MultiHook import MultiHook class RehostTo(MultiHook): __name__ = "RehostTo" __type__ = "hook" - __version__ = "0.48" + __version__ = "0.49" __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), @@ -25,5 +25,5 @@ class RehostTo(MultiHook): user, data = self.account.selectAccount() page = self.getURL("http://rehost.to/api.php", get={'cmd' : "get_supported_och_dl", - 'long_ses': self.getAccountData(user)['session']}) + 'long_ses': self.account.getAccountData(user)['session']}) return [x.strip() for x in page.replace("\"", "").split(",")] -- cgit v1.2.3 From 4747e1d7958c9fb1180da6f3a21f3093220a6655 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sat, 10 Jan 2015 21:17:27 +0100 Subject: Code improvements --- module/plugins/hooks/EasybytezCom.py | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/EasybytezCom.py b/module/plugins/hooks/EasybytezCom.py index c460de7b7..e08127514 100644 --- a/module/plugins/hooks/EasybytezCom.py +++ b/module/plugins/hooks/EasybytezCom.py @@ -26,18 +26,7 @@ class EasybytezCom(MultiHook): def getHosters(self): user, data = self.account.selectAccount() - try: - req = self.account.getAccountRequest(user) - page = req.load("http://www.easybytez.com") + req = self.account.getAccountRequest(user) + page = req.load("http://www.easybytez.com") - hosters = re.search(r'</textarea>\s*Supported sites:(.*)', page).group(1).split(',') - - except Exception, e: - self.logWarning(_("Unable to load supported hoster list, using last known")) - self.logDebug(e) - - hosters = ["bitshare.com", "crocko.com", "ddlstorage.com", "depositfiles.com", "extabit.com", "hotfile.com", - "mediafire.com", "netload.in", "rapidgator.net", "rapidshare.com", "uploading.com", "uload.to", - "uploaded.to"] - finally: - return hosters + return re.search(r'</textarea>\s*Supported sites:(.*)', page).group(1).split(',') -- cgit v1.2.3 From 537e181c07876352581caf892f130cd0d7152290 Mon Sep 17 00:00:00 2001 From: Shuralon <manu.aslan@live.de> Date: Sun, 11 Jan 2015 14:25:14 +0100 Subject: [RehostTo] Fix --- module/plugins/hooks/RehostTo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/RehostTo.py b/module/plugins/hooks/RehostTo.py index 0cb736d9c..653a0444e 100644 --- a/module/plugins/hooks/RehostTo.py +++ b/module/plugins/hooks/RehostTo.py @@ -6,7 +6,7 @@ from module.plugins.internal.MultiHook import MultiHook class RehostTo(MultiHook): __name__ = "RehostTo" __type__ = "hook" - __version__ = "0.49" + __version__ = "0.5" __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), @@ -25,5 +25,5 @@ class RehostTo(MultiHook): user, data = self.account.selectAccount() page = self.getURL("http://rehost.to/api.php", get={'cmd' : "get_supported_och_dl", - 'long_ses': self.account.getAccountData(user)['session']}) + 'long_ses': self.account.getAccountInfo(user)['session']}) return [x.strip() for x in page.replace("\"", "").split(",")] -- cgit v1.2.3 From 2b9e1237bed5866d0349a420d7d806fad75400c6 Mon Sep 17 00:00:00 2001 From: Steven Kosyra <steven.kosyra@googlemail.com> Date: Sun, 11 Jan 2015 15:04:07 +0100 Subject: AndroidPhoneNotify added --- module/plugins/hooks/AndroidPhoneNotify.py | 37 ++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 module/plugins/hooks/AndroidPhoneNotify.py (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/AndroidPhoneNotify.py b/module/plugins/hooks/AndroidPhoneNotify.py new file mode 100644 index 000000000..d6bf64db4 --- /dev/null +++ b/module/plugins/hooks/AndroidPhoneNotify.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- + + +from module.plugins.Hook import Hook +from module.network.RequestFactory import getURL + +class AndroidPhoneNotify(Hook): + __name__ = "AndroidPhoneNotify" + __type__ = "hook" + __version__ = "0.01" + + __config__ = [("apikey", "str", "apikey", ""), + ("appname", "str", "ApplicationName", "pyLoad"), + ("notifycaptcha", "bool", "Send captcha notifications (maybe usefull if premium fails)", False)] + + __description__ = """Send push notifications to your Android Phone using notifymyandroid.com""" + __license__ = "GPLv3" + __authors__ = [("Steven Kosyra", "steven.kosyra@gmail.com")] + + + def packageFinished(self, pypack): + self.genUrl("Package finished:",pypack.name) + + + def newCaptchaTask(self, task): + if self.getConfig("notifycaptcha"): + self.genUrl("Captcha","new Captcha request") + + + + def genUrl(self,event, msg): + self.response(event, msg) + + + + def response(self, event, msg): + html = getURL("http://www.notifymyandroid.com/publicapi/notify?apikey=" + self.getConfig("apikey") + "&application=" + self.getConfig("appname") + "&event=" + str(event) + "&description= " + str(msg) + "") -- cgit v1.2.3 From 187586c77f750340c2d8c84781c82a3e612f17c3 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sun, 11 Jan 2015 20:20:43 +0100 Subject: Fix getAccount in some plugins --- module/plugins/hooks/RehostTo.py | 2 +- module/plugins/hooks/SmoozedCom.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/RehostTo.py b/module/plugins/hooks/RehostTo.py index 653a0444e..ddb8b3eb0 100644 --- a/module/plugins/hooks/RehostTo.py +++ b/module/plugins/hooks/RehostTo.py @@ -6,7 +6,7 @@ from module.plugins.internal.MultiHook import MultiHook class RehostTo(MultiHook): __name__ = "RehostTo" __type__ = "hook" - __version__ = "0.5" + __version__ = "0.50" __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), diff --git a/module/plugins/hooks/SmoozedCom.py b/module/plugins/hooks/SmoozedCom.py index 4e706c959..9ba2daac9 100644 --- a/module/plugins/hooks/SmoozedCom.py +++ b/module/plugins/hooks/SmoozedCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.MultiHook import MultiHook class SmoozedCom(MultiHook): __name__ = "SmoozedCom" __type__ = "hook" - __version__ = "0.02" + __version__ = "0.03" __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), @@ -23,4 +23,4 @@ class SmoozedCom(MultiHook): def getHosters(self): user, data = self.account.selectAccount() - return self.account.getAccountData(user)["hosters"] + return self.account.getAccountInfo(user)["hosters"] -- cgit v1.2.3 From 1bf6adf3f1f9720333c1b1352de37898a153c409 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sun, 11 Jan 2015 21:51:52 +0100 Subject: Update notify addons --- module/plugins/hooks/AndroidPhoneNotify.py | 70 +++++++++++++++---- module/plugins/hooks/WindowsPhoneToastNotify.py | 91 ++++++++++++++++--------- 2 files changed, 116 insertions(+), 45 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/AndroidPhoneNotify.py b/module/plugins/hooks/AndroidPhoneNotify.py index d6bf64db4..18e1cce66 100644 --- a/module/plugins/hooks/AndroidPhoneNotify.py +++ b/module/plugins/hooks/AndroidPhoneNotify.py @@ -1,37 +1,79 @@ # -*- coding: utf-8 -*- +from time import time -from module.plugins.Hook import Hook from module.network.RequestFactory import getURL +from module.plugins.Hook import Hook + class AndroidPhoneNotify(Hook): __name__ = "AndroidPhoneNotify" __type__ = "hook" - __version__ = "0.01" + __version__ = "0.02" - __config__ = [("apikey", "str", "apikey", ""), - ("appname", "str", "ApplicationName", "pyLoad"), - ("notifycaptcha", "bool", "Send captcha notifications (maybe usefull if premium fails)", False)] + __config__ = [("apikey" , "str" , "API key" , "" ), + ("notifycaptcha" , "bool", "Notify captcha request" , True ), + ("notifypackage" , "bool", "Notify package finished" , True ), + ("notifyprocessed", "bool", "Notify processed packages status" , True ), + ("timeout" , "int" , "Timeout between captchas in seconds" , 5 ), + ("force" , "bool", "Send notifications if client is connected", False)] __description__ = """Send push notifications to your Android Phone using notifymyandroid.com""" __license__ = "GPLv3" - __authors__ = [("Steven Kosyra", "steven.kosyra@gmail.com")] + __authors__ = [("Steven Kosyra", "steven.kosyra@gmail.com"), + ("Walter Purcaro", "vuolter@gmail.com")] - def packageFinished(self, pypack): - self.genUrl("Package finished:",pypack.name) + event_list = ["allDownloadsProcessed"] + + + #@TODO: Remove in 0.4.10 + def initPeriodical(self): + pass + + + def setup(self): + self.info = {} #@TODO: Remove in 0.4.10 def newCaptchaTask(self, task): - if self.getConfig("notifycaptcha"): - self.genUrl("Captcha","new Captcha request") + if not self.getConfig("notifycaptcha"): + return False + + if time() - float(self.getStorage("AndroidPhoneNotify", 0)) < self.getConf("timeout"): + return False + + self.notify(_("Captcha"), _("New request waiting user input")) + + + def packageFinished(self, pypack): + if self.getConfig("notifypackage"): + self.notify(_("Package finished"), pypack.name) + + + def allDownloadsProcessed(self, thread): + if not self.getConfig("notifyprocessed"): + return False + + if any(True for pdata in self.core.api.getQueue() if pdata.linksdone < pdata.linkstotal): + self.notify(_("Package failed"), _("One or more packages was not completed successfully")) + else: + self.notify(_("All packages finished")) + def notify(self, event, msg=""): + apikey = self.getConfig("apikey") - def genUrl(self,event, msg): - self.response(event, msg) + if not apikey: + return False + if self.core.isClientConnected() and not self.getConfig("force"): + return False + getURL("http://www.notifymyandroid.com/publicapi/notify", + get={'apikey' : apikey, + 'application': "pyLoad", + 'event' : event, + 'description': msg}) - def response(self, event, msg): - html = getURL("http://www.notifymyandroid.com/publicapi/notify?apikey=" + self.getConfig("apikey") + "&application=" + self.getConfig("appname") + "&event=" + str(event) + "&description= " + str(msg) + "") + self.setStorage("AndroidPhoneNotify", time()) diff --git a/module/plugins/hooks/WindowsPhoneToastNotify.py b/module/plugins/hooks/WindowsPhoneToastNotify.py index ed305778c..886d4ca6a 100644 --- a/module/plugins/hooks/WindowsPhoneToastNotify.py +++ b/module/plugins/hooks/WindowsPhoneToastNotify.py @@ -1,7 +1,8 @@ # -*- coding: utf-8 -*- import httplib -import time + +from time import time from module.plugins.Hook import Hook @@ -9,16 +10,23 @@ from module.plugins.Hook import Hook class WindowsPhoneToastNotify(Hook): __name__ = "WindowsPhoneToastNotify" __type__ = "hook" - __version__ = "0.03" + __version__ = "0.04" - __config__ = [("force", "bool", "Force even if client is connected", False), - ("pushId", "str", "pushId", ""), - ("pushUrl", "str", "pushUrl", ""), - ("pushTimeout", "int", "Timeout between notifications in seconds", 0)] + __config__ = [("id" , "str" , "Push ID" , "" ), + ("url" , "str" , "Push url" , "" ), + ("notifycaptcha" , "bool", "Notify captcha request" , True ), + ("notifypackage" , "bool", "Notify package finished" , True ), + ("notifyprocessed", "bool", "Notify processed packages status" , True ), + ("timeout" , "int" , "Timeout between captchas in seconds" , 5 ), + ("force" , "bool", "Send notifications if client is connected", False)] __description__ = """Send push notifications to Windows Phone""" __license__ = "GPLv3" - __authors__ = [("Andy Voigt", "phone-support@hotmail.de")] + __authors__ = [("Andy Voigt", "phone-support@hotmail.de"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + event_list = ["allDownloadsProcessed"] #@TODO: Remove in 0.4.10 @@ -30,37 +38,58 @@ class WindowsPhoneToastNotify(Hook): self.info = {} #@TODO: Remove in 0.4.10 - def getXmlData(self): - myxml = ("<?xml version='1.0' encoding='utf-8'?> <wp:Notification xmlns:wp='WPNotification'> " - "<wp:Toast> <wp:Text1>Pyload Mobile</wp:Text1> <wp:Text2>Captcha waiting!</wp:Text2> " - "</wp:Toast> </wp:Notification>") - return myxml + def newCaptchaTask(self, task): + if not self.getConfig("notifycaptcha"): + return False + if time() - float(self.getStorage("WindowsPhoneToastNotify", 0)) < self.getConf("timeout"): + return False - def doRequest(self): - URL = self.getConfig("pushUrl") - request = self.getXmlData() - webservice = httplib.HTTP(URL) - webservice.putrequest("POST", self.getConfig("pushId")) - webservice.putheader("Host", URL) - webservice.putheader("Content-type", "text/xml") - webservice.putheader("X-NotificationClass", "2") - webservice.putheader("X-WindowsPhone-Target", "toast") - webservice.putheader("Content-length", "%d" % len(request)) - webservice.endheaders() - webservice.send(request) - webservice.close() - self.setStorage("LAST_NOTIFY", time.time()) + self.notify(_("Captcha"), _("New request waiting user input")) - def newCaptchaTask(self, task): - if not self.getConfig("pushId") or not self.getConfig("pushUrl"): + def packageFinished(self, pypack): + if self.getConfig("notifypackage"): + self.notify(_("Package finished"), pypack.name) + + + def allDownloadsProcessed(self, thread): + if not self.getConfig("notifyprocessed"): return False - if self.core.isClientConnected() and not self.getConfig("force"): + if any(True for pdata in self.core.api.getQueue() if pdata.linksdone < pdata.linkstotal): + self.notify(_("Package failed"), _("One or more packages was not completed successfully")) + else: + self.notify(_("All packages finished")) + + + def getXmlData(self, msg): + return ("<?xml version='1.0' encoding='utf-8'?> <wp:Notification xmlns:wp='WPNotification'> " + "<wp:Toast> <wp:Text1>pyLoad</wp:Text1> <wp:Text2>%s</wp:Text2> " + "</wp:Toast> </wp:Notification>" % msg) + + + def notify(self, event, msg=""): + id = self.getConfig("id") + url = self.getConfig("url") + + if not id or not url: return False - if (time.time() - float(self.getStorage("LAST_NOTIFY", 0))) < self.getConf("pushTimeout"): + if self.core.isClientConnected() and not self.getConfig("force"): return False - self.doRequest() + request = self.getXmlData("%s: %s" % (event, msg) if msg else event) + webservice = httplib.HTTP(url) + + webservice.putrequest("POST", id) + webservice.putheader("Host", url) + webservice.putheader("Content-type", "text/xml") + webservice.putheader("X-NotificationClass", "2") + webservice.putheader("X-WindowsPhone-Target", "toast") + webservice.putheader("Content-length", "%d" % len(request)) + webservice.endheaders() + webservice.send(request) + webservice.close() + + self.setStorage("WindowsPhoneToastNotify", time()) -- cgit v1.2.3 From 184ea88c7322399a04ab80a6d509ce446b83d966 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sun, 11 Jan 2015 21:52:22 +0100 Subject: [ExternalScripts] Fixup --- module/plugins/hooks/ExternalScripts.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py index a35e47c03..fc0cae44f 100644 --- a/module/plugins/hooks/ExternalScripts.py +++ b/module/plugins/hooks/ExternalScripts.py @@ -13,7 +13,7 @@ from module.utils import save_join class ExternalScripts(Hook): __name__ = "ExternalScripts" __type__ = "hook" - __version__ = "0.25" + __version__ = "0.26" __config__ = [("activated", "bool", "Activated", True)] @@ -136,11 +136,11 @@ class ExternalScripts(Hook): self.callScript(script) - def allDownloadsFinished(self): + def allDownloadsFinished(self, thread): for script in chain(self.scripts['all_downloads_finished'], self.scripts['all_dls_finished']): self.callScript(script) - def allDownloadsProcessed(self): + def allDownloadsProcessed(self, thread): for script in chain(self.scripts['all_downloads_processed'], self.scripts['all_dls_processed']): self.callScript(script) -- cgit v1.2.3 From e3bdcffc6020322d9f8985c6f6be9476e8c779c9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sun, 11 Jan 2015 23:20:32 +0100 Subject: [SkipRev] Fix https://github.com/pyload/pyload/issues/1036 --- module/plugins/hooks/SkipRev.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index ad6d7dacd..6b4e715da 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -18,7 +18,7 @@ def _setup(self): class SkipRev(Hook): __name__ = "SkipRev" __type__ = "hook" - __version__ = "0.22" + __version__ = "0.23" __config__ = [("tokeep", "int", "Number of rev files to keep for package (-1 to auto)", -1)] @@ -34,7 +34,7 @@ class SkipRev(Hook): def _pyname(self, pyfile): if hasattr(pyfile.pluginmodule, "getInfo"): - return getattr(pyfile.pluginmodule, "getInfo")([pyfile.url])[0][0] + return next(getattr(pyfile.pluginmodule, "getInfo")([pyfile.url]))[0] else: self.logWarning("Unable to grab file name") return urlparse(unquote(pyfile.url)).path.split('/')[-1] -- cgit v1.2.3 From 7e5e88778c2dd4fac088cffbd2fba4384dde8582 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Tue, 13 Jan 2015 01:45:31 +0100 Subject: [ClickAndLoad] Fix error "Port already in use" --- module/plugins/hooks/ClickAndLoad.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py index 8ef31ec1e..222310c25 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickAndLoad.py @@ -3,6 +3,7 @@ import socket from threading import Thread, Lock +from time import sleep from module.plugins.Hook import Hook, threaded @@ -20,7 +21,7 @@ def forward(source, destination): class ClickAndLoad(Hook): __name__ = "ClickAndLoad" __type__ = "hook" - __version__ = "0.25" + __version__ = "0.26" __config__ = [("activated", "bool", "Activated" , True ), ("port" , "int" , "Port" , 9666 ), @@ -54,6 +55,8 @@ class ClickAndLoad(Hook): def server(self, ip, webport, cnlport): try: dock_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + + dock_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) dock_socket.bind((ip, cnlport)) dock_socket.listen(5) @@ -65,17 +68,8 @@ class ClickAndLoad(Hook): hookManager.startThread(forward, client_socket, server_socket) except socket.error, e: - if hasattr(e, "errno"): - errno = e.errno - else: - errno = e.args[0] - - if errno == 98: - self.logWarning(_("Port %s already in use") % cnlport) - else: - self.logError(e) - self.server(ip, webport, cnlport) - - except Exception, e: self.logError(e) self.server(ip, webport, cnlport) + + finally: + dock_socket.close() -- cgit v1.2.3 From e1baccf1ec914563d3b2b845906cce024e7cd3b1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Tue, 13 Jan 2015 23:14:50 +0100 Subject: Replace 'except' with 'except Exception' --- module/plugins/hooks/ExternalScripts.py | 2 +- module/plugins/hooks/IRCInterface.py | 8 ++++---- module/plugins/hooks/ImageTyperz.py | 2 +- module/plugins/hooks/UpdateManager.py | 4 ++-- module/plugins/hooks/XMPPInterface.py | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py index fc0cae44f..f4d2cb69c 100644 --- a/module/plugins/hooks/ExternalScripts.py +++ b/module/plugins/hooks/ExternalScripts.py @@ -59,7 +59,7 @@ class ExternalScripts(Hook): if not exists(path): try: makedirs(path) - except: + except Exception: self.logDebug("Script folder %s not created" % folder) return diff --git a/module/plugins/hooks/IRCInterface.py b/module/plugins/hooks/IRCInterface.py index efd4e411d..98fa1d030 100644 --- a/module/plugins/hooks/IRCInterface.py +++ b/module/plugins/hooks/IRCInterface.py @@ -61,7 +61,7 @@ class IRCInterface(Thread, Hook): try: if self.getConfig("info_pack"): self.response(_("Package finished: %s") % pypack.name) - except: + except Exception: pass @@ -70,7 +70,7 @@ class IRCInterface(Thread, Hook): if self.getConfig("info_file"): self.response( _("Download finished: %(name)s @ %(plugin)s ") % {"name": pyfile.name, "plugin": pyfile.pluginname}) - except: + except Exception: pass @@ -183,7 +183,7 @@ class IRCInterface(Thread, Hook): trigger = temp[0] if len(temp) > 1: args = temp[1:] - except: + except Exception: pass handler = getattr(self, "event_%s" % trigger, self.event_pass) @@ -347,7 +347,7 @@ class IRCInterface(Thread, Hook): return ["INFO: Added %d links to Package %s [#%d]" % (len(links), pack['name'], id)] - except: + except Exception: # create new package id = self.core.api.addPackage(pack, links, 1) return ["INFO: Created new Package %s [#%d] with %d links." % (pack, id, len(links))] diff --git a/module/plugins/hooks/ImageTyperz.py b/module/plugins/hooks/ImageTyperz.py index d448d1be9..768129e4a 100644 --- a/module/plugins/hooks/ImageTyperz.py +++ b/module/plugins/hooks/ImageTyperz.py @@ -69,7 +69,7 @@ class ImageTyperz(Hook): try: balance = float(res) - except: + except Exception: raise ImageTyperzException("Invalid response") self.logInfo(_("Account balance: $%s left") % res) diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py index c72699228..03b9ba6a4 100644 --- a/module/plugins/hooks/UpdateManager.py +++ b/module/plugins/hooks/UpdateManager.py @@ -117,7 +117,7 @@ class UpdateManager(Hook): def server_request(self): try: return getURL(self.SERVER_URL, get={'v': self.core.api.getServerVersion()}).splitlines() - except: + except Exception: self.logWarning(_("Unable to contact server to get updates")) @@ -192,7 +192,7 @@ class UpdateManager(Hook): # Protect UpdateManager from self-removing try: blacklisted.remove(("hook", "UpdateManager")) - except: + except Exception: pass for t, n in blacklisted: diff --git a/module/plugins/hooks/XMPPInterface.py b/module/plugins/hooks/XMPPInterface.py index bbeab4341..b8e9fc1ad 100644 --- a/module/plugins/hooks/XMPPInterface.py +++ b/module/plugins/hooks/XMPPInterface.py @@ -69,7 +69,7 @@ class XMPPInterface(IRCInterface, JabberClient): try: if self.getConfig("info_pack"): self.announce(_("Package finished: %s") % pypack.name) - except: + except Exception: pass @@ -78,7 +78,7 @@ class XMPPInterface(IRCInterface, JabberClient): if self.getConfig("info_file"): self.announce( _("Download finished: %(name)s @ %(plugin)s") % {"name": pyfile.name, "plugin": pyfile.pluginname}) - except: + except Exception: pass @@ -152,7 +152,7 @@ class XMPPInterface(IRCInterface, JabberClient): trigger = temp[0] if len(temp) > 1: args = temp[1:] - except: + except Exception: pass handler = getattr(self, "event_%s" % trigger, self.event_pass) -- cgit v1.2.3 From 660ddd365b0ee18609e05e6babe55f272bd3becd Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Tue, 13 Jan 2015 23:15:42 +0100 Subject: [XFileSharingPro] Update BUILTIN lists --- module/plugins/hooks/XFileSharingPro.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py index 0745a6c7e..e6e30ca8f 100644 --- a/module/plugins/hooks/XFileSharingPro.py +++ b/module/plugins/hooks/XFileSharingPro.py @@ -8,7 +8,7 @@ from module.plugins.Hook import Hook class XFileSharingPro(Hook): __name__ = "XFileSharingPro" __type__ = "hook" - __version__ = "0.30" + __version__ = "0.31" __config__ = [("activated" , "bool", "Activated" , True ), ("use_hoster_list" , "bool", "Load listed hosters only" , False), @@ -30,15 +30,15 @@ class XFileSharingPro(Hook): HOSTER_BUILTIN = [#WORKING HOSTERS: "180upload.com", "backin.net", "eyesfile.ca", "file4safe.com", "fileband.com", "filedwon.com", - "fileparadox.in", "filevice.com", "hostingbulk.com", "linestorage.com", "ravishare.com", "ryushare.com", - "salefiles.com", "sendmyway.com", "sharesix.com", "thefile.me", "verzend.be", "xvidstage.com", + "fileparadox.in", "filevice.com", "hostingbulk.com", "junkyvideo.com", "linestorage.com", "ravishare.com", + "ryushare.com", "salefiles.com", "sendmyway.com", "sharesix.com", "thefile.me", "verzend.be", "xvidstage.com", #NOT TESTED: "101shared.com", "4upfiles.com", "filemaze.ws", "filenuke.com", "linkzhost.com", "mightyupload.com", "rockdizfile.com", "sharebeast.com", "sharerepo.com", "shareswift.com", "uploadbaz.com", "uploadc.com", "vidbull.com", "zalaa.com", "zomgupload.com", #NOT WORKING: "amonshare.com", "banicrazy.info", "boosterking.com", "host4desi.com", "laoupload.com", "rd-fs.com"] - CRYPTER_BUILTIN = [] + CRYPTER_BUILTIN = ["junocloud.me", "rapidfileshare.net"] # def pluginConfigChanged(self.__name__, plugin, name, value): -- cgit v1.2.3 From 0b73c1b042a2b1e17f30c951626586f8774c68ed Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Fri, 16 Jan 2015 01:14:47 +0100 Subject: [SkipRev] Fix https://github.com/pyload/pyload/issues/1048 --- module/plugins/hooks/SkipRev.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index 6b4e715da..51d385bb4 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -18,7 +18,7 @@ def _setup(self): class SkipRev(Hook): __name__ = "SkipRev" __type__ = "hook" - __version__ = "0.23" + __version__ = "0.24" __config__ = [("tokeep", "int", "Number of rev files to keep for package (-1 to auto)", -1)] @@ -34,7 +34,7 @@ class SkipRev(Hook): def _pyname(self, pyfile): if hasattr(pyfile.pluginmodule, "getInfo"): - return next(getattr(pyfile.pluginmodule, "getInfo")([pyfile.url]))[0] + return getattr(pyfile.pluginmodule, "getInfo")([pyfile.url]).next()[0] else: self.logWarning("Unable to grab file name") return urlparse(unquote(pyfile.url)).path.split('/')[-1] -- cgit v1.2.3 From e2d8d605aeb4fd3477a8d681e16cd0b17500a648 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Fri, 16 Jan 2015 01:36:04 +0100 Subject: Fix allDownloadsFinished and allDownloadsProcessed defs --- module/plugins/hooks/AndroidPhoneNotify.py | 4 +-- module/plugins/hooks/ExternalScripts.py | 6 ++-- module/plugins/hooks/ExtractArchive.py | 42 ++++++++++++------------- module/plugins/hooks/WindowsPhoneToastNotify.py | 4 +-- 4 files changed, 28 insertions(+), 28 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/AndroidPhoneNotify.py b/module/plugins/hooks/AndroidPhoneNotify.py index 18e1cce66..fbc2acd5c 100644 --- a/module/plugins/hooks/AndroidPhoneNotify.py +++ b/module/plugins/hooks/AndroidPhoneNotify.py @@ -9,7 +9,7 @@ from module.plugins.Hook import Hook class AndroidPhoneNotify(Hook): __name__ = "AndroidPhoneNotify" __type__ = "hook" - __version__ = "0.02" + __version__ = "0.03" __config__ = [("apikey" , "str" , "API key" , "" ), ("notifycaptcha" , "bool", "Notify captcha request" , True ), @@ -51,7 +51,7 @@ class AndroidPhoneNotify(Hook): self.notify(_("Package finished"), pypack.name) - def allDownloadsProcessed(self, thread): + def allDownloadsProcessed(self): if not self.getConfig("notifyprocessed"): return False diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py index f4d2cb69c..b2b4548a2 100644 --- a/module/plugins/hooks/ExternalScripts.py +++ b/module/plugins/hooks/ExternalScripts.py @@ -13,7 +13,7 @@ from module.utils import save_join class ExternalScripts(Hook): __name__ = "ExternalScripts" __type__ = "hook" - __version__ = "0.26" + __version__ = "0.27" __config__ = [("activated", "bool", "Activated", True)] @@ -136,11 +136,11 @@ class ExternalScripts(Hook): self.callScript(script) - def allDownloadsFinished(self, thread): + def allDownloadsFinished(self): for script in chain(self.scripts['all_downloads_finished'], self.scripts['all_dls_finished']): self.callScript(script) - def allDownloadsProcessed(self, thread): + def allDownloadsProcessed(self): for script in chain(self.scripts['all_downloads_processed'], self.scripts['all_dls_processed']): self.callScript(script) diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 2e9efa2b0..bdbaf64af 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -58,7 +58,7 @@ from module.utils import save_join, uniqify class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.03" + __version__ = "1.04" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract full path" , True ), @@ -158,7 +158,7 @@ class ExtractArchive(Hook): @threaded - def allDownloadsProcessed(self, thread): + def allDownloadsProcessed(self): local = copy(self.queue) self.queue[:] = [] @@ -302,36 +302,36 @@ class ExtractArchive(Hook): try: progress = lambda x: pyfile.setProgress(x) - encrypted = False + encrypted = True #@TODO: set to `False` passwords = self.getPasswords() - try: - self.logInfo(basename(plugin.file), "Verifying...") + # try: + # self.logInfo(basename(plugin.file), "Verifying...") - tmp_password = plugin.password - plugin.password = "" #: Force verifying without password + # tmp_password = plugin.password + # plugin.password = "" #: Force verifying without password - plugin.verify() + # plugin.verify() - except PasswordError: - encrypted = True + # except PasswordError: + # encrypted = True - except CRCError: - self.logWarning(basename(plugin.file), _("Archive damaged")) + # except CRCError: + # self.logWarning(basename(plugin.file), _("Archive damaged")) - if not self.getConfig("repair"): - raise CRCError + # if not self.getConfig("repair"): + # raise CRCError - elif plugin.repair(): - self.logInfo(basename(plugin.file), _("Successfully repaired")) + # elif plugin.repair(): + # self.logInfo(basename(plugin.file), _("Successfully repaired")) - elif not self.getConfig("keepbroken"): - raise ArchiveError(_("Broken archive")) + # elif not self.getConfig("keepbroken"): + # raise ArchiveError(_("Broken archive")) - else: - self.logInfo(basename(plugin.file), _("All OK")) + # else: + # self.logInfo(basename(plugin.file), _("All OK")) - plugin.password = tmp_password + # plugin.password = tmp_password if not encrypted: plugin.extract(progress) diff --git a/module/plugins/hooks/WindowsPhoneToastNotify.py b/module/plugins/hooks/WindowsPhoneToastNotify.py index 886d4ca6a..20686ee36 100644 --- a/module/plugins/hooks/WindowsPhoneToastNotify.py +++ b/module/plugins/hooks/WindowsPhoneToastNotify.py @@ -10,7 +10,7 @@ from module.plugins.Hook import Hook class WindowsPhoneToastNotify(Hook): __name__ = "WindowsPhoneToastNotify" __type__ = "hook" - __version__ = "0.04" + __version__ = "0.05" __config__ = [("id" , "str" , "Push ID" , "" ), ("url" , "str" , "Push url" , "" ), @@ -53,7 +53,7 @@ class WindowsPhoneToastNotify(Hook): self.notify(_("Package finished"), pypack.name) - def allDownloadsProcessed(self, thread): + def allDownloadsProcessed(self): if not self.getConfig("notifyprocessed"): return False -- cgit v1.2.3 From b205352a18db19f9fccb2f8dd73a12e6e87ef58d Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Fri, 16 Jan 2015 01:37:19 +0100 Subject: [LinkdecrypterCom] Improve getCrypters routine --- module/plugins/hooks/LinkdecrypterCom.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/LinkdecrypterCom.py b/module/plugins/hooks/LinkdecrypterCom.py index d4924a687..f85a598bc 100644 --- a/module/plugins/hooks/LinkdecrypterCom.py +++ b/module/plugins/hooks/LinkdecrypterCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.MultiHook import MultiHook class LinkdecrypterCom(MultiHook): __name__ = "LinkdecrypterCom" __type__ = "hook" - __version__ = "1.01" + __version__ = "1.02" __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), @@ -21,8 +21,5 @@ class LinkdecrypterCom(MultiHook): def getCrypters(self): - try: - html = self.getURL("http://linkdecrypter.com/") - return re.search(r'>Supported\(\d+\)</b>: <i>(.+?) \+ RSDF', html).group(1).split(', ') - except Exception: - return list() + return re.search(r'>Supported\(\d+\)</b>: <i>(.[\w.\-, ]+)', + self.getURL("http://linkdecrypter.com/").replace("(g)", "")).group(1).split(', ') -- cgit v1.2.3 From b72f8fb3d564feb3881d43c2956b1adc238e8b54 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Fri, 16 Jan 2015 15:46:59 +0100 Subject: [UpdateManager] Default to check for updates in debug mode --- module/plugins/hooks/UpdateManager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py index 03b9ba6a4..b6a8bac7c 100644 --- a/module/plugins/hooks/UpdateManager.py +++ b/module/plugins/hooks/UpdateManager.py @@ -16,14 +16,14 @@ from module.utils import save_join class UpdateManager(Hook): __name__ = "UpdateManager" __type__ = "hook" - __version__ = "0.42" + __version__ = "0.43" __config__ = [("activated" , "bool" , "Activated" , True ), ("mode" , "pyLoad + plugins;plugins only", "Check updates for" , "pyLoad + plugins"), ("interval" , "int" , "Check interval in hours" , 8 ), ("autorestart" , "bool" , "Automatically restart pyLoad when required" , True ), ("reloadplugins", "bool" , "Monitor plugins for code changes in debug mode", True ), - ("nodebugupdate", "bool" , "Don't check for updates in debug mode" , True )] + ("nodebugupdate", "bool" , "Don't check for updates in debug mode" , False )] __description__ = """ Check for updates """ __license__ = "GPLv3" -- cgit v1.2.3 From c4f167e267ba949ee20ec8a6d3c611d6dd93b325 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Tue, 20 Jan 2015 01:22:00 +0100 Subject: Fix plugin filename case --- module/plugins/hooks/Captcha9Kw.py | 261 +++++++++++++++++++++++++++++++++++++ module/plugins/hooks/Captcha9kw.py | 261 ------------------------------------- 2 files changed, 261 insertions(+), 261 deletions(-) create mode 100644 module/plugins/hooks/Captcha9Kw.py delete mode 100755 module/plugins/hooks/Captcha9kw.py (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/Captcha9Kw.py b/module/plugins/hooks/Captcha9Kw.py new file mode 100644 index 000000000..600694e78 --- /dev/null +++ b/module/plugins/hooks/Captcha9Kw.py @@ -0,0 +1,261 @@ +# -*- coding: utf-8 -*- + +from __future__ import with_statement + +import re + +from base64 import b64encode +from time import sleep + +from module.network.HTTPRequest import BadHeader +from module.network.RequestFactory import getURL + +from module.plugins.Hook import Hook, threaded + + +class Captcha9Kw(Hook): + __name__ = "Captcha9Kw" + __type__ = "hook" + __version__ = "0.27" + + __config__ = [("activated" , "bool" , "Activated" , True ), + ("ssl" , "bool" , "Use HTTPS" , True ), + ("force" , "bool" , "Force captcha resolving even if client is connected" , True ), + ("confirm" , "bool" , "Confirm Captcha (cost +6 credits)" , False ), + ("captchaperhour", "int" , "Captcha per hour" , "9999" ), + ("captchapermin" , "int" , "Captcha per minute" , "9999" ), + ("prio" , "int" , "Priority (max 10)(cost +0 -> +10 credits)" , "0" ), + ("queue" , "int" , "Max. Queue (max 999)" , "50" ), + ("hoster_options", "string" , "Hoster options (format: pluginname:prio=1:selfsolfe=1:confirm=1:timeout=900|...)", "ShareonlineBiz:prio=0:timeout=999 | UploadedTo:prio=0:timeout=999"), + ("selfsolve" , "bool" , "Selfsolve (manually solve your captcha in your 9kw client if active)" , "0" ), + ("passkey" , "password", "API key" , "" ), + ("timeout" , "int" , "Timeout in seconds (min 60, max 3999)" , "900" )] + + __description__ = """Send captchas to 9kw.eu""" + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + API_URL = "http://www.9kw.eu/index.cgi" + + + #@TODO: Remove in 0.4.10 + def initPeriodical(self): + pass + + + def setup(self): + self.info = {} #@TODO: Remove in 0.4.10 + if self.getConfig("ssl"): + self.API_URL = self.API_URL.replace("http://", "https://") + + + def getCredits(self): + res = getURL(self.API_URL, + get={'apikey': self.getConfig("passkey"), + 'pyload': "1", + 'source': "pyload", + 'action': "usercaptchaguthaben"}) + + if res.isdigit(): + self.logInfo(_("%s credits left") % res) + credits = self.info['credits'] = int(res) + return credits + else: + self.logError(res) + return 0 + + + @threaded + def _processCaptcha(self, task): + try: + with open(task.captchaFile, 'rb') as f: + data = f.read() + + except IOError, e: + self.logError(e) + return + + data = b64encode(data) + mouse = 1 if task.isPositional() else 0 + pluginname = re.search(r'_([^_]*)_\d+.\w+', task.captchaFile).group(1) + + option = {'min' : 2, + 'max' : 50, + 'phrase' : 0, + 'numeric' : 0, + 'case_sensitive': 0, + 'math' : 0, + 'prio' : min(max(self.getConfig("prio"), 0), 10), + 'confirm' : self.getConfig("confirm"), + 'timeout' : min(max(self.getConfig("timeout"), 300), 3999), + 'selfsolve' : self.getConfig("selfsolve"), + 'cph' : self.getConfig("captchaperhour"), + 'cpm' : self.getConfig("captchapermin")} + + for opt in str(self.getConfig("hoster_options").split('|')): + + details = map(str.strip, opt.split(':')) + + if not details or details[0].lower() != pluginname.lower(): + continue + + for d in details: + hosteroption = d.split("=") + + if len(hosteroption) < 2 or not hosteroption[1].isdigit(): + continue + + o = hosteroption[0].lower() + if o in option: + option[o] = hosteroption[1] + + break + + post_data = {'apikey' : self.getConfig("passkey"), + 'prio' : option['prio'], + 'confirm' : option['confirm'], + 'maxtimeout' : option['timeout'], + 'selfsolve' : option['selfsolve'], + 'captchaperhour': option['cph'], + 'captchapermin' : option['cpm'], + 'case-sensitive': option['case_sensitive'], + 'min_len' : option['min'], + 'max_len' : option['max'], + 'phrase' : option['phrase'], + 'numeric' : option['numeric'], + 'math' : option['math'], + 'oldsource' : pluginname, + 'pyload' : "1", + 'source' : "pyload", + 'base64' : "1", + 'mouse' : mouse, + 'file-upload-01': data, + 'action' : "usercaptchaupload"} + + for _i in xrange(5): + try: + res = getURL(self.API_URL, post=post_data) + except BadHeader, e: + sleep(3) + else: + if res and res.isdigit(): + break + else: + self.logError(_("Bad upload: %s") % res) + return + + self.logDebug(_("NewCaptchaID ticket: %s") % res, task.captchaFile) + + task.data["ticket"] = res + + for _i in xrange(int(self.getConfig("timeout") / 5)): + result = getURL(self.API_URL, + get={'apikey': self.getConfig("passkey"), + 'id' : res, + 'pyload': "1", + 'info' : "1", + 'source': "pyload", + 'action': "usercaptchacorrectdata"}) + + if not result or result == "NO DATA": + sleep(5) + else: + break + else: + self.logDebug("Could not send request: %s" % res) + result = None + + self.logInfo(_("Captcha result for ticket %s: %s") % (res, result)) + + task.setResult(result) + + + def newCaptchaTask(self, task): + if not task.isTextual() and not task.isPositional(): + return + + if not self.getConfig("passkey"): + return + + if self.core.isClientConnected() and not self.getConfig("force"): + return + + credits = self.getCredits() + + if not credits: + self.logError(_("Your captcha 9kw.eu account has not enough credits")) + return + + queue = min(self.getConfig("queue"), 999) + timeout = min(max(self.getConfig("timeout"), 300), 3999) + pluginname = re.search(r'_([^_]*)_\d+.\w+', task.captchaFile).group(1) + + for _i in xrange(5): + servercheck = getURL("http://www.9kw.eu/grafik/servercheck.txt") + if queue < re.search(r'queue=(\d+)', servercheck).group(1): + break + + sleep(10) + else: + self.fail(_("Too many captchas in queue")) + + for opt in str(self.getConfig("hoster_options").split('|')): + details = map(str.strip, opt.split(':')) + + if not details or details[0].lower() != pluginname.lower(): + continue + + for d in details: + hosteroption = d.split("=") + + if (len(hosteroption) > 1 + and hosteroption[0].lower() == 'timeout' + and hosteroption[1].isdigit()): + timeout = int(hosteroption[1]) + + break + + task.handler.append(self) + + task.setWaiting(timeout) + + self._processCaptcha(task) + + + def _captchaResponse(self, task, correct): + type = "correct" if correct else "refund" + + if 'ticket' not in task.data: + self.logDebug("No CaptchaID for %s request (task: %s)" % (type, task)) + return + + passkey = self.getConfig("passkey") + + for _i in xrange(3): + res = getURL(self.API_URL, + get={'action' : "usercaptchacorrectback", + 'apikey' : passkey, + 'api_key': passkey, + 'correct': "1" if correct else "2", + 'pyload' : "1", + 'source' : "pyload", + 'id' : task.data["ticket"]}) + + self.logDebug("Request %s: %s" % (type, res)) + + if res == "OK": + break + + sleep(5) + else: + self.logDebug("Could not send %s request: %s" % (type, res)) + + + def captchaCorrect(self, task): + self._captchaResponse(task, True) + + + def captchaInvalid(self, task): + self._captchaResponse(task, False) diff --git a/module/plugins/hooks/Captcha9kw.py b/module/plugins/hooks/Captcha9kw.py deleted file mode 100755 index 600694e78..000000000 --- a/module/plugins/hooks/Captcha9kw.py +++ /dev/null @@ -1,261 +0,0 @@ -# -*- coding: utf-8 -*- - -from __future__ import with_statement - -import re - -from base64 import b64encode -from time import sleep - -from module.network.HTTPRequest import BadHeader -from module.network.RequestFactory import getURL - -from module.plugins.Hook import Hook, threaded - - -class Captcha9Kw(Hook): - __name__ = "Captcha9Kw" - __type__ = "hook" - __version__ = "0.27" - - __config__ = [("activated" , "bool" , "Activated" , True ), - ("ssl" , "bool" , "Use HTTPS" , True ), - ("force" , "bool" , "Force captcha resolving even if client is connected" , True ), - ("confirm" , "bool" , "Confirm Captcha (cost +6 credits)" , False ), - ("captchaperhour", "int" , "Captcha per hour" , "9999" ), - ("captchapermin" , "int" , "Captcha per minute" , "9999" ), - ("prio" , "int" , "Priority (max 10)(cost +0 -> +10 credits)" , "0" ), - ("queue" , "int" , "Max. Queue (max 999)" , "50" ), - ("hoster_options", "string" , "Hoster options (format: pluginname:prio=1:selfsolfe=1:confirm=1:timeout=900|...)", "ShareonlineBiz:prio=0:timeout=999 | UploadedTo:prio=0:timeout=999"), - ("selfsolve" , "bool" , "Selfsolve (manually solve your captcha in your 9kw client if active)" , "0" ), - ("passkey" , "password", "API key" , "" ), - ("timeout" , "int" , "Timeout in seconds (min 60, max 3999)" , "900" )] - - __description__ = """Send captchas to 9kw.eu""" - __license__ = "GPLv3" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), - ("Walter Purcaro", "vuolter@gmail.com")] - - - API_URL = "http://www.9kw.eu/index.cgi" - - - #@TODO: Remove in 0.4.10 - def initPeriodical(self): - pass - - - def setup(self): - self.info = {} #@TODO: Remove in 0.4.10 - if self.getConfig("ssl"): - self.API_URL = self.API_URL.replace("http://", "https://") - - - def getCredits(self): - res = getURL(self.API_URL, - get={'apikey': self.getConfig("passkey"), - 'pyload': "1", - 'source': "pyload", - 'action': "usercaptchaguthaben"}) - - if res.isdigit(): - self.logInfo(_("%s credits left") % res) - credits = self.info['credits'] = int(res) - return credits - else: - self.logError(res) - return 0 - - - @threaded - def _processCaptcha(self, task): - try: - with open(task.captchaFile, 'rb') as f: - data = f.read() - - except IOError, e: - self.logError(e) - return - - data = b64encode(data) - mouse = 1 if task.isPositional() else 0 - pluginname = re.search(r'_([^_]*)_\d+.\w+', task.captchaFile).group(1) - - option = {'min' : 2, - 'max' : 50, - 'phrase' : 0, - 'numeric' : 0, - 'case_sensitive': 0, - 'math' : 0, - 'prio' : min(max(self.getConfig("prio"), 0), 10), - 'confirm' : self.getConfig("confirm"), - 'timeout' : min(max(self.getConfig("timeout"), 300), 3999), - 'selfsolve' : self.getConfig("selfsolve"), - 'cph' : self.getConfig("captchaperhour"), - 'cpm' : self.getConfig("captchapermin")} - - for opt in str(self.getConfig("hoster_options").split('|')): - - details = map(str.strip, opt.split(':')) - - if not details or details[0].lower() != pluginname.lower(): - continue - - for d in details: - hosteroption = d.split("=") - - if len(hosteroption) < 2 or not hosteroption[1].isdigit(): - continue - - o = hosteroption[0].lower() - if o in option: - option[o] = hosteroption[1] - - break - - post_data = {'apikey' : self.getConfig("passkey"), - 'prio' : option['prio'], - 'confirm' : option['confirm'], - 'maxtimeout' : option['timeout'], - 'selfsolve' : option['selfsolve'], - 'captchaperhour': option['cph'], - 'captchapermin' : option['cpm'], - 'case-sensitive': option['case_sensitive'], - 'min_len' : option['min'], - 'max_len' : option['max'], - 'phrase' : option['phrase'], - 'numeric' : option['numeric'], - 'math' : option['math'], - 'oldsource' : pluginname, - 'pyload' : "1", - 'source' : "pyload", - 'base64' : "1", - 'mouse' : mouse, - 'file-upload-01': data, - 'action' : "usercaptchaupload"} - - for _i in xrange(5): - try: - res = getURL(self.API_URL, post=post_data) - except BadHeader, e: - sleep(3) - else: - if res and res.isdigit(): - break - else: - self.logError(_("Bad upload: %s") % res) - return - - self.logDebug(_("NewCaptchaID ticket: %s") % res, task.captchaFile) - - task.data["ticket"] = res - - for _i in xrange(int(self.getConfig("timeout") / 5)): - result = getURL(self.API_URL, - get={'apikey': self.getConfig("passkey"), - 'id' : res, - 'pyload': "1", - 'info' : "1", - 'source': "pyload", - 'action': "usercaptchacorrectdata"}) - - if not result or result == "NO DATA": - sleep(5) - else: - break - else: - self.logDebug("Could not send request: %s" % res) - result = None - - self.logInfo(_("Captcha result for ticket %s: %s") % (res, result)) - - task.setResult(result) - - - def newCaptchaTask(self, task): - if not task.isTextual() and not task.isPositional(): - return - - if not self.getConfig("passkey"): - return - - if self.core.isClientConnected() and not self.getConfig("force"): - return - - credits = self.getCredits() - - if not credits: - self.logError(_("Your captcha 9kw.eu account has not enough credits")) - return - - queue = min(self.getConfig("queue"), 999) - timeout = min(max(self.getConfig("timeout"), 300), 3999) - pluginname = re.search(r'_([^_]*)_\d+.\w+', task.captchaFile).group(1) - - for _i in xrange(5): - servercheck = getURL("http://www.9kw.eu/grafik/servercheck.txt") - if queue < re.search(r'queue=(\d+)', servercheck).group(1): - break - - sleep(10) - else: - self.fail(_("Too many captchas in queue")) - - for opt in str(self.getConfig("hoster_options").split('|')): - details = map(str.strip, opt.split(':')) - - if not details or details[0].lower() != pluginname.lower(): - continue - - for d in details: - hosteroption = d.split("=") - - if (len(hosteroption) > 1 - and hosteroption[0].lower() == 'timeout' - and hosteroption[1].isdigit()): - timeout = int(hosteroption[1]) - - break - - task.handler.append(self) - - task.setWaiting(timeout) - - self._processCaptcha(task) - - - def _captchaResponse(self, task, correct): - type = "correct" if correct else "refund" - - if 'ticket' not in task.data: - self.logDebug("No CaptchaID for %s request (task: %s)" % (type, task)) - return - - passkey = self.getConfig("passkey") - - for _i in xrange(3): - res = getURL(self.API_URL, - get={'action' : "usercaptchacorrectback", - 'apikey' : passkey, - 'api_key': passkey, - 'correct': "1" if correct else "2", - 'pyload' : "1", - 'source' : "pyload", - 'id' : task.data["ticket"]}) - - self.logDebug("Request %s: %s" % (type, res)) - - if res == "OK": - break - - sleep(5) - else: - self.logDebug("Could not send %s request: %s" % (type, res)) - - - def captchaCorrect(self, task): - self._captchaResponse(task, True) - - - def captchaInvalid(self, task): - self._captchaResponse(task, False) -- cgit v1.2.3 From feef23fadfdfbf64b38ea0be817e36321160be1f Mon Sep 17 00:00:00 2001 From: Nippey <matthias@dornuweb.de> Date: Thu, 22 Jan 2015 16:47:29 +0100 Subject: socket.create_connection is unavailable in Python25 socket.create_connection doesn't exist in Python 2.5. But it can be modeled with above function taken from: https://hg.python.org/cpython/file/2.6/Lib/socket.py#l534 So, it is how 2.6 does it :) --- module/plugins/hooks/ClickAndLoad.py | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py index 222310c25..370c40053 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickAndLoad.py @@ -17,11 +17,40 @@ def forward(source, destination): else: destination.shutdown(socket.SHUT_WR) - +_GLOBAL_DEFAULT_TIMEOUT = object() +def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT): + """Connect to *address* and return the socket object. + + Convenience function. Connect to *address* (a 2-tuple ``(host, + port)``) and return the socket object. Passing the optional + *timeout* parameter will set the timeout on the socket instance + before attempting to connect. If no *timeout* is supplied, the + global default timeout setting returned by :func:`getdefaulttimeout` + is used. + """ + + msg = "getaddrinfo returns an empty list" + host, port = address + for res in getaddrinfo(host, port, 0, socket.SOCK_STREAM): + af, socktype, proto, canonname, sa = res + sock = None + try: + sock = socket(af, socktype, proto) + if timeout is not _GLOBAL_DEFAULT_TIMEOUT: + sock.settimeout(timeout) + sock.connect(sa) + return sock + + except error, msg: + if sock is not None: + sock.close() + + raise error, msg + class ClickAndLoad(Hook): __name__ = "ClickAndLoad" __type__ = "hook" - __version__ = "0.26" + __version__ = "0.27" __config__ = [("activated", "bool", "Activated" , True ), ("port" , "int" , "Port" , 9666 ), @@ -62,7 +91,7 @@ class ClickAndLoad(Hook): while True: server_socket = dock_socket.accept()[0] - client_socket = socket.create_connection(("127.0.0.1", webport)) + client_socket = create_connection(("127.0.0.1", webport)) hookManager.startThread(forward, server_socket, client_socket) hookManager.startThread(forward, client_socket, server_socket) -- cgit v1.2.3 From cf4ded052964047de88d676045329b8fa4fca2dc Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Thu, 22 Jan 2015 21:31:19 +0100 Subject: Update plugins after CaptchaService changes --- module/plugins/hooks/DeathByCaptcha.py | 2 +- module/plugins/hooks/ExtractArchive.py | 38 +++++++++++++++++----------------- module/plugins/hooks/ImageTyperz.py | 2 +- 3 files changed, 21 insertions(+), 21 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/DeathByCaptcha.py b/module/plugins/hooks/DeathByCaptcha.py index 050b6fe15..d513c446d 100644 --- a/module/plugins/hooks/DeathByCaptcha.py +++ b/module/plugins/hooks/DeathByCaptcha.py @@ -135,7 +135,7 @@ class DeathByCaptcha(Hook): def submit(self, captcha, captchaType="file", match=None): - #workaround multipart-post bug in HTTPRequest.py + #@NOTE: Workaround multipart-post bug in HTTPRequest.py if re.match("^\w*$", self.getConfig("passkey")): multipart = True data = (FORM_FILE, captcha) diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index bdbaf64af..f2f4b5207 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -58,7 +58,7 @@ from module.utils import save_join, uniqify class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.04" + __version__ = "1.05" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract full path" , True ), @@ -305,33 +305,33 @@ class ExtractArchive(Hook): encrypted = True #@TODO: set to `False` passwords = self.getPasswords() - # try: - # self.logInfo(basename(plugin.file), "Verifying...") + try: + self.logInfo(basename(plugin.file), "Verifying...") - # tmp_password = plugin.password - # plugin.password = "" #: Force verifying without password + tmp_password = plugin.password + plugin.password = "" #: Force verifying without password - # plugin.verify() + plugin.verify() - # except PasswordError: - # encrypted = True + except PasswordError: + encrypted = True - # except CRCError: - # self.logWarning(basename(plugin.file), _("Archive damaged")) + except CRCError: + self.logWarning(basename(plugin.file), _("Archive damaged")) - # if not self.getConfig("repair"): - # raise CRCError + if not self.getConfig("repair"): + raise CRCError - # elif plugin.repair(): - # self.logInfo(basename(plugin.file), _("Successfully repaired")) + elif plugin.repair(): + self.logInfo(basename(plugin.file), _("Successfully repaired")) - # elif not self.getConfig("keepbroken"): - # raise ArchiveError(_("Broken archive")) + elif not self.getConfig("keepbroken"): + raise ArchiveError(_("Broken archive")) - # else: - # self.logInfo(basename(plugin.file), _("All OK")) + else: + self.logInfo(basename(plugin.file), _("All OK")) - # plugin.password = tmp_password + plugin.password = tmp_password if not encrypted: plugin.extract(progress) diff --git a/module/plugins/hooks/ImageTyperz.py b/module/plugins/hooks/ImageTyperz.py index 768129e4a..d62fed385 100644 --- a/module/plugins/hooks/ImageTyperz.py +++ b/module/plugins/hooks/ImageTyperz.py @@ -82,7 +82,7 @@ class ImageTyperz(Hook): req.c.setopt(LOW_SPEED_TIME, 80) try: - #workaround multipart-post bug in HTTPRequest.py + #@NOTE: Workaround multipart-post bug in HTTPRequest.py if re.match("^\w*$", self.getConfig("passkey")): multipart = True data = (FORM_FILE, captcha) -- cgit v1.2.3 From ce27cfd75023d3408cbdd74cf797a5aea7428de7 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Fri, 23 Jan 2015 00:52:58 +0100 Subject: [ClickAndLoad] Improve create_connection --- module/plugins/hooks/ClickAndLoad.py | 78 +++++++++++++++++++++--------------- 1 file changed, 46 insertions(+), 32 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py index 370c40053..682639750 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickAndLoad.py @@ -17,40 +17,55 @@ def forward(source, destination): else: destination.shutdown(socket.SHUT_WR) -_GLOBAL_DEFAULT_TIMEOUT = object() -def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT): - """Connect to *address* and return the socket object. - - Convenience function. Connect to *address* (a 2-tuple ``(host, - port)``) and return the socket object. Passing the optional - *timeout* parameter will set the timeout on the socket instance - before attempting to connect. If no *timeout* is supplied, the - global default timeout setting returned by :func:`getdefaulttimeout` - is used. - """ - - msg = "getaddrinfo returns an empty list" - host, port = address - for res in getaddrinfo(host, port, 0, socket.SOCK_STREAM): - af, socktype, proto, canonname, sa = res - sock = None - try: - sock = socket(af, socktype, proto) - if timeout is not _GLOBAL_DEFAULT_TIMEOUT: - sock.settimeout(timeout) - sock.connect(sa) - return sock - - except error, msg: - if sock is not None: - sock.close() - - raise error, msg - + +#: socket.create_connection wrapper for python 2.5 +def create_connection(address, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, + source_address=None): + try: + return socket.create_connection(address, timeout, source_address) + + except SyntaxError: + """Connect to *address* and return the socket object. + + Convenience function. Connect to *address* (a 2-tuple ``(host, + port)``) and return the socket object. Passing the optional + *timeout* parameter will set the timeout on the socket instance + before attempting to connect. If no *timeout* is supplied, the + global default timeout setting returned by :func:`getdefaulttimeout` + is used. If *source_address* is set it must be a tuple of (host, port) + for the socket to bind as a source address before making the connection. + An host of \'\' or port 0 tells the OS to use the default. + """ + + host, port = address + err = None + for res in getaddrinfo(host, port, 0, SOCK_STREAM): + af, socktype, proto, canonname, sa = res + sock = None + try: + sock = socket(af, socktype, proto) + if timeout is not socket._GLOBAL_DEFAULT_TIMEOUT: + sock.settimeout(timeout) + if source_address: + sock.bind(source_address) + sock.connect(sa) + return sock + + except error as _: + err = _ + if sock is not None: + sock.close() + + if err is not None: + raise err + else: + raise error("getaddrinfo returns an empty list") + + class ClickAndLoad(Hook): __name__ = "ClickAndLoad" __type__ = "hook" - __version__ = "0.27" + __version__ = "0.28" __config__ = [("activated", "bool", "Activated" , True ), ("port" , "int" , "Port" , 9666 ), @@ -98,7 +113,6 @@ class ClickAndLoad(Hook): except socket.error, e: self.logError(e) - self.server(ip, webport, cnlport) finally: dock_socket.close() -- cgit v1.2.3 From d6fc06740679154f67a0f95aba5463dda1ecf3fb Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sat, 24 Jan 2015 01:52:04 +0100 Subject: [ExtractArchive] Fix encrypted flag init --- module/plugins/hooks/ExtractArchive.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index f2f4b5207..38459e5f1 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -58,7 +58,7 @@ from module.utils import save_join, uniqify class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.05" + __version__ = "1.06" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract full path" , True ), @@ -302,7 +302,7 @@ class ExtractArchive(Hook): try: progress = lambda x: pyfile.setProgress(x) - encrypted = True #@TODO: set to `False` + encrypted = False passwords = self.getPasswords() try: -- cgit v1.2.3 From 7fc3362307737cd7c565b710ec83c5bdc4d3e8a9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sun, 25 Jan 2015 03:05:00 +0100 Subject: Revert Extractor to the old one (temp) --- module/plugins/hooks/ExtractArchive.py | 219 ++++++++++----------------------- 1 file changed, 65 insertions(+), 154 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 38459e5f1..9e530ce8f 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -51,33 +51,32 @@ if os.name != "nt": from pwd import getpwnam from module.plugins.Hook import Hook, threaded, Expose -from module.plugins.internal.Extractor import ArchiveError, CRCError, PasswordError -from module.utils import save_join, uniqify +from module.plugins.internal.Extractor import ArchiveError, CRCError, WrongPassword +from module.utils import save_join, fs_encode class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.06" - - __config__ = [("activated" , "bool" , "Activated" , True ), - ("fullpath" , "bool" , "Extract full path" , True ), - ("overwrite" , "bool" , "Overwrite files" , False ), - ("keepbroken" , "bool" , "Extract broken archives" , False ), - ("repair" , "bool" , "Repair broken archives" , True ), - ("passwordfile" , "file" , "Store passwords in file" , "archive_password.txt" ), - ("delete" , "bool" , "Delete archive when successfully extracted", False ), - ("subfolder" , "bool" , "Create subfolder for each package" , False ), - ("destination" , "folder", "Extract files to" , "" ), - ("extensions" , "str" , "Extract the following extensions" , "7z,bz2,bzip2,gz,gzip,lha,lzh,lzma,rar,tar,taz,tbz,tbz2,tgz,xar,xz,z,zip"), - ("excludefiles" , "str" , "Don't extract the following files" , "*.nfo,*.DS_Store,index.dat,thumb.db" ), - ("recursive" , "bool" , "Extract archives in archives" , True ), - ("queue" , "bool" , "Wait for all downloads to be finished" , False ), - ("renice" , "int" , "CPU Priority" , 0 )] + __version__ = "1.07" + + __config__ = [("activated", "bool", "Activated", True), + ("fullpath", "bool", "Extract full path", True), + ("overwrite", "bool", "Overwrite files", True), + ("passwordfile", "file", "password file", "archive_password.txt"), + ("deletearchive", "bool", "Delete archives when done", False), + ("subfolder", "bool", "Create subfolder for each package", False), + ("destination", "folder", "Extract files to", ""), + ("excludefiles", "str", "Exclude files from unpacking (seperated by ;)", ""), + ("recursive", "bool", "Extract archives in archvies", True), + ("queue", "bool", "Wait for all downloads to be finished", True), + ("renice", "int", "CPU Priority", 0)] __description__ = """Extract different kind of archives""" __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __authors__ = [("RaNaN", "ranan@pyload.org"), + ("AndroKev", None), + ("Walter Purcaro", "vuolter@gmail.com")] event_list = ["allDownloadsProcessed"] @@ -88,16 +87,12 @@ class ExtractArchive(Hook): pass - def coreReady(self): - self.extracting = False - - def setup(self): self.plugins = [] self.passwords = [] names = [] - for p in ("UnRar", "SevenZip", "UnZip"): + for p in ("UnRar", "UnZip"): try: module = self.core.pluginManager.loadModule("internal", p) klass = getattr(module, p) @@ -127,69 +122,45 @@ class ExtractArchive(Hook): self.queue = [] - def periodical(self): - if not self.queue or self.extracting: - return - - local = copy(self.queue) - self.queue[:] = [] - - self.extractPackages(*local) - - @Expose def extractPackage(self, id): - """ Extract package wrapper""" - self.extractPackages(id) - - - @Expose - def extractPackages(self, *ids): - """ Extract packages with given id""" - self.manager.startThread(self.extract, ids) + """ Extract package with given id""" + self.manager.startThread(self.extract, [id]) def packageFinished(self, pypack): - if self.getConfig("queue") or self.extracting: + pid = pypack.id + if self.getConfig("queue"): self.logInfo(_("Package %s queued for later extracting") % pypack.name) - self.queue.append(pypack.id) + self.queue.append(pid) else: - self.extractPackage(pypack.id) + self.manager.startThread(self.extract, [pid]) @threaded - def allDownloadsProcessed(self): + def allDownloadsProcessed(self, thread): local = copy(self.queue) - self.queue[:] = [] - if self.extract(local): #: check only if all gone fine, no failed reporting for now + del self.queue[:] + + if self.extract(local, thread): #: check only if all gone fine, no failed reporting for now self.manager.dispatchEvent("all_archives_extracted") self.manager.dispatchEvent("all_archives_processed") - def extract(self, ids): - self.extracting = True - + def extract(self, ids, thread=None): processed = [] extracted = [] failed = [] - clearlist = lambda string: [x.lstrip('.') for x in string.replace(' ', '').replace(',', '|').replace(';', '|').split('|')] - destination = self.getConfig("destination") subfolder = self.getConfig("subfolder") fullpath = self.getConfig("fullpath") overwrite = self.getConfig("overwrite") - extensions = clearlist(self.getConfig("extensions")) - excludefiles = clearlist(self.getConfig("excludefiles")) + excludefiles = self.getConfig("excludefiles") renice = self.getConfig("renice") recursive = self.getConfig("recursive") - delete = self.getConfig("delete") - keepbroken = self.getConfig("keepbroken") - - if extensions: - self.logDebug("Extensions: %s" % "|.".join(extensions)) # reload from txt file self.reloadPasswords() @@ -200,7 +171,7 @@ class ExtractArchive(Hook): #iterate packages -> plugins -> targets for pid in ids: p = self.core.files.getPackage(pid) - self.logInfo(_("Check package: %s") % p.name) + self.logInfo(_("Check package %s") % p.name) if not p: continue @@ -208,25 +179,21 @@ class ExtractArchive(Hook): out = save_join(dl, p.folder, destination, "") #: force trailing slash if subfolder: - out = save_join(out, p.folder) + out = save_join(out, fs_encode(p.folder)) if not exists(out): makedirs(out) files_ids = [(save_join(dl, p.folder, x['name']), x['id']) for x in p.getChildren().itervalues()] - matched = False - success = True + matched = False + success = True # check as long there are unseen files while files_ids: new_files_ids = [] - if extensions: - files_ids = [(file, id) for file, id in files_ids if filter(lambda ext: file.endswith(ext), extensions)] - for plugin in self.plugins: targets = plugin.getTargets(files_ids) - if targets: self.logDebug("Targets for %s: %s" % (plugin.__name__, targets)) matched = True @@ -238,32 +205,19 @@ class ExtractArchive(Hook): processed.append(target) # prevent extracting same file twice - self.logInfo(basename(target), _("Extract to: %s") % out) + self.logInfo(basename(target), _("Extract to %s") % out) try: - klass = plugin(self, - target, - out, - p.password, - fullpath, - overwrite, - excludefiles, - renice, - delete, - keepbroken) + klass = plugin(self, target, out, fullpath, overwrite, excludefiles, renice) klass.init() - new_files = self._extract(klass, fid) + new_files = self._extract(klass, fid, [p.password.strip()], thread) except Exception, e: self.logError(basename(target), e) - new_files = None - - if new_files is None: - self.logWarning(basename(target), _("No files extracted")) success = False continue - self.logDebug("Extracted files: %s" % new_files) + self.logDebug("Extracted", new_files) self.setPermissions(new_files) for file in new_files: @@ -285,87 +239,46 @@ class ExtractArchive(Hook): else: self.logInfo(_("No files found to extract")) - if not matched or not success and subfolder: - try: - os.rmdir(out) - except OSError: - pass - - self.extracting = False return True if not failed else False - def _extract(self, plugin, fid): + def _extract(self, plugin, fid, passwords, thread): pyfile = self.core.files.getFile(fid) + deletearchive = self.getConfig("deletearchive") pyfile.setCustomStatus(_("extracting")) + thread.addActive(pyfile) # keep this file until everything is done try: - progress = lambda x: pyfile.setProgress(x) - encrypted = False - passwords = self.getPasswords() - - try: - self.logInfo(basename(plugin.file), "Verifying...") - - tmp_password = plugin.password - plugin.password = "" #: Force verifying without password - - plugin.verify() - - except PasswordError: - encrypted = True - - except CRCError: - self.logWarning(basename(plugin.file), _("Archive damaged")) - - if not self.getConfig("repair"): - raise CRCError - - elif plugin.repair(): - self.logInfo(basename(plugin.file), _("Successfully repaired")) - - elif not self.getConfig("keepbroken"): - raise ArchiveError(_("Broken archive")) - - else: - self.logInfo(basename(plugin.file), _("All OK")) - - plugin.password = tmp_password - - if not encrypted: - plugin.extract(progress) + progress = lambda x: pyfile.setProgress(x) + success = False + if not plugin.checkArchive(): + plugin.extract(progress, pw) + success = True else: self.logInfo(basename(plugin.file), _("Password protected")) + self.logDebug("Passwords: %s" % passwords if passwords else "No password provided") - if plugin.password: - passwords.insert(0, plugin.password) - passwords = uniqify(self.passwords) - self.logDebug("Password: %s" % plugin.password) - else: - self.logDebug("No package password provided") - - for pw in passwords: + for pw in set(passwords) | set(self.getPasswords()): try: self.logDebug("Try password: %s" % pw) - - if plugin.setPassword(pw): - plugin.extract(progress) + if plugin.checkPassword(pw): + plugin.extract(progress, pw) self.addPassword(pw) + success = True break - else: - raise PasswordError - except PasswordError: + except WrongPassword: self.logDebug("Password was wrong") - else: - raise PasswordError + + if not success: + raise Exception(_("Wrong password")) if self.core.debug: - self.logDebug("Would delete: %s" % ", ".join(plugin.getDeleteFiles())) + self.logDebug("Would delete", ", ".join(plugin.getDeleteFiles())) - if self.getConfig("delete"): + if deletearchive: files = plugin.getDeleteFiles() self.logInfo(_("Deleting %s files") % len(files)) for f in files: @@ -381,16 +294,12 @@ class ExtractArchive(Hook): return extracted_files - except PasswordError: - self.logError(basename(plugin.file), _("Wrong password" if passwords else "No password found")) - plugin.password = "" + except ArchiveError, e: + self.logError(basename(plugin.file), _("Archive Error"), e) except CRCError: self.logError(basename(plugin.file), _("CRC Mismatch")) - except ArchiveError, e: - self.logError(basename(plugin.file), _("Archive Error"), e) - except Exception, e: if self.core.debug: print_exc() @@ -398,7 +307,7 @@ class ExtractArchive(Hook): self.manager.dispatchEvent("archive_extract_failed", pyfile) - self.logError(basename(plugin.file), _("Extract failed")) + raise Exception(_("Extract failed")) @Expose @@ -428,13 +337,15 @@ class ExtractArchive(Hook): """ Adds a password to saved list""" passwordfile = self.getConfig("passwordfile") + if pw in self.passwords: + self.passwords.remove(pw) + self.passwords.insert(0, pw) - self.passwords = uniqify(self.passwords) try: with open(passwordfile, "wb") as f: for pw in self.passwords: - f.write(pw + '\n') + f.write(pw + "\n") except IOError, e: self.logError(e) -- cgit v1.2.3 From d95f42fd8aef58a1aa892a8540a7ec360540d90a Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sun, 25 Jan 2015 16:54:40 +0100 Subject: [ClickAndLoad] Fix bad except --- module/plugins/hooks/ClickAndLoad.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py index 682639750..c8e5e0e98 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickAndLoad.py @@ -51,7 +51,7 @@ def create_connection(address, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, sock.connect(sa) return sock - except error as _: + except socket.error, _: err = _ if sock is not None: sock.close() @@ -59,13 +59,13 @@ def create_connection(address, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, if err is not None: raise err else: - raise error("getaddrinfo returns an empty list") + raise socket.error("getaddrinfo returns an empty list") class ClickAndLoad(Hook): __name__ = "ClickAndLoad" __type__ = "hook" - __version__ = "0.28" + __version__ = "0.29" __config__ = [("activated", "bool", "Activated" , True ), ("port" , "int" , "Port" , 9666 ), -- cgit v1.2.3 From 99ed44b0d919a33e3a559472893163b347cd1c37 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sun, 25 Jan 2015 19:09:21 +0100 Subject: Fix reverted Extractor --- module/plugins/hooks/ExtractArchive.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 9e530ce8f..20e585046 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -58,7 +58,7 @@ from module.utils import save_join, fs_encode class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.07" + __version__ = "1.08" __config__ = [("activated", "bool", "Activated", True), ("fullpath", "bool", "Extract full path", True), @@ -254,7 +254,7 @@ class ExtractArchive(Hook): success = False if not plugin.checkArchive(): - plugin.extract(progress, pw) + plugin.extract(progress, self.getPasswords()) success = True else: self.logInfo(basename(plugin.file), _("Password protected")) -- cgit v1.2.3 From b9ca6e20d44b6bbe95c7becc566b351b3f39c1e6 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Mon, 26 Jan 2015 00:20:26 +0100 Subject: [ClickAndLoad] Fix create_connection in python 2.5 --- module/plugins/hooks/ClickAndLoad.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py index c8e5e0e98..80201fe23 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickAndLoad.py @@ -19,10 +19,11 @@ def forward(source, destination): #: socket.create_connection wrapper for python 2.5 -def create_connection(address, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, - source_address=None): +def create_connection(address, timeout=object(), source_address=None): try: - return socket.create_connection(address, timeout, source_address) + return socket.create_connection(address, + socket._GLOBAL_DEFAULT_TIMEOUT if type(timeout) == object else timeout, + source_address) except SyntaxError: """Connect to *address* and return the socket object. @@ -44,7 +45,7 @@ def create_connection(address, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, sock = None try: sock = socket(af, socktype, proto) - if timeout is not socket._GLOBAL_DEFAULT_TIMEOUT: + if type(timeout) != object: sock.settimeout(timeout) if source_address: sock.bind(source_address) @@ -65,7 +66,7 @@ def create_connection(address, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, class ClickAndLoad(Hook): __name__ = "ClickAndLoad" __type__ = "hook" - __version__ = "0.29" + __version__ = "0.30" __config__ = [("activated", "bool", "Activated" , True ), ("port" , "int" , "Port" , 9666 ), -- cgit v1.2.3 From 49397d8e52e7c68a4ce3c1eb74792e23d79f3ebb Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Tue, 27 Jan 2015 17:46:19 +0100 Subject: [ClickAndLoad] Use self.manager instead hookManager --- module/plugins/hooks/ClickAndLoad.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py index 80201fe23..94a240d4c 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickAndLoad.py @@ -66,7 +66,7 @@ def create_connection(address, timeout=object(), source_address=None): class ClickAndLoad(Hook): __name__ = "ClickAndLoad" __type__ = "hook" - __version__ = "0.30" + __version__ = "0.31" __config__ = [("activated", "bool", "Activated" , True ), ("port" , "int" , "Port" , 9666 ), @@ -91,7 +91,7 @@ class ClickAndLoad(Hook): @threaded def proxy(self, ip, webport, cnlport): - hookManager.startThread(self.server, ip, webport, cnlport) + self.manager.startThread(self.server, ip, webport, cnlport) lock = Lock() lock.acquire() lock.acquire() @@ -109,8 +109,8 @@ class ClickAndLoad(Hook): server_socket = dock_socket.accept()[0] client_socket = create_connection(("127.0.0.1", webport)) - hookManager.startThread(forward, server_socket, client_socket) - hookManager.startThread(forward, client_socket, server_socket) + self.manager.startThread(forward, server_socket, client_socket) + self.manager.startThread(forward, client_socket, server_socket) except socket.error, e: self.logError(e) -- cgit v1.2.3 From 8848a359a43316fb346b728d1d79d7b72d27e5a0 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Tue, 27 Jan 2015 17:48:25 +0100 Subject: Update Extractor (again) --- module/plugins/hooks/ExtractArchive.py | 273 +++++++++++++++++++-------------- 1 file changed, 161 insertions(+), 112 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 20e585046..11764759f 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -6,8 +6,6 @@ import os import sys from copy import copy -from os import remove, chmod, makedirs -from os.path import exists, basename, isfile, isdir from traceback import print_exc # monkey patch bug in python 2.6 and lower @@ -47,35 +45,37 @@ if sys.version_info < (2, 7) and os.name != "nt": if os.name != "nt": from grp import getgrnam - from os import chown from pwd import getpwnam from module.plugins.Hook import Hook, threaded, Expose -from module.plugins.internal.Extractor import ArchiveError, CRCError, WrongPassword -from module.utils import save_join, fs_encode +from module.plugins.internal.Extractor import ArchiveError, CRCError, PasswordError +from module.utils import fs_decode, save_join, uniqify class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.08" - - __config__ = [("activated", "bool", "Activated", True), - ("fullpath", "bool", "Extract full path", True), - ("overwrite", "bool", "Overwrite files", True), - ("passwordfile", "file", "password file", "archive_password.txt"), - ("deletearchive", "bool", "Delete archives when done", False), - ("subfolder", "bool", "Create subfolder for each package", False), - ("destination", "folder", "Extract files to", ""), - ("excludefiles", "str", "Exclude files from unpacking (seperated by ;)", ""), - ("recursive", "bool", "Extract archives in archvies", True), - ("queue", "bool", "Wait for all downloads to be finished", True), - ("renice", "int", "CPU Priority", 0)] + __version__ = "1.09" + + __config__ = [("activated" , "bool" , "Activated" , True ), + ("fullpath" , "bool" , "Extract full path" , True ), + ("overwrite" , "bool" , "Overwrite files" , False ), + ("keepbroken" , "bool" , "Extract broken archives" , False ), + # ("repair" , "bool" , "Repair broken archives" , True ), + ("passwordfile" , "file" , "Store passwords in file" , "archive_password.txt" ), + ("delete" , "bool" , "Delete archive when successfully extracted", False ), + ("subfolder" , "bool" , "Create subfolder for each package" , False ), + ("destination" , "folder", "Extract files to" , "" ), + ("extensions" , "str" , "Extract the following extensions" , "7z,bz2,bzip2,gz,gzip,lha,lzh,lzma,rar,tar,taz,tbz,tbz2,tgz,xar,xz,z,zip"), + ("excludefiles" , "str" , "Don't extract the following files" , "*.nfo,*.DS_Store,index.dat,thumb.db" ), + ("recursive" , "bool" , "Extract archives in archives" , True ), + ("queue" , "bool" , "Wait for all downloads to be finished" , False ), + ("renice" , "int" , "CPU Priority" , 0 )] __description__ = """Extract different kind of archives""" __license__ = "GPLv3" __authors__ = [("RaNaN", "ranan@pyload.org"), - ("AndroKev", None), + ("AndroKev", ""), ("Walter Purcaro", "vuolter@gmail.com")] @@ -87,18 +87,23 @@ class ExtractArchive(Hook): pass + def coreReady(self): + self.extracting = False + + def setup(self): - self.plugins = [] - self.passwords = [] - names = [] + self.interval = 300 + self.extractors = [] + self.passwords = [] - for p in ("UnRar", "UnZip"): + names = [] + for p in ("UnRar", "SevenZip", "UnZip"): try: module = self.core.pluginManager.loadModule("internal", p) klass = getattr(module, p) if klass.checkDeps(): names.append(p) - self.plugins.append(klass) + self.extractors.append(klass) except OSError, e: if e.errno == 2: @@ -118,49 +123,55 @@ class ExtractArchive(Hook): else: self.logInfo(_("No Extract plugins activated")) - # queue with package ids - self.queue = [] + + def periodical(self): + if not self.extracting: + self.extractPackage(*self.getQueue()) @Expose - def extractPackage(self, id): - """ Extract package with given id""" - self.manager.startThread(self.extract, [id]) + def extractPackage(self, *ids): + """ Extract packages with given id""" + self.manager.startThread(self.extract, ids) def packageFinished(self, pypack): - pid = pypack.id - if self.getConfig("queue"): + if self.extracting or self.getConfig("queue"): self.logInfo(_("Package %s queued for later extracting") % pypack.name) - self.queue.append(pid) + self.addToQueue(pypack.id) else: - self.manager.startThread(self.extract, [pid]) + self.extractPackage(pypack.id) @threaded - def allDownloadsProcessed(self, thread): - local = copy(self.queue) - - del self.queue[:] - - if self.extract(local, thread): #: check only if all gone fine, no failed reporting for now + def allDownloadsProcessed(self): + if self.extract(self.getQueue()): #@NOTE: check only if all gone fine, no failed reporting for now self.manager.dispatchEvent("all_archives_extracted") self.manager.dispatchEvent("all_archives_processed") - def extract(self, ids, thread=None): + def extract(self, ids): processed = [] extracted = [] failed = [] + clearList = lambda string: [x.lstrip('.') for x in string.replace(' ', '').replace(',', '|').replace(';', '|').split('|')] + destination = self.getConfig("destination") subfolder = self.getConfig("subfolder") fullpath = self.getConfig("fullpath") overwrite = self.getConfig("overwrite") + extensions = clearList(self.getConfig("extensions")) + excludefiles = clearList(self.getConfig("excludefiles")) excludefiles = self.getConfig("excludefiles") renice = self.getConfig("renice") recursive = self.getConfig("recursive") + delete = self.getConfig("delete") + keepbroken = self.getConfig("keepbroken") + + if extensions: + self.logDebug("Extensions: %s" % "|.".join(extensions)) # reload from txt file self.reloadPasswords() @@ -168,63 +179,81 @@ class ExtractArchive(Hook): # dl folder dl = self.config['general']['download_folder'] - #iterate packages -> plugins -> targets + #iterate packages -> extractors -> targets for pid in ids: - p = self.core.files.getPackage(pid) - self.logInfo(_("Check package %s") % p.name) - if not p: + pypack = self.core.files.getPackage(pid) + + self.logInfo(_("Check package: %s") % pypack.name) + + if not pypack: continue # determine output folder - out = save_join(dl, p.folder, destination, "") #: force trailing slash + out = save_join(dl, pypack.folder, destination, "") #: force trailing slash if subfolder: - out = save_join(out, fs_encode(p.folder)) + out = save_join(out, pypack.folder) - if not exists(out): - makedirs(out) + if not os.path.exists(out): + os.makedirs(out) - files_ids = [(save_join(dl, p.folder, x['name']), x['id']) for x in p.getChildren().itervalues()] - matched = False - success = True + matched = False + success = True + files_ids = [(save_join(dl, pypack.folder, x['name']), x['id']) for x in pypack.getChildren().itervalues()] # check as long there are unseen files while files_ids: new_files_ids = [] - for plugin in self.plugins: - targets = plugin.getTargets(files_ids) + if extensions: + files_ids = [(file, id) for file, id in files_ids if filter(lambda ext: file.endswith(ext), extensions)] + + for Extractor in self.extractors: + targets = Extractor.getTargets(files_ids) if targets: - self.logDebug("Targets for %s: %s" % (plugin.__name__, targets)) + self.logDebug("Targets for %s: %s" % (Extractor.__name__, targets)) matched = True - for target, fid in targets: - if target in processed: - self.logDebug(basename(target), "skipped") + for filename, fid in targets: + fname = os.path.basename(filename) + + if filename in processed: + self.logDebug(fname, "Skipped") continue - processed.append(target) # prevent extracting same file twice + processed.append(filename) # prevent extracting same file twice - self.logInfo(basename(target), _("Extract to %s") % out) + self.logInfo(fname, _("Extract to: %s") % out) try: - klass = plugin(self, target, out, fullpath, overwrite, excludefiles, renice) + self.extracting = True + + klass = Extractor(self, + filename, + out, + fullpath, + overwrite, + excludefiles, + renice, + delete, + keepbroken, + fid) klass.init() - new_files = self._extract(klass, fid, [p.password.strip()], thread) + new_files = self._extract(klass, fid, pypack.password) except Exception, e: - self.logError(basename(target), e) + self.logError(fname, e) success = False continue - self.logDebug("Extracted", new_files) + self.logDebug("Extracted files: %s" % new_files) self.setPermissions(new_files) for file in new_files: - if not exists(file): + if not os.path.exists(file): self.logDebug("New file %s does not exists" % file) continue - if recursive and isfile(file): + if recursive and os.path.isfile(file): new_files_ids.append((file, fid)) # append as new target files_ids = new_files_ids # also check extracted files @@ -232,96 +261,120 @@ class ExtractArchive(Hook): if matched: if success: extracted.append(pid) - self.manager.dispatchEvent("package_extracted", p) + self.manager.dispatchEvent("package_extracted", pypack) else: failed.append(pid) - self.manager.dispatchEvent("package_extract_failed", p) + self.manager.dispatchEvent("package_extract_failed", pypack) else: self.logInfo(_("No files found to extract")) + if not matched or not success and subfolder: + try: + os.rmdir(out) + except OSError: + pass + + self.extracting = False return True if not failed else False - def _extract(self, plugin, fid, passwords, thread): + def _extract(self, archive, fid, password): pyfile = self.core.files.getFile(fid) - deletearchive = self.getConfig("deletearchive") + fname = os.path.basename(fs_decode(archive.target)) pyfile.setCustomStatus(_("extracting")) - thread.addActive(pyfile) # keep this file until everything is done + pyfile.setProgress(0) try: - progress = lambda x: pyfile.setProgress(x) success = False - if not plugin.checkArchive(): - plugin.extract(progress, self.getPasswords()) + if not archive.checkArchive(): + archive.extract(password) success = True else: - self.logInfo(basename(plugin.file), _("Password protected")) - self.logDebug("Passwords: %s" % passwords if passwords else "No password provided") + self.logInfo(fname, _("Password protected")) + self.logDebug("Password: %s" % (password or "No provided")) - for pw in set(passwords) | set(self.getPasswords()): + for pw in set(self.getPasswords(False) + [password]): try: self.logDebug("Try password: %s" % pw) - if plugin.checkPassword(pw): - plugin.extract(progress, pw) + if archive.checkPassword(pw): + archive.extract(pw) self.addPassword(pw) success = True break - except WrongPassword: + except PasswordError: self.logDebug("Password was wrong") + else: + raise PasswordError - if not success: - raise Exception(_("Wrong password")) + pyfile.setProgress(100) + pyfile.setStatus("processing") if self.core.debug: - self.logDebug("Would delete", ", ".join(plugin.getDeleteFiles())) + self.logDebug("Would delete: %s" % ", ".join(plugin.getDeleteFiles())) - if deletearchive: - files = plugin.getDeleteFiles() + if self.getConfig("delete"): + files = archive.getDeleteFiles() self.logInfo(_("Deleting %s files") % len(files)) for f in files: - if exists(f): - remove(f) + if os.path.exists(f): + os.remove(f) else: self.logDebug("%s does not exists" % f) - self.logInfo(basename(plugin.file), _("Extracting finished")) + self.logInfo(fname, _("Extracting finished")) - extracted_files = plugin.getExtractedFiles() - self.manager.dispatchEvent("archive_extracted", pyfile, plugin.out, plugin.file, extracted_files) + extracted_files = archive.getExtractedFiles() + self.manager.dispatchEvent("archive_extracted", pyfile, archive.out, archive.file, extracted_files) return extracted_files - except ArchiveError, e: - self.logError(basename(plugin.file), _("Archive Error"), e) + except PasswordError: + self.logError(fname, _("Wrong password" if password else "No password found")) except CRCError: - self.logError(basename(plugin.file), _("CRC Mismatch")) + self.logError(fname, _("CRC Mismatch")) + + except ArchiveError, e: + self.logError(fname, _("Archive Error"), e) except Exception, e: if self.core.debug: print_exc() - self.logError(basename(plugin.file), _("Unknown Error"), e) + self.logError(fname, _("Unknown Error"), e) + + finally: + pyfile.finishIfDone() self.manager.dispatchEvent("archive_extract_failed", pyfile) raise Exception(_("Extract failed")) + def getQueue(self): + return self.getStorage("ExtractArchive", []) + + + def addToQueue(self, item): + queue = self.getQueue() + return self.setStorage("ExtractArchive", queue + [item] if item not in queue else queue) + + @Expose - def getPasswords(self): + def getPasswords(self, reload=True): """ List of saved passwords """ + if reload: + self.reloadPasswords() + return self.passwords def reloadPasswords(self): - passwordfile = self.getConfig("passwordfile") - try: passwords = [] - with open(passwordfile, "a+") as f: + with open(self.getConfig("passwordfile")) as f: for pw in f.read().splitlines(): passwords.append(pw) @@ -335,17 +388,12 @@ class ExtractArchive(Hook): @Expose def addPassword(self, pw): """ Adds a password to saved list""" - passwordfile = self.getConfig("passwordfile") - - if pw in self.passwords: - self.passwords.remove(pw) - - self.passwords.insert(0, pw) - try: - with open(passwordfile, "wb") as f: + self.passwords = uniqify([pw] + self.passwords) + + with open(self.getConfig("passwordfile"), "wb") as f: for pw in self.passwords: - f.write(pw + "\n") + f.write(pw + '\n') except IOError, e: self.logError(e) @@ -353,20 +401,21 @@ class ExtractArchive(Hook): def setPermissions(self, files): for f in files: - if not exists(f): + if not os.path.exists(f): continue try: if self.config['permission']['change_file']: - if isfile(f): - chmod(f, int(self.config['permission']['file'], 8)) - elif isdir(f): - chmod(f, int(self.config['permission']['folder'], 8)) + if os.path.isfile(f): + os.chmod(f, int(self.config['permission']['file'], 8)) + + elif os.path.isdir(f): + os.chmod(f, int(self.config['permission']['folder'], 8)) if self.config['permission']['change_dl'] and os.name != "nt": uid = getpwnam(self.config['permission']['user'])[2] gid = getgrnam(self.config['permission']['group'])[2] - chown(f, uid, gid) + os.chown(f, uid, gid) except Exception, e: self.logWarning(_("Setting User and Group failed"), e) -- cgit v1.2.3 From 6cdce819e11b9bd1f3048513e7a1e0e5cf70a441 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Wed, 28 Jan 2015 01:16:37 +0100 Subject: [ExtractArchive] Fix typo --- module/plugins/hooks/ExtractArchive.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 11764759f..5c4e9bc82 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -55,13 +55,13 @@ from module.utils import fs_decode, save_join, uniqify class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.09" + __version__ = "1.10" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract full path" , True ), ("overwrite" , "bool" , "Overwrite files" , False ), ("keepbroken" , "bool" , "Extract broken archives" , False ), - # ("repair" , "bool" , "Repair broken archives" , True ), + ("repair" , "bool" , "Repair broken archives" , True ), ("passwordfile" , "file" , "Store passwords in file" , "archive_password.txt" ), ("delete" , "bool" , "Delete archive when successfully extracted", False ), ("subfolder" , "bool" , "Create subfolder for each package" , False ), -- cgit v1.2.3 From f23019b934446275b97f0c5fecf7709c19e557f9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Thu, 29 Jan 2015 02:19:37 +0100 Subject: [JustPremium] Cleanup --- module/plugins/hooks/JustPremium.py | 110 ++++++++++++++---------------------- 1 file changed, 43 insertions(+), 67 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/JustPremium.py b/module/plugins/hooks/JustPremium.py index 2c5788b75..529628406 100644 --- a/module/plugins/hooks/JustPremium.py +++ b/module/plugins/hooks/JustPremium.py @@ -1,79 +1,55 @@ # -*- 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. +from module.linkdict.Hook import Hook - 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: mazleu -""" -from module.plugins.Hook import Hook -from module.plugins.Account import Account -from module.plugins.Hoster import Hoster +class JustPremium(Hook): + __name__ = "JustPremium" + __type__ = "hook" + __version__ = "0.17" + __config__ = [("freehosters", "bool", "Allow all freehosters and other unknown sites", False), + ("nicehoster" , "str" , "unblock this hosters (comma seperated)" , "Zippyshare.com")] -class JustPremium(Hook): - __name__ = "JustPremium" - __version__ = "0.16" - __description__ = "If you add multiple links with at least one premium hoster link, all non premium links get removed" - __config__ = [("activated", "bool", "Activated", "False"), - ("freehosters","bool", "Allow all freehosters and other unknown sites", "false"), - ("nicehoster", "str", "unblock this hosters (comma seperated)", "Zippyshare.com")] + __description__ = """Remove all not premium links from urls added""" + __license__ = "GPLv3" + __authors__ = [("mazleu", "mazleica@gmail.com")] - __author_name__ = ("mazleu") - __author_mail__ = ("mazleica@gmail.com") event_list = ["linksAdded"] + def coreReady(self) : - accs=str(self.core.accountManager.getAccountInfos()) - global badhosts - global hosts - hosts = "" - while "[{" in accs: - startid=accs.rfind("[], ", 0, accs.find("[{"))+2 - endid=accs.find("}]",startid)+2 - hosts=hosts+","+accs[startid+3:accs.find("'",startid+3)] - accs=accs[0:startid]+accs[endid:] - badhosts=accs.replace("': [], '",",")[2:-6] - hosts=hosts[1:] - hosts=hosts+","+self.getConfig("nicehoster") - self.logDebug("good hosts:",hosts) - self.logDebug("bad hosts:",badhosts) - - - def filterLinks(self, t): - links = self.core.api.checkURLs(t) - hosterlist ="" - bhosters = [x.strip() for x in badhosts.split(",")] - ghosters = [x.strip() for x in hosts.split(",")] - premhoster = False - for hoster in links: - self.logDebug(hoster) - if hoster in ghosters: - premhoster = True - self.logDebug ("Found at least one hoster with account") - if premhoster : - for hoster in links: - if self.getConfig("freehosters"): - if hoster in bhosters: - self.logInfo("remove links from hoster '%s' " % (hoster)) - for link in links[hoster]: - t.remove(link) - self.logDebug("remove link '%s'because hoster was: '%s' " % (link,hoster)) - else: - if not hoster in ghosters: - self.logInfo("remove links from hoster '%s' " % (hoster)) - for link in links[hoster]: - t.remove(link) - self.logDebug("remove link '%s' because hoster was: '%s' " % (link,hoster)) + hosts = "" + accounts = str(self.core.accountManager.getAccountInfos()) + + while "[{" in accounts: + startid = accounts.rfind("[], ", 0, accounts.find("[{")) + 2 + endid = accounts.find("}]", startid) + 2 + hosts = hosts + "," + accounts[startid+3:accounts.find("'",startid+3)] + accounts = accounts[0:startid] + accounts[endid:] + + self.hosts = map(str.strip, (hosts[1:] + "," + self.getConfig("nicehoster")).split(',')) + self.badhosts = map(str.strip, accounts.replace("': [], '",",")[2:-6].split(',')) + + self.logDebug("Hosts: %s" % ", ".join(self.hosts)) + self.logDebug("Bad hosts: %s" % ", ".join(self.badhosts)) + + def linksAdded(self, links, pid): - self.filterLinks(links) + linkdict = self.core.api.checkURLs(links) + + #: Found at least one hoster with account + if not any(True for hoster in linkdict if hoster in self.hosts): + return + + if self.getConfig("freehosters"): + bad_hosters = [hoster for hoster in linkdict.iterkeys() if hoster in self.badhosts] + else: + bad_hosters = [hoster for hoster in linkdict.iterkeys() if hoster not in self.hosts] + + for hoster in bad_hosters: + self.logInfo(_("Remove links of hoster: %s") % hoster) + for link in linkdict[hoster]: + self.logDebug("Remove link: %s" % link) + links.remove(link) -- cgit v1.2.3 From 1ec3fd53f88aefb757491d590c302f6f71742a5c Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Thu, 29 Jan 2015 02:21:30 +0100 Subject: [JustPremium] Cleanup (2) --- module/plugins/hooks/JustPremium.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/JustPremium.py b/module/plugins/hooks/JustPremium.py index 529628406..7e1e738e4 100644 --- a/module/plugins/hooks/JustPremium.py +++ b/module/plugins/hooks/JustPremium.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.linkdict.Hook import Hook +from module.plugins.Hook import Hook class JustPremium(Hook): __name__ = "JustPremium" __type__ = "hook" - __version__ = "0.17" + __version__ = "0.18" __config__ = [("freehosters", "bool", "Allow all freehosters and other unknown sites", False), ("nicehoster" , "str" , "unblock this hosters (comma seperated)" , "Zippyshare.com")] -- cgit v1.2.3 From 52acc62381d165b615ebbb4414d846c7aee462d5 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Thu, 29 Jan 2015 13:34:33 +0100 Subject: [ExtractArchive] Fix typo (thx SelmaUrban) --- module/plugins/hooks/ExtractArchive.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 5c4e9bc82..c24173964 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -55,7 +55,7 @@ from module.utils import fs_decode, save_join, uniqify class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.10" + __version__ = "1.11" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract full path" , True ), @@ -74,9 +74,7 @@ class ExtractArchive(Hook): __description__ = """Extract different kind of archives""" __license__ = "GPLv3" - __authors__ = [("RaNaN", "ranan@pyload.org"), - ("AndroKev", ""), - ("Walter Purcaro", "vuolter@gmail.com")] + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] event_list = ["allDownloadsProcessed"] @@ -100,7 +98,7 @@ class ExtractArchive(Hook): for p in ("UnRar", "SevenZip", "UnZip"): try: module = self.core.pluginManager.loadModule("internal", p) - klass = getattr(module, p) + klass = getattr(module, p) if klass.checkDeps(): names.append(p) self.extractors.append(klass) @@ -164,7 +162,6 @@ class ExtractArchive(Hook): overwrite = self.getConfig("overwrite") extensions = clearList(self.getConfig("extensions")) excludefiles = clearList(self.getConfig("excludefiles")) - excludefiles = self.getConfig("excludefiles") renice = self.getConfig("renice") recursive = self.getConfig("recursive") delete = self.getConfig("delete") @@ -386,10 +383,10 @@ class ExtractArchive(Hook): @Expose - def addPassword(self, pw): + def addPassword(self, password): """ Adds a password to saved list""" try: - self.passwords = uniqify([pw] + self.passwords) + self.passwords = uniqify([password] + self.passwords) with open(self.getConfig("passwordfile"), "wb") as f: for pw in self.passwords: -- cgit v1.2.3 From cb9e67a5437ddfafd6a93f5a208b9faf3f2d5575 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Thu, 29 Jan 2015 15:56:57 +0100 Subject: Some file encoding fixup + optimizations --- module/plugins/hooks/ExternalScripts.py | 23 +++++++++++------------ module/plugins/hooks/ExtractArchive.py | 9 ++++++--- module/plugins/hooks/HotFolder.py | 3 ++- module/plugins/hooks/MergeFiles.py | 6 +++--- 4 files changed, 22 insertions(+), 19 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py index b2b4548a2..3d9a1e811 100644 --- a/module/plugins/hooks/ExternalScripts.py +++ b/module/plugins/hooks/ExternalScripts.py @@ -1,10 +1,9 @@ # -*- coding: utf-8 -*- +import os import subprocess from itertools import chain -from os import listdir, access, X_OK, makedirs -from os.path import join, exists, basename, abspath from module.plugins.Hook import Hook from module.utils import save_join @@ -47,40 +46,40 @@ class ExternalScripts(Hook): for folder in folders: self.scripts[folder] = [] - self.initPluginType(folder, join(pypath, 'scripts', folder)) - self.initPluginType(folder, join('scripts', folder)) + self.initPluginType(folder, os.path.join(pypath, 'scripts', folder)) + self.initPluginType(folder, os.path.join('scripts', folder)) for script_type, names in self.scripts.iteritems(): if names: - self.logInfo(_("Installed scripts for"), script_type, ", ".join([basename(x) for x in names])) + self.logInfo(_("Installed scripts for"), script_type, ", ".join([os.path.basename(x) for x in names])) def initPluginType(self, folder, path): - if not exists(path): + if not os.path.exists(path): try: - makedirs(path) + os.makedirs(path) except Exception: self.logDebug("Script folder %s not created" % folder) return - for f in listdir(path): + for f in os.listdir(path): if f.startswith("#") or f.startswith(".") or f.startswith("_") or f.endswith("~") or f.endswith(".swp"): continue - if not access(join(path, f), X_OK): + if not os.access(os.path.join(path, f), os.X_OK): self.logWarning(_("Script not executable:") + " %s/%s" % (folder, f)) - self.scripts[folder].append(join(path, f)) + self.scripts[folder].append(os.path.join(path, f)) def callScript(self, script, *args): try: cmd = [script] + [str(x) if not isinstance(x, basestring) else x for x in args] - self.logDebug("Executing", abspath(script), " ".join(cmd)) + self.logDebug("Executing", os.path.abspath(script), " ".join(cmd)) #output goes to pyload subprocess.Popen(cmd, bufsize=-1) except Exception, e: - self.logError(_("Error in %(script)s: %(error)s") % {"script": basename(script), "error": e}) + self.logError(_("Error in %(script)s: %(error)s") % {"script": os.path.basename(script), "error": e}) def downloadPreparing(self, pyfile): diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index c24173964..11427109b 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -49,7 +49,7 @@ if os.name != "nt": from module.plugins.Hook import Hook, threaded, Expose from module.plugins.internal.Extractor import ArchiveError, CRCError, PasswordError -from module.utils import fs_decode, save_join, uniqify +from module.utils import fs_decode, fs_encode, save_join, uniqify class ExtractArchive(Hook): @@ -371,7 +371,9 @@ class ExtractArchive(Hook): def reloadPasswords(self): try: passwords = [] - with open(self.getConfig("passwordfile")) as f: + + file = fs_encode(self.getConfig("passwordfile")) + with open(file) as f: for pw in f.read().splitlines(): passwords.append(pw) @@ -388,7 +390,8 @@ class ExtractArchive(Hook): try: self.passwords = uniqify([password] + self.passwords) - with open(self.getConfig("passwordfile"), "wb") as f: + file = fs_encode(self.getConfig("passwordfile")) + with open(file, "wb") as f: for pw in self.passwords: f.write(pw + '\n') diff --git a/module/plugins/hooks/HotFolder.py b/module/plugins/hooks/HotFolder.py index b0b59e2ba..1ff02c319 100644 --- a/module/plugins/hooks/HotFolder.py +++ b/module/plugins/hooks/HotFolder.py @@ -39,7 +39,8 @@ class HotFolder(Hook): makedirs(join(folder, "finished")) if self.getConfig("watch_file"): - with open(fs_encode(self.getConfig("file")), "a+") as f: + file = fs_encode(self.getConfig("file")) + with open(file, "a+") as f: content = f.read().strip() if content: diff --git a/module/plugins/hooks/MergeFiles.py b/module/plugins/hooks/MergeFiles.py index 4de45f958..9f1348485 100644 --- a/module/plugins/hooks/MergeFiles.py +++ b/module/plugins/hooks/MergeFiles.py @@ -8,13 +8,13 @@ import re from traceback import print_exc from module.plugins.Hook import Hook, threaded -from module.utils import save_join, fs_encode +from module.utils import save_join class MergeFiles(Hook): __name__ = "MergeFiles" __type__ = "hook" - __version__ = "0.13" + __version__ = "0.14" __config__ = [("activated", "bool", "Activated", True)] @@ -65,7 +65,7 @@ class MergeFiles(Hook): pyfile.setStatus("processing") try: - with open(os.path.join(download_folder, splitted_file), "rb") as s_file: + with open(save_join(download_folder, splitted_file), "rb") as s_file: size_written = 0 s_file_size = int(os.path.getsize(os.path.join(download_folder, splitted_file))) while True: -- cgit v1.2.3 From 788a06132882300a22f6db3aa7ac3a6009d4d762 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Thu, 29 Jan 2015 23:13:54 +0100 Subject: Update Extractor (2) --- module/plugins/hooks/ExtractArchive.py | 159 ++++++++++++++++++++++----------- 1 file changed, 105 insertions(+), 54 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 11427109b..f2bc11ec2 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -12,12 +12,14 @@ from traceback import print_exc # http://bugs.python.org/issue6122 , http://bugs.python.org/issue1236 , http://bugs.python.org/issue1731717 if sys.version_info < (2, 7) and os.name != "nt": import errno + from subprocess import Popen def _eintr_retry_call(func, *args): while True: try: return func(*args) + except OSError, e: if e.errno == errno.EINTR: continue @@ -49,28 +51,64 @@ if os.name != "nt": from module.plugins.Hook import Hook, threaded, Expose from module.plugins.internal.Extractor import ArchiveError, CRCError, PasswordError -from module.utils import fs_decode, fs_encode, save_join, uniqify +from module.utils import fs_encode, save_join, uniqify + + +class ArchiveQueue(object): + + def __init__(self, plugin, storage): + self.plugin = plugin + self.storage = storage + + + def get(self): + return self.plugin.getStorage("ExtractArchive:%s" % storage, []) + + + def set(self, value): + return self.plugin.setStorage("ExtractArchive:%s" % storage, value) + + + def clean(self): + return self.set([]) + + + def add(self, item): + queue = self.get() + if item not in queue: + return self.set(queue + [item]) + else: + return True + + + def remove(self, item): + queue = self.get() + queue.pop(item, None) + return self.set(queue) + class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.11" - - __config__ = [("activated" , "bool" , "Activated" , True ), - ("fullpath" , "bool" , "Extract full path" , True ), - ("overwrite" , "bool" , "Overwrite files" , False ), - ("keepbroken" , "bool" , "Extract broken archives" , False ), - ("repair" , "bool" , "Repair broken archives" , True ), - ("passwordfile" , "file" , "Store passwords in file" , "archive_password.txt" ), - ("delete" , "bool" , "Delete archive when successfully extracted", False ), - ("subfolder" , "bool" , "Create subfolder for each package" , False ), - ("destination" , "folder", "Extract files to" , "" ), - ("extensions" , "str" , "Extract the following extensions" , "7z,bz2,bzip2,gz,gzip,lha,lzh,lzma,rar,tar,taz,tbz,tbz2,tgz,xar,xz,z,zip"), - ("excludefiles" , "str" , "Don't extract the following files" , "*.nfo,*.DS_Store,index.dat,thumb.db" ), - ("recursive" , "bool" , "Extract archives in archives" , True ), - ("queue" , "bool" , "Wait for all downloads to be finished" , False ), - ("renice" , "int" , "CPU Priority" , 0 )] + __version__ = "1.12" + + __config__ = [("activated" , "bool" , "Activated" , True ), + ("fullpath" , "bool" , "Extract full path" , True ), + ("overwrite" , "bool" , "Overwrite files" , False ), + ("keepbroken" , "bool" , "Try to extract broken archives" , False ), + ("repair" , "bool" , "Repair broken archives" , False ), + ("extractempty" , "bool" , "Extract empty archives" , True ), + ("usepasswordfile" , "bool" , "Use password file" , True ), + ("passwordfile" , "file" , "Password file" , "archive_password.txt" ), + ("delete" , "bool" , "Delete archive when successfully extracted", False ), + ("subfolder" , "bool" , "Create subfolder for each package" , False ), + ("destination" , "folder", "Extract files to folder" , "" ), + ("extensions" , "str" , "Extract the following extensions" , "7z,bz2,bzip2,gz,gzip,lha,lzh,lzma,rar,tar,taz,tbz,tbz2,tgz,xar,xz,z,zip"), + ("excludefiles" , "str" , "Don't extract the following files" , "*.nfo,*.DS_Store,index.dat,thumb.db" ), + ("recursive" , "bool" , "Extract archives in archives" , True ), + ("queue" , "bool" , "Wait for all downloads to be finished" , False ), + ("renice" , "int" , "CPU priority" , 0 )] __description__ = """Extract different kind of archives""" __license__ = "GPLv3" @@ -90,6 +128,9 @@ class ExtractArchive(Hook): def setup(self): + self.queue = ArchiveQueue(self, "Queue") + self.failed = ArchiveQueue(self, "Failed") + self.interval = 300 self.extractors = [] self.passwords = [] @@ -124,7 +165,7 @@ class ExtractArchive(Hook): def periodical(self): if not self.extracting: - self.extractPackage(*self.getQueue()) + self.extractPackage(*self.queue.get()) @Expose @@ -136,14 +177,14 @@ class ExtractArchive(Hook): def packageFinished(self, pypack): if self.extracting or self.getConfig("queue"): self.logInfo(_("Package %s queued for later extracting") % pypack.name) - self.addToQueue(pypack.id) + self.queue.add(pypack.id) else: self.extractPackage(pypack.id) @threaded def allDownloadsProcessed(self): - if self.extract(self.getQueue()): #@NOTE: check only if all gone fine, no failed reporting for now + if self.extract(self.queue.get()): #@NOTE: check only if all gone fine, no failed reporting for now self.manager.dispatchEvent("all_archives_extracted") self.manager.dispatchEvent("all_archives_processed") @@ -180,11 +221,11 @@ class ExtractArchive(Hook): for pid in ids: pypack = self.core.files.getPackage(pid) - self.logInfo(_("Check package: %s") % pypack.name) - if not pypack: continue + self.logInfo(_("Check package: %s") % pypack.name) + # determine output folder out = save_join(dl, pypack.folder, destination, "") #: force trailing slash @@ -224,19 +265,19 @@ class ExtractArchive(Hook): try: self.extracting = True - klass = Extractor(self, - filename, - out, - fullpath, - overwrite, - excludefiles, - renice, - delete, - keepbroken, - fid) - klass.init() + archive = Extractor(self, + filename, + out, + fullpath, + overwrite, + excludefiles, + renice, + delete, + keepbroken, + fid) + archive.init() - new_files = self._extract(klass, fid, pypack.password) + new_files = self._extract(archive, fid, pypack.password) except Exception, e: self.logError(fname, e) @@ -250,6 +291,7 @@ class ExtractArchive(Hook): if not os.path.exists(file): self.logDebug("New file %s does not exists" % file) continue + if recursive and os.path.isfile(file): new_files_ids.append((file, fid)) # append as new target @@ -262,43 +304,60 @@ class ExtractArchive(Hook): else: failed.append(pid) self.manager.dispatchEvent("package_extract_failed", pypack) + + self.failed.add(pid) else: self.logInfo(_("No files found to extract")) if not matched or not success and subfolder: try: os.rmdir(out) + except OSError: pass + self.queue.remove(pid) + self.extracting = False return True if not failed else False def _extract(self, archive, fid, password): pyfile = self.core.files.getFile(fid) - fname = os.path.basename(fs_decode(archive.target)) + fname = os.path.basename(archive.filename) pyfile.setCustomStatus(_("extracting")) pyfile.setProgress(0) try: - success = False + try: + archive.check() - if not archive.checkArchive(): - archive.extract(password) - success = True - else: + except CRCError: + self.logInfo(fname, _("Header protected")) + + if self.getConfig("repair"): + self.logWarning(fname, "Repairing...") + archive.repair() + + except PasswordError): self.logInfo(fname, _("Password protected")) - self.logDebug("Password: %s" % (password or "No provided")) + except ArchiveError, e: + if e != "Empty Archive" or not self.getConfig("extractempty"): + raise ArchiveError(e) + + self.logDebug("Password: %s" % (password or "No provided")) + + if not self.getConfig("usepasswordfile"): + archive.extract(password) + else: for pw in set(self.getPasswords(False) + [password]): try: self.logDebug("Try password: %s" % pw) - if archive.checkPassword(pw): + if archive.isPassword(pw): archive.extract(pw) self.addPassword(pw) - success = True break except PasswordError: @@ -316,8 +375,9 @@ class ExtractArchive(Hook): files = archive.getDeleteFiles() self.logInfo(_("Deleting %s files") % len(files)) for f in files: - if os.path.exists(f): - os.remove(f) + file = fs_encode(f) + if os.path.exists(file): + os.remove(file) else: self.logDebug("%s does not exists" % f) @@ -350,15 +410,6 @@ class ExtractArchive(Hook): raise Exception(_("Extract failed")) - def getQueue(self): - return self.getStorage("ExtractArchive", []) - - - def addToQueue(self, item): - queue = self.getQueue() - return self.setStorage("ExtractArchive", queue + [item] if item not in queue else queue) - - @Expose def getPasswords(self, reload=True): """ List of saved passwords """ -- cgit v1.2.3 From 096e457a5a44e1ade87504147468fda045e07a88 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Thu, 29 Jan 2015 23:19:39 +0100 Subject: [ExtractArchive] Fix password recognition --- module/plugins/hooks/ExtractArchive.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index f2bc11ec2..8c5af1bb5 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -329,6 +329,8 @@ class ExtractArchive(Hook): pyfile.setCustomStatus(_("extracting")) pyfile.setProgress(0) + encrypted = False + try: try: archive.check() @@ -337,11 +339,12 @@ class ExtractArchive(Hook): self.logInfo(fname, _("Header protected")) if self.getConfig("repair"): - self.logWarning(fname, "Repairing...") + self.logWarning(fname, _("Repairing...")) archive.repair() except PasswordError): self.logInfo(fname, _("Password protected")) + encrypted = True except ArchiveError, e: if e != "Empty Archive" or not self.getConfig("extractempty"): @@ -349,7 +352,7 @@ class ExtractArchive(Hook): self.logDebug("Password: %s" % (password or "No provided")) - if not self.getConfig("usepasswordfile"): + if not encrypted or not self.getConfig("usepasswordfile"): archive.extract(password) else: for pw in set(self.getPasswords(False) + [password]): -- cgit v1.2.3 From 9f5aa7aec672ee184a640910fcda2d818e8f19fe Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Thu, 29 Jan 2015 23:55:40 +0100 Subject: [ExtractArchive] Fix https://github.com/pyload/pyload/issues/1100 --- module/plugins/hooks/ExtractArchive.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 8c5af1bb5..c91228850 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -91,7 +91,7 @@ class ArchiveQueue(object): class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.12" + __version__ = "1.13" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract full path" , True ), @@ -342,7 +342,7 @@ class ExtractArchive(Hook): self.logWarning(fname, _("Repairing...")) archive.repair() - except PasswordError): + except PasswordError: self.logInfo(fname, _("Password protected")) encrypted = True -- cgit v1.2.3 From ddccf7b36d7a941e4ab5539ff0c35b1367fe5337 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sat, 31 Jan 2015 03:45:19 +0100 Subject: [ExtractArchive] Fix typo Fix https://github.com/pyload/pyload/issues/1011#issuecomment-72268195, https://github.com/pyload/pyload/issues/1113, https://github.com/pyload/pyload/issues/1115 --- module/plugins/hooks/ExtractArchive.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index c91228850..f1b73bf5f 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -62,11 +62,11 @@ class ArchiveQueue(object): def get(self): - return self.plugin.getStorage("ExtractArchive:%s" % storage, []) + return self.plugin.getStorage("ExtractArchive:%s" % self.storage, []) def set(self, value): - return self.plugin.setStorage("ExtractArchive:%s" % storage, value) + return self.plugin.setStorage("ExtractArchive:%s" % self.storage, value) def clean(self): @@ -91,7 +91,7 @@ class ArchiveQueue(object): class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.13" + __version__ = "1.14" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract full path" , True ), -- cgit v1.2.3 From 4eb3ecd44244734463d9fdec1a68cf25dcb0b625 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sat, 31 Jan 2015 11:19:45 +0100 Subject: [ExtractArchive] Fix https://github.com/pyload/pyload/issues/1109 and https://github.com/pyload/pyload/issues/1116 --- module/plugins/hooks/ExtractArchive.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index f1b73bf5f..a09e96d1f 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -62,17 +62,25 @@ class ArchiveQueue(object): def get(self): - return self.plugin.getStorage("ExtractArchive:%s" % self.storage, []) + return self.plugin.getStorage("ExtractArchive:%s" % self.storage, "").decode('base64').split() def set(self, value): - return self.plugin.setStorage("ExtractArchive:%s" % self.storage, value) + if isinstance(value, list): + item = str(value)[1:-1].replace(' ', '').replace(',', ' ') + else: + item = str(value).strip() + return self.plugin.setStorage("ExtractArchive:%s" % self.storage, item.encode('base64')[:-1]) def clean(self): return self.set([]) + def delete(self): + return self.plugin.delStorage("ExtractArchive:%s" % self.storage) + + def add(self, item): queue = self.get() if item not in queue: @@ -91,7 +99,7 @@ class ArchiveQueue(object): class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.14" + __version__ = "1.15" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract full path" , True ), @@ -387,7 +395,7 @@ class ExtractArchive(Hook): self.logInfo(fname, _("Extracting finished")) extracted_files = archive.getExtractedFiles() - self.manager.dispatchEvent("archive_extracted", pyfile, archive.out, archive.file, extracted_files) + self.manager.dispatchEvent("archive_extracted", pyfile, archive.out, archive.filename, extracted_files) return extracted_files -- cgit v1.2.3 From 9bcc44f285360334980d375601f4e69ac5e0d2af Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sat, 31 Jan 2015 12:02:03 +0100 Subject: [ExtractArchive] Fix typo (thx VinceGitHub) --- module/plugins/hooks/ExtractArchive.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index a09e96d1f..494381124 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -99,7 +99,7 @@ class ArchiveQueue(object): class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.15" + __version__ = "1.16" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract full path" , True ), @@ -380,7 +380,7 @@ class ExtractArchive(Hook): pyfile.setStatus("processing") if self.core.debug: - self.logDebug("Would delete: %s" % ", ".join(plugin.getDeleteFiles())) + self.logDebug("Would delete: %s" % ", ".join(archive.getDeleteFiles())) if self.getConfig("delete"): files = archive.getDeleteFiles() -- cgit v1.2.3 From a206e9103c6d791caf780be3de6ce6ceda13b793 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sat, 31 Jan 2015 21:18:17 +0100 Subject: [JustPremium] Rewritten --- module/plugins/hooks/JustPremium.py | 44 ++++++++++++------------------------- 1 file changed, 14 insertions(+), 30 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/JustPremium.py b/module/plugins/hooks/JustPremium.py index 7e1e738e4..1b0ed4196 100644 --- a/module/plugins/hooks/JustPremium.py +++ b/module/plugins/hooks/JustPremium.py @@ -1,55 +1,39 @@ # -*- coding: utf-8 -*- +import re + from module.plugins.Hook import Hook class JustPremium(Hook): __name__ = "JustPremium" __type__ = "hook" - __version__ = "0.18" + __version__ = "0.19" - __config__ = [("freehosters", "bool", "Allow all freehosters and other unknown sites", False), - ("nicehoster" , "str" , "unblock this hosters (comma seperated)" , "Zippyshare.com")] + __config__ = [("excluded", "str", "Exclude hosters (comma separated)", "")] __description__ = """Remove all not premium links from urls added""" __license__ = "GPLv3" - __authors__ = [("mazleu", "mazleica@gmail.com")] + __authors__ = [("mazleu", "mazleica@gmail.com"), + ("Walter Purcaro", "vuolter@gmail.com")] event_list = ["linksAdded"] - def coreReady(self) : - hosts = "" - accounts = str(self.core.accountManager.getAccountInfos()) - - while "[{" in accounts: - startid = accounts.rfind("[], ", 0, accounts.find("[{")) + 2 - endid = accounts.find("}]", startid) + 2 - hosts = hosts + "," + accounts[startid+3:accounts.find("'",startid+3)] - accounts = accounts[0:startid] + accounts[endid:] - - self.hosts = map(str.strip, (hosts[1:] + "," + self.getConfig("nicehoster")).split(',')) - self.badhosts = map(str.strip, accounts.replace("': [], '",",")[2:-6].split(',')) - - self.logDebug("Hosts: %s" % ", ".join(self.hosts)) - self.logDebug("Bad hosts: %s" % ", ".join(self.badhosts)) - - def linksAdded(self, links, pid): - linkdict = self.core.api.checkURLs(links) + linkdict = self.core.api.checkURLs(links) + premiumplugins = set(account.type for account in self.core.api.getAccounts(False) if account.valid and account.premium) #: Found at least one hoster with account - if not any(True for hoster in linkdict if hoster in self.hosts): + if not any(True for pluginname in linkdict if pluginname in premiumplugins): return - if self.getConfig("freehosters"): - bad_hosters = [hoster for hoster in linkdict.iterkeys() if hoster in self.badhosts] - else: - bad_hosters = [hoster for hoster in linkdict.iterkeys() if hoster not in self.hosts] + excluded = map(lambda domain: "".join(part.capitalize() for part in re.split(r'(\.|\d+)', domain) if part != '.'), + self.getConfig('excluded').replace(' ', '').replace(',', '|').replace(';', '|').split('|')) - for hoster in bad_hosters: - self.logInfo(_("Remove links of hoster: %s") % hoster) - for link in linkdict[hoster]: + for pluginname in set(linkdict.keys()) - premiumplugins.union(excluded): + self.logInfo(_("Remove links of plugin: %s") % pluginname) + for link in linkdict[pluginname]: self.logDebug("Remove link: %s" % link) links.remove(link) -- cgit v1.2.3 From 79725268402043906f619f7c09e848e02ab8a17b Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sat, 31 Jan 2015 22:00:59 +0100 Subject: Spare code cosmetics --- module/plugins/hooks/BypassCaptcha.py | 4 ++-- module/plugins/hooks/Captcha9Kw.py | 31 ++++++++++++++----------------- module/plugins/hooks/ExpertDecoders.py | 8 +++++--- module/plugins/hooks/ExternalScripts.py | 2 +- module/plugins/hooks/MultiHome.py | 2 +- module/plugins/hooks/XFileSharingPro.py | 14 +++++++------- 6 files changed, 30 insertions(+), 31 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/BypassCaptcha.py b/module/plugins/hooks/BypassCaptcha.py index 8e0d9d36e..cf8754dae 100644 --- a/module/plugins/hooks/BypassCaptcha.py +++ b/module/plugins/hooks/BypassCaptcha.py @@ -59,7 +59,7 @@ class BypassCaptcha(Hook): def getCredits(self): res = getURL(self.GETCREDITS_URL, post={"key": self.getConfig("passkey")}) - data = dict([x.split(' ', 1) for x in res.splitlines()]) + data = dict(x.split(' ', 1) for x in res.splitlines()) return int(data['Left']) @@ -79,7 +79,7 @@ class BypassCaptcha(Hook): finally: req.close() - data = dict([x.split(' ', 1) for x in res.splitlines()]) + data = dict(x.split(' ', 1) for x in res.splitlines()) if not data or "Value" not in data: raise BypassCaptchaException(res) diff --git a/module/plugins/hooks/Captcha9Kw.py b/module/plugins/hooks/Captcha9Kw.py index 600694e78..342f3fee8 100644 --- a/module/plugins/hooks/Captcha9Kw.py +++ b/module/plugins/hooks/Captcha9Kw.py @@ -77,22 +77,19 @@ class Captcha9Kw(Hook): self.logError(e) return - data = b64encode(data) - mouse = 1 if task.isPositional() else 0 pluginname = re.search(r'_([^_]*)_\d+.\w+', task.captchaFile).group(1) - - option = {'min' : 2, - 'max' : 50, - 'phrase' : 0, - 'numeric' : 0, - 'case_sensitive': 0, - 'math' : 0, - 'prio' : min(max(self.getConfig("prio"), 0), 10), - 'confirm' : self.getConfig("confirm"), - 'timeout' : min(max(self.getConfig("timeout"), 300), 3999), - 'selfsolve' : self.getConfig("selfsolve"), - 'cph' : self.getConfig("captchaperhour"), - 'cpm' : self.getConfig("captchapermin")} + option = {'min' : 2, + 'max' : 50, + 'phrase' : 0, + 'numeric' : 0, + 'case_sensitive': 0, + 'math' : 0, + 'prio' : min(max(self.getConfig("prio"), 0), 10), + 'confirm' : self.getConfig("confirm"), + 'timeout' : min(max(self.getConfig("timeout"), 300), 3999), + 'selfsolve' : self.getConfig("selfsolve"), + 'cph' : self.getConfig("captchaperhour"), + 'cpm' : self.getConfig("captchapermin")} for opt in str(self.getConfig("hoster_options").split('|')): @@ -130,8 +127,8 @@ class Captcha9Kw(Hook): 'pyload' : "1", 'source' : "pyload", 'base64' : "1", - 'mouse' : mouse, - 'file-upload-01': data, + 'mouse' : 1 if task.isPositional() else 0, + 'file-upload-01': b64encode(data), 'action' : "usercaptchaupload"} for _i in xrange(5): diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py index c80401003..c9f8204c4 100644 --- a/module/plugins/hooks/ExpertDecoders.py +++ b/module/plugins/hooks/ExpertDecoders.py @@ -56,15 +56,17 @@ class ExpertDecoders(Hook): with open(task.captchaFile, 'rb') as f: data = f.read() - data = b64encode(data) req = getRequest() #raise timeout threshold req.c.setopt(LOW_SPEED_TIME, 80) try: - result = req.load(self.API_URL, post={"action": "upload", "key": self.getConfig("passkey"), - "file": data, "gen_task_id": ticket}) + result = req.load(self.API_URL, + post={'action' : "upload", + 'key' : self.getConfig("passkey"), + 'file' : b64encode(data), + 'gen_task_id': ticket}) finally: req.close() diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py index 3d9a1e811..bbd442963 100644 --- a/module/plugins/hooks/ExternalScripts.py +++ b/module/plugins/hooks/ExternalScripts.py @@ -51,7 +51,7 @@ class ExternalScripts(Hook): for script_type, names in self.scripts.iteritems(): if names: - self.logInfo(_("Installed scripts for"), script_type, ", ".join([os.path.basename(x) for x in names])) + self.logInfo(_("Installed scripts for"), script_type, ", ".join(map(os.path.basename, names))) def initPluginType(self, folder, path): diff --git a/module/plugins/hooks/MultiHome.py b/module/plugins/hooks/MultiHome.py index 105a42abd..c9f6fc30c 100644 --- a/module/plugins/hooks/MultiHome.py +++ b/module/plugins/hooks/MultiHome.py @@ -32,7 +32,7 @@ class MultiHome(Hook): def toConfig(self): - return ";".join([i.adress for i in self.interfaces]) + return ";".join(i.adress for i in self.interfaces) def parseInterfaces(self, interfaces): diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py index e6e30ca8f..9435d35d9 100644 --- a/module/plugins/hooks/XFileSharingPro.py +++ b/module/plugins/hooks/XFileSharingPro.py @@ -65,22 +65,22 @@ class XFileSharingPro(Hook): self.logInfo(_("Handling any %s I can!") % type) pattern = self.regexp[type][0] else: - s = self.getConfig('%s_list' % type).replace('\\', '').replace('|', ',').replace(';', ',').lower() - plugin_list = set([x.strip() for x in s.split(',')]) + plugins = self.getConfig('%s_list' % type) + plugin_set = set(plugins.replace(' ', '').replace('\\', '').replace('|', ',').replace(';', ',').lower().split(',')) if use_builtin_list: - plugin_list |= set([x.lower() for x in getattr(self, "%s_BUILTIN" % type.upper())]) + plugin_set |= set(x.lower() for x in getattr(self, "%s_BUILTIN" % type.upper())) - plugin_list -= set(('', u'')) + plugin_set -= set(('', u'')) - if not plugin_list: + if not plugin_set: self.logInfo(_("No %s to handle") % type) self._unload(type, plugin) return - match_list = '|'.join(sorted(plugin_list)) + match_list = '|'.join(sorted(plugin_set)) - len_match_list = len(plugin_list) + len_match_list = len(plugin_set) self.logInfo(_("Handling %d %s%s: %s") % (len_match_list, type, "" if len_match_list == 1 else "s", -- cgit v1.2.3 From cfdc545c0e0f85450d142fcc64af5bd37ff6da13 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sat, 31 Jan 2015 23:21:17 +0100 Subject: [ExtractArchive] Pre-final fixup --- module/plugins/hooks/ExtractArchive.py | 79 ++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 37 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 494381124..f1641d639 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -99,14 +99,13 @@ class ArchiveQueue(object): class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.16" + __version__ = "1.20" __config__ = [("activated" , "bool" , "Activated" , True ), - ("fullpath" , "bool" , "Extract full path" , True ), + ("fullpath" , "bool" , "Extract with full paths" , True ), ("overwrite" , "bool" , "Overwrite files" , False ), ("keepbroken" , "bool" , "Try to extract broken archives" , False ), - ("repair" , "bool" , "Repair broken archives" , False ), - ("extractempty" , "bool" , "Extract empty archives" , True ), + ("repair" , "bool" , "Repair broken archives" , True ), ("usepasswordfile" , "bool" , "Use password file" , True ), ("passwordfile" , "file" , "Password file" , "archive_password.txt" ), ("delete" , "bool" , "Delete archive when successfully extracted", False ), @@ -115,7 +114,7 @@ class ExtractArchive(Hook): ("extensions" , "str" , "Extract the following extensions" , "7z,bz2,bzip2,gz,gzip,lha,lzh,lzma,rar,tar,taz,tbz,tbz2,tgz,xar,xz,z,zip"), ("excludefiles" , "str" , "Don't extract the following files" , "*.nfo,*.DS_Store,index.dat,thumb.db" ), ("recursive" , "bool" , "Extract archives in archives" , True ), - ("queue" , "bool" , "Wait for all downloads to be finished" , False ), + ("waitall" , "bool" , "Wait for all downloads to be finished" , False ), ("renice" , "int" , "CPU priority" , 0 )] __description__ = """Extract different kind of archives""" @@ -148,7 +147,7 @@ class ExtractArchive(Hook): try: module = self.core.pluginManager.loadModule("internal", p) klass = getattr(module, p) - if klass.checkDeps(): + if klass.isUsable(): names.append(p) self.extractors.append(klass) @@ -183,7 +182,7 @@ class ExtractArchive(Hook): def packageFinished(self, pypack): - if self.extracting or self.getConfig("queue"): + if self.extracting or self.getConfig("waitall"): self.logInfo(_("Package %s queued for later extracting") % pypack.name) self.queue.add(pypack.id) else: @@ -203,19 +202,20 @@ class ExtractArchive(Hook): extracted = [] failed = [] - clearList = lambda string: [x.lstrip('.') for x in string.replace(' ', '').replace(',', '|').replace(';', '|').split('|')] + toList = lambda string: string.replace(' ', '').replace(',', '|').replace(';', '|').split('|') destination = self.getConfig("destination") subfolder = self.getConfig("subfolder") fullpath = self.getConfig("fullpath") overwrite = self.getConfig("overwrite") - extensions = clearList(self.getConfig("extensions")) - excludefiles = clearList(self.getConfig("excludefiles")) renice = self.getConfig("renice") recursive = self.getConfig("recursive") delete = self.getConfig("delete") keepbroken = self.getConfig("keepbroken") + extensions = [x.lstrip('.').lower() for x in toList(self.getConfig("extensions"))] + excludefiles = toList(self.getConfig("excludefiles")) + if extensions: self.logDebug("Extensions: %s" % "|.".join(extensions)) @@ -245,14 +245,15 @@ class ExtractArchive(Hook): matched = False success = True - files_ids = [(save_join(dl, pypack.folder, x['name']), x['id']) for x in pypack.getChildren().itervalues()] + files_ids = [(save_join(dl, pypack.folder, pylink['name']), pylink['id']) for pylink in pypack.getChildren().itervalues()] # check as long there are unseen files while files_ids: new_files_ids = [] if extensions: - files_ids = [(file, id) for file, id in files_ids if filter(lambda ext: file.endswith(ext), extensions)] + files_ids = [(fname, fid) for fname, id in files_ids \ + if filter(lambda ext: fname.lower().endswith(ext), extensions)] for Extractor in self.extractors: targets = Extractor.getTargets(files_ids) @@ -260,21 +261,21 @@ class ExtractArchive(Hook): self.logDebug("Targets for %s: %s" % (Extractor.__name__, targets)) matched = True - for filename, fid in targets: - fname = os.path.basename(filename) + for fname, fid in targets: + name = os.path.basename(fname) - if filename in processed: - self.logDebug(fname, "Skipped") + if fname in processed: + self.logDebug(name, "Skipped") continue - processed.append(filename) # prevent extracting same file twice + processed.append(fname) # prevent extracting same file twice - self.logInfo(fname, _("Extract to: %s") % out) + self.logInfo(name, _("Extract to: %s") % out) try: self.extracting = True archive = Extractor(self, - filename, + fname, out, fullpath, overwrite, @@ -288,20 +289,21 @@ class ExtractArchive(Hook): new_files = self._extract(archive, fid, pypack.password) except Exception, e: - self.logError(fname, e) + self.logError(name, e) success = False continue self.logDebug("Extracted files: %s" % new_files) self.setPermissions(new_files) - for file in new_files: + for filename in new_files: + file = fs_encode(filename) if not os.path.exists(file): - self.logDebug("New file %s does not exists" % file) + self.logDebug("New file %s does not exists" % filename) continue if recursive and os.path.isfile(file): - new_files_ids.append((file, fid)) # append as new target + new_files_ids.append((filename, fid)) # append as new target files_ids = new_files_ids # also check extracted files @@ -332,7 +334,7 @@ class ExtractArchive(Hook): def _extract(self, archive, fid, password): pyfile = self.core.files.getFile(fid) - fname = os.path.basename(archive.filename) + name = os.path.basename(archive.filename) pyfile.setCustomStatus(_("extracting")) pyfile.setProgress(0) @@ -343,20 +345,23 @@ class ExtractArchive(Hook): try: archive.check() - except CRCError: - self.logInfo(fname, _("Header protected")) + except CRCError, e: + self.logDebug(name, e) + self.logInfo(name, _("Header protected")) if self.getConfig("repair"): - self.logWarning(fname, _("Repairing...")) - archive.repair() + self.logWarning(name, _("Repairing...")) + repaired = archive.repair() + + if not repaired and not self.getConfig("keepbroken"): + raise CRCError("Archive damaged") except PasswordError: - self.logInfo(fname, _("Password protected")) + self.logInfo(name, _("Password protected")) encrypted = True except ArchiveError, e: - if e != "Empty Archive" or not self.getConfig("extractempty"): - raise ArchiveError(e) + raise ArchiveError(e) self.logDebug("Password: %s" % (password or "No provided")) @@ -392,7 +397,7 @@ class ExtractArchive(Hook): else: self.logDebug("%s does not exists" % f) - self.logInfo(fname, _("Extracting finished")) + self.logInfo(name, _("Extracting finished")) extracted_files = archive.getExtractedFiles() self.manager.dispatchEvent("archive_extracted", pyfile, archive.out, archive.filename, extracted_files) @@ -400,18 +405,18 @@ class ExtractArchive(Hook): return extracted_files except PasswordError: - self.logError(fname, _("Wrong password" if password else "No password found")) + self.logError(name, _("Wrong password" if password else "No password found")) - except CRCError: - self.logError(fname, _("CRC Mismatch")) + except CRCError, e: + self.logError(name, _("CRC mismatch"), e) except ArchiveError, e: - self.logError(fname, _("Archive Error"), e) + self.logError(name, _("Archive error"), e) except Exception, e: + self.logError(name, _("Unknown error"), e) if self.core.debug: print_exc() - self.logError(fname, _("Unknown Error"), e) finally: pyfile.finishIfDone() -- cgit v1.2.3 From b4515ea17dd64df7647f7d7d91ebc0c8a46d5433 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sat, 31 Jan 2015 23:52:43 +0100 Subject: Fix https://github.com/pyload/pyload/issues/1120 (2) --- module/plugins/hooks/ExtractArchive.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index f1641d639..dde1a5ddc 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -99,7 +99,7 @@ class ArchiveQueue(object): class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.20" + __version__ = "1.21" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract with full paths" , True ), @@ -252,7 +252,7 @@ class ExtractArchive(Hook): new_files_ids = [] if extensions: - files_ids = [(fname, fid) for fname, id in files_ids \ + files_ids = [(fname, fid) for fname, fid in files_ids \ if filter(lambda ext: fname.lower().endswith(ext), extensions)] for Extractor in self.extractors: -- cgit v1.2.3 From 8bda0302c7a9452a1828ec9c9e2f60901d25e3c5 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sun, 1 Feb 2015 00:08:07 +0100 Subject: [ExtractArchive] Fix http://forum.pyload.org/viewtopic.php?f=10&t=3990 --- module/plugins/hooks/ExtractArchive.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index dde1a5ddc..dd1a82a82 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -91,7 +91,10 @@ class ArchiveQueue(object): def remove(self, item): queue = self.get() - queue.pop(item, None) + try: + queue.remove(item) + except ValueError: + pass return self.set(queue) @@ -99,7 +102,7 @@ class ArchiveQueue(object): class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.21" + __version__ = "1.22" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract with full paths" , True ), -- cgit v1.2.3 From 63651d0c9b32c85c1a55dbf6b5299881170dccff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6rnlein?= <jens.hoernlein@googlemail.com> Date: Sun, 1 Feb 2015 01:42:00 +0100 Subject: [JustPremium] Added Multi-Hosters recognition --- module/plugins/hooks/JustPremium.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/JustPremium.py b/module/plugins/hooks/JustPremium.py index 1b0ed4196..99af95e38 100644 --- a/module/plugins/hooks/JustPremium.py +++ b/module/plugins/hooks/JustPremium.py @@ -8,14 +8,15 @@ from module.plugins.Hook import Hook class JustPremium(Hook): __name__ = "JustPremium" __type__ = "hook" - __version__ = "0.19" + __version__ = "0.20" __config__ = [("excluded", "str", "Exclude hosters (comma separated)", "")] __description__ = """Remove all not premium links from urls added""" __license__ = "GPLv3" __authors__ = [("mazleu", "mazleica@gmail.com"), - ("Walter Purcaro", "vuolter@gmail.com")] + ("Walter Purcaro", "vuolter@gmail.com"), + ("immenz", "immenz@gmx.net")] event_list = ["linksAdded"] @@ -24,15 +25,16 @@ class JustPremium(Hook): def linksAdded(self, links, pid): linkdict = self.core.api.checkURLs(links) premiumplugins = set(account.type for account in self.core.api.getAccounts(False) if account.valid and account.premium) - - #: Found at least one hoster with account - if not any(True for pluginname in linkdict if pluginname in premiumplugins): + multihoster = set(hoster for hoster in self.core.pluginManager.hosterPlugins if 'new_name' in self.core.pluginManager.hosterPlugins[hoster]) + + #: Found at least one hoster with account or multihoster + if not any(True for pluginname in linkdict if pluginname in premiumplugins | multihoster): return excluded = map(lambda domain: "".join(part.capitalize() for part in re.split(r'(\.|\d+)', domain) if part != '.'), self.getConfig('excluded').replace(' ', '').replace(',', '|').replace(';', '|').split('|')) - for pluginname in set(linkdict.keys()) - premiumplugins.union(excluded): + for pluginname in set(linkdict.keys()) - (premiumplugins | set(excluded) | multihoster): self.logInfo(_("Remove links of plugin: %s") % pluginname) for link in linkdict[pluginname]: self.logDebug("Remove link: %s" % link) -- cgit v1.2.3 From 2fa8ca10879e163e5f20c9d7b8645e376e9941f3 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sun, 1 Feb 2015 23:32:34 +0100 Subject: [ClickAndLoad] Improve --- module/plugins/hooks/ClickAndLoad.py | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py index 94a240d4c..7ece12781 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickAndLoad.py @@ -20,24 +20,13 @@ def forward(source, destination): #: socket.create_connection wrapper for python 2.5 def create_connection(address, timeout=object(), source_address=None): - try: - return socket.create_connection(address, - socket._GLOBAL_DEFAULT_TIMEOUT if type(timeout) == object else timeout, - source_address) - - except SyntaxError: - """Connect to *address* and return the socket object. - - Convenience function. Connect to *address* (a 2-tuple ``(host, - port)``) and return the socket object. Passing the optional - *timeout* parameter will set the timeout on the socket instance - before attempting to connect. If no *timeout* is supplied, the - global default timeout setting returned by :func:`getdefaulttimeout` - is used. If *source_address* is set it must be a tuple of (host, port) - for the socket to bind as a source address before making the connection. - An host of \'\' or port 0 tells the OS to use the default. - """ + if hasattr(socket, 'create_connection'): + if type(timeout) == object: + timeout = socket._GLOBAL_DEFAULT_TIMEOUT + return socket.create_connection(address, timeout, source_address) + + else: host, port = address err = None for res in getaddrinfo(host, port, 0, SOCK_STREAM): @@ -66,7 +55,7 @@ def create_connection(address, timeout=object(), source_address=None): class ClickAndLoad(Hook): __name__ = "ClickAndLoad" __type__ = "hook" - __version__ = "0.31" + __version__ = "0.32" __config__ = [("activated", "bool", "Activated" , True ), ("port" , "int" , "Port" , 9666 ), @@ -114,6 +103,7 @@ class ClickAndLoad(Hook): except socket.error, e: self.logError(e) + self.server(ip, webport, cnlport) finally: dock_socket.close() -- cgit v1.2.3 From e265a18ec18c4260531f977c98ebb13d2074380b Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Mon, 2 Feb 2015 00:33:17 +0100 Subject: [JustPremium] Cleanup --- module/plugins/hooks/JustPremium.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/JustPremium.py b/module/plugins/hooks/JustPremium.py index 99af95e38..b70d8dd2c 100644 --- a/module/plugins/hooks/JustPremium.py +++ b/module/plugins/hooks/JustPremium.py @@ -8,7 +8,7 @@ from module.plugins.Hook import Hook class JustPremium(Hook): __name__ = "JustPremium" __type__ = "hook" - __version__ = "0.20" + __version__ = "0.21" __config__ = [("excluded", "str", "Exclude hosters (comma separated)", "")] @@ -23,18 +23,23 @@ class JustPremium(Hook): def linksAdded(self, links, pid): - linkdict = self.core.api.checkURLs(links) - premiumplugins = set(account.type for account in self.core.api.getAccounts(False) if account.valid and account.premium) - multihoster = set(hoster for hoster in self.core.pluginManager.hosterPlugins if 'new_name' in self.core.pluginManager.hosterPlugins[hoster]) - + hosterdict = self.core.pluginManager.hosterPlugins + linkdict = self.core.api.checkURLs(links) + + premiumplugins = set(account.type for account in self.core.api.getAccounts(False) \ + if account.valid and account.premium) + multihosters = set(hoster for hoster in self.core.pluginManager.hosterPlugins \ + if 'new_name' in hosterdict[hoster] \ + and hosterdict[hoster]['new_name'] in premiumplugins) + #: Found at least one hoster with account or multihoster - if not any(True for pluginname in linkdict if pluginname in premiumplugins | multihoster): + if not any(True for pluginname in linkdict if pluginname in premiumplugins | multihosters): return excluded = map(lambda domain: "".join(part.capitalize() for part in re.split(r'(\.|\d+)', domain) if part != '.'), self.getConfig('excluded').replace(' ', '').replace(',', '|').replace(';', '|').split('|')) - for pluginname in set(linkdict.keys()) - (premiumplugins | set(excluded) | multihoster): + for pluginname in set(linkdict.keys()) - (premiumplugins | multihosters).union(excluded): self.logInfo(_("Remove links of plugin: %s") % pluginname) for link in linkdict[pluginname]: self.logDebug("Remove link: %s" % link) -- cgit v1.2.3 From 60394c74c92775303094a1069917d53169ab2fcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6rnlein?= <jens.hoernlein@googlemail.com> Date: Mon, 2 Feb 2015 00:36:37 +0100 Subject: Captcha9Kw should be initialized activated false --- module/plugins/hooks/Captcha9Kw.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/Captcha9Kw.py b/module/plugins/hooks/Captcha9Kw.py index 342f3fee8..1031ef224 100644 --- a/module/plugins/hooks/Captcha9Kw.py +++ b/module/plugins/hooks/Captcha9Kw.py @@ -16,10 +16,9 @@ from module.plugins.Hook import Hook, threaded class Captcha9Kw(Hook): __name__ = "Captcha9Kw" __type__ = "hook" - __version__ = "0.27" + __version__ = "0.28" - __config__ = [("activated" , "bool" , "Activated" , True ), - ("ssl" , "bool" , "Use HTTPS" , True ), + __config__ = [("ssl" , "bool" , "Use HTTPS" , True ), ("force" , "bool" , "Force captcha resolving even if client is connected" , True ), ("confirm" , "bool" , "Confirm Captcha (cost +6 credits)" , False ), ("captchaperhour", "int" , "Captcha per hour" , "9999" ), -- cgit v1.2.3 From 8dfb7adc0fc3c858c0ddf9371c2f4580bb8be3c7 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Tue, 3 Feb 2015 00:10:11 +0100 Subject: Update Extractor (3) --- module/plugins/hooks/ExtractArchive.py | 74 +++++++++++++++++++++------------- 1 file changed, 46 insertions(+), 28 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index dd1a82a82..74dded9b7 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -51,6 +51,7 @@ if os.name != "nt": from module.plugins.Hook import Hook, threaded, Expose from module.plugins.internal.Extractor import ArchiveError, CRCError, PasswordError +from module.plugins.internal.SimpleHoster import replace_patterns from module.utils import fs_encode, save_join, uniqify @@ -94,7 +95,7 @@ class ArchiveQueue(object): try: queue.remove(item) except ValueError: - pass + pass return self.set(queue) @@ -102,7 +103,7 @@ class ArchiveQueue(object): class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.22" + __version__ = "1.23" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract with full paths" , True ), @@ -127,48 +128,55 @@ class ExtractArchive(Hook): event_list = ["allDownloadsProcessed"] + NAME_REPLACEMENTS = [(r'\.part\d+\.rar$', ".part.rar")] + #@TODO: Remove in 0.4.10 def initPeriodical(self): pass - def coreReady(self): - self.extracting = False - - def setup(self): self.queue = ArchiveQueue(self, "Queue") self.failed = ArchiveQueue(self, "Failed") self.interval = 300 + self.extracting = False self.extractors = [] self.passwords = [] - names = [] + + def coreReady(self): + # self.extracting = False + for p in ("UnRar", "SevenZip", "UnZip"): try: module = self.core.pluginManager.loadModule("internal", p) klass = getattr(module, p) if klass.isUsable(): - names.append(p) self.extractors.append(klass) except OSError, e: if e.errno == 2: self.logInfo(_("No %s installed") % p) else: - self.logWarning(_("Could not activate %s") % p, e) + self.logWarning(_("Could not activate: %s") % p, e) if self.core.debug: print_exc() except Exception, e: - self.logWarning(_("Could not activate %s") % p, e) + self.logWarning(_("Could not activate: %s") % p, e) if self.core.debug: print_exc() - if names: - self.logInfo(_("Activated") + " " + " ".join(names)) + if self.extractors: + self.logInfo(_("Activated") + " " + " ".join(Extractor.__name__ for Extractor in self.extractors)) + + if self.getConfig("waitall"): + self.extractPackage(*self.queue.get()) #: Resume unfinished extractions + else: + super(ExtractArchive, self).initPeriodical() + else: self.logInfo(_("No Extract plugins activated")) @@ -185,11 +193,7 @@ class ExtractArchive(Hook): def packageFinished(self, pypack): - if self.extracting or self.getConfig("waitall"): - self.logInfo(_("Package %s queued for later extracting") % pypack.name) - self.queue.add(pypack.id) - else: - self.extractPackage(pypack.id) + self.queue.add(pypack.id) @threaded @@ -201,6 +205,8 @@ class ExtractArchive(Hook): def extract(self, ids): + self.extracting = True + processed = [] extracted = [] failed = [] @@ -267,16 +273,19 @@ class ExtractArchive(Hook): for fname, fid in targets: name = os.path.basename(fname) - if fname in processed: - self.logDebug(name, "Skipped") + if not os.path.exists(fname): + self.logDebug(name, "File not found") continue - processed.append(fname) # prevent extracting same file twice + pname = replace_patterns(fname, self.NAME_REPLACEMENTS) + if pname not in processed: + processed.append(pname) #: prevent extracting same file twice + else: + self.logDebug(name, "Skipped") + continue self.logInfo(name, _("Extract to: %s") % out) try: - self.extracting = True - archive = Extractor(self, fname, out, @@ -339,11 +348,9 @@ class ExtractArchive(Hook): pyfile = self.core.files.getFile(fid) name = os.path.basename(archive.filename) - pyfile.setCustomStatus(_("extracting")) - pyfile.setProgress(0) + pyfile.setStatus("processing") encrypted = False - try: try: archive.check() @@ -354,8 +361,14 @@ class ExtractArchive(Hook): if self.getConfig("repair"): self.logWarning(name, _("Repairing...")) + + pyfile.setCustomStatus(_("repairing")) + pyfile.setProgress(0) + repaired = archive.repair() + pyfile.setProgress(100) + if not repaired and not self.getConfig("keepbroken"): raise CRCError("Archive damaged") @@ -368,13 +381,18 @@ class ExtractArchive(Hook): self.logDebug("Password: %s" % (password or "No provided")) + pyfile.setCustomStatus(_("extracting")) + pyfile.setProgress(0) + if not encrypted or not self.getConfig("usepasswordfile"): archive.extract(password) else: for pw in set(self.getPasswords(False) + [password]): try: self.logDebug("Try password: %s" % pw) - if archive.isPassword(pw): + + ispw = archive.isPassword(pw) + if ispw or ispw is None: archive.extract(pw) self.addPassword(pw) break @@ -385,7 +403,7 @@ class ExtractArchive(Hook): raise PasswordError pyfile.setProgress(100) - pyfile.setStatus("processing") + pyfile.setCustomStatus(_("finalizing")) if self.core.debug: self.logDebug("Would delete: %s" % ", ".join(archive.getDeleteFiles())) @@ -402,7 +420,7 @@ class ExtractArchive(Hook): self.logInfo(name, _("Extracting finished")) - extracted_files = archive.getExtractedFiles() + extracted_files = archive.files or archive.list() self.manager.dispatchEvent("archive_extracted", pyfile, archive.out, archive.filename, extracted_files) return extracted_files -- cgit v1.2.3 From 65c83f937b3a8f819d89cae9204ac12cb6ba1deb Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Tue, 3 Feb 2015 00:20:00 +0100 Subject: [Checksum] Retrieve hashsum from self.info --- module/plugins/hooks/Checksum.py | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index 8d9f8f981..064375a41 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -40,7 +40,7 @@ def computeChecksum(local_file, algorithm): class Checksum(Hook): __name__ = "Checksum" __type__ = "hook" - __version__ = "0.15" + __version__ = "0.16" __config__ = [("check_checksum", "bool", "Check checksum? (If False only size will be verified)", True), ("check_action", "fail;retry;nothing", "What to do if check fails?", "retry"), @@ -55,10 +55,12 @@ class Checksum(Hook): ("stickell", "l.stickell@yahoo.it")] - methods = {'sfv': 'crc32', 'crc': 'crc32', 'hash': 'md5'} - regexps = {'sfv': r'^(?P<NAME>[^;].+)\s+(?P<HASH>[0-9A-Fa-f]{8})$', - 'md5': r'^(?P<NAME>[0-9A-Fa-f]{32}) (?P<FILE>.+)$', - 'crc': r'filename=(?P<NAME>.+)\nsize=(?P<SIZE>\d+)\ncrc32=(?P<HASH>[0-9A-Fa-f]{8})$', + methods = {'sfv' : 'crc32', + 'crc' : 'crc32', + 'hash': 'md5'} + regexps = {'sfv' : r'^(?P<NAME>[^;].+)\s+(?P<HASH>[0-9A-Fa-f]{8})$', + 'md5' : r'^(?P<NAME>[0-9A-Fa-f]{32}) (?P<FILE>.+)$', + 'crc' : r'filename=(?P<NAME>.+)\nsize=(?P<SIZE>\d+)\ncrc32=(?P<HASH>[0-9A-Fa-f]{8})$', 'default': r'^(?P<HASH>[0-9A-Fa-f]+)\s+\*?(?P<NAME>.+)$'} @@ -92,8 +94,9 @@ class Checksum(Hook): elif hasattr(pyfile.plugin, "api_data") and isinstance(pyfile.plugin.api_data, dict): data = pyfile.plugin.api_data.copy() - # elif hasattr(pyfile.plugin, "info") and isinstance(pyfile.plugin.info, dict): - # data = pyfile.plugin.info.copy() + elif hasattr(pyfile.plugin, "info") and isinstance(pyfile.plugin.info, dict): + data = pyfile.plugin.info.copy() + data.pop('size', None) #@NOTE: Don't check file size until a similary matcher will be implemented else: return @@ -110,19 +113,25 @@ class Checksum(Hook): if not isfile(local_file): self.checkFailed(pyfile, None, "File does not exist") - # validate file size + # validate file size if "size" in data: - api_size = int(data['size']) + api_size = int(data['size']) file_size = getsize(local_file) + if api_size != file_size: self.logWarning(_("File %s has incorrect size: %d B (%d expected)") % (pyfile.name, file_size, api_size)) self.checkFailed(pyfile, local_file, "Incorrect file size") - del data['size'] + + data.pop('size', None) # validate checksum if data and self.getConfig("check_checksum"): - if "checksum" in data: - data['md5'] = data['checksum'] + + if not 'md5' in data: + for type in ("checksum", "hashsum", "hash"): + if type in data: + data['md5'] = data[type] #@NOTE: What happens if it's not an md5 hash? + break for key in self.algorithms: if key in data: -- cgit v1.2.3 From 4722e1f6a0c5978617de52e1ec4611e5d6067142 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Tue, 3 Feb 2015 00:22:10 +0100 Subject: Use method pop to remove item from dict --- module/plugins/hooks/XFileSharingPro.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py index 9435d35d9..a1ee7f5ef 100644 --- a/module/plugins/hooks/XFileSharingPro.py +++ b/module/plugins/hooks/XFileSharingPro.py @@ -112,11 +112,11 @@ class XFileSharingPro(Hook): hdict = self.core.pluginManager.hosterPlugins[hoster] if "new_name" in hdict and hdict['new_name'] == "XFileSharingPro": if "module" in hdict: - del hdict['module'] + hdict.pop('module', None) if "new_module" in hdict: - del hdict['new_module'] - del hdict['new_name'] + hdict.pop('new_module', None) + hdict.pop('new_name', None) return True else: -- cgit v1.2.3 From 8d8cfd57fa44cb84eb9709871bf14a3b4d13d994 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Tue, 3 Feb 2015 01:10:04 +0100 Subject: Update Extractor (4) --- module/plugins/hooks/ExtractArchive.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 74dded9b7..47325608d 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -103,7 +103,7 @@ class ArchiveQueue(object): class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.23" + __version__ = "1.24" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract with full paths" , True ), @@ -205,6 +205,9 @@ class ExtractArchive(Hook): def extract(self, ids): + if not ids: + return False + self.extracting = True processed = [] @@ -226,7 +229,7 @@ class ExtractArchive(Hook): excludefiles = toList(self.getConfig("excludefiles")) if extensions: - self.logDebug("Extensions: %s" % "|.".join(extensions)) + self.logDebug("Use for extensions: %s" % "|.".join(extensions)) # reload from txt file self.reloadPasswords() @@ -462,7 +465,7 @@ class ExtractArchive(Hook): file = fs_encode(self.getConfig("passwordfile")) with open(file) as f: - for pw in f.read().splitlines(): + for pw in f.read().splitlines()[:-1]: passwords.append(pw) except IOError, e: -- cgit v1.2.3 From f6295ec0a2e6a819977afa66bbed3da15017c700 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Tue, 3 Feb 2015 02:37:17 +0100 Subject: [ClickAndLoad] Fix https://github.com/pyload/pyload/issues/1135 --- module/plugins/hooks/ClickAndLoad.py | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py index 7ece12781..0bcd6ddef 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickAndLoad.py @@ -9,13 +9,14 @@ from module.plugins.Hook import Hook, threaded def forward(source, destination): - string = ' ' - while string: - string = source.recv(1024) - if string: - destination.sendall(string) - else: - destination.shutdown(socket.SHUT_WR) + try: + size = 1024 + data = source.recv(size) + while data: + destination.sendall(data) + data = source.recv(size) + finally: + destination.shutdown(socket.SHUT_WR) #: socket.create_connection wrapper for python 2.5 @@ -55,7 +56,7 @@ def create_connection(address, timeout=object(), source_address=None): class ClickAndLoad(Hook): __name__ = "ClickAndLoad" __type__ = "hook" - __version__ = "0.32" + __version__ = "0.33" __config__ = [("activated", "bool", "Activated" , True ), ("port" , "int" , "Port" , 9666 ), @@ -89,21 +90,21 @@ class ClickAndLoad(Hook): def server(self, ip, webport, cnlport): try: dock_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - - dock_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) dock_socket.bind((ip, cnlport)) dock_socket.listen(5) while True: - server_socket = dock_socket.accept()[0] - client_socket = create_connection(("127.0.0.1", webport)) + client_socket = dock_socket.accept()[0] + server_socket = create_connection(("127.0.0.1", webport)) - self.manager.startThread(forward, server_socket, client_socket) self.manager.startThread(forward, client_socket, server_socket) + self.manager.startThread(forward, server_socket, client_socket) except socket.error, e: - self.logError(e) + self.logDebug(e) self.server(ip, webport, cnlport) finally: + client_socket.close() + server_socket.close() dock_socket.close() -- cgit v1.2.3 From 896f1f1437442bb9a93a0664f3d447bbc0f444cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6rnlein?= <jens.hoernlein@googlemail.com> Date: Wed, 4 Feb 2015 00:02:27 +0100 Subject: Addressed some Extractor Issues --- module/plugins/hooks/ExtractArchive.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 47325608d..e1c05878c 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -103,7 +103,7 @@ class ArchiveQueue(object): class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.24" + __version__ = "1.25" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract with full paths" , True ), @@ -312,7 +312,7 @@ class ExtractArchive(Hook): self.setPermissions(new_files) for filename in new_files: - file = fs_encode(filename) + file = fs_encode(save_join(filename, os.path.dirname(archive.filename))) if not os.path.exists(file): self.logDebug("New file %s does not exists" % filename) continue @@ -390,7 +390,7 @@ class ExtractArchive(Hook): if not encrypted or not self.getConfig("usepasswordfile"): archive.extract(password) else: - for pw in set(self.getPasswords(False) + [password]): + for pw in uniqify([password] + self.getPasswords(False)): try: self.logDebug("Try password: %s" % pw) @@ -465,7 +465,7 @@ class ExtractArchive(Hook): file = fs_encode(self.getConfig("passwordfile")) with open(file) as f: - for pw in f.read().splitlines()[:-1]: + for pw in f.read().splitlines(): passwords.append(pw) except IOError, e: -- cgit v1.2.3 From 0df373e5da9d33e4dea3e709521d4883ef7f9b45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6rnlein?= <jens.hoernlein@googlemail.com> Date: Wed, 4 Feb 2015 20:41:03 +0100 Subject: [Unrar] Fix: Deleting All Files after Extraction --- module/plugins/hooks/ExtractArchive.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index e1c05878c..e1d6dff59 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -276,16 +276,16 @@ class ExtractArchive(Hook): for fname, fid in targets: name = os.path.basename(fname) - if not os.path.exists(fname): - self.logDebug(name, "File not found") - continue - pname = replace_patterns(fname, self.NAME_REPLACEMENTS) if pname not in processed: processed.append(pname) #: prevent extracting same file twice else: self.logDebug(name, "Skipped") continue + + if not os.path.exists(fname): + self.logDebug(name, "File not found") + continue self.logInfo(name, _("Extract to: %s") % out) try: -- cgit v1.2.3 From c1268bbbe35ebd8d5308051c169160257ad14c6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6rnlein?= <jens.hoernlein@googlemail.com> Date: Wed, 4 Feb 2015 23:14:12 +0100 Subject: [ExtractArchive] fixed Queue Get --- module/plugins/hooks/ExtractArchive.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index e1d6dff59..6e6a6862c 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -63,7 +63,7 @@ class ArchiveQueue(object): def get(self): - return self.plugin.getStorage("ExtractArchive:%s" % self.storage, "").decode('base64').split() + return [int(pid) for pid in self.plugin.getStorage("ExtractArchive:%s" % self.storage, "").decode('base64').split()] def set(self, value): -- cgit v1.2.3 From 39e87e03709b663086c96309bd6ebb3e2dc16afc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6rnlein?= <jens.hoernlein@googlemail.com> Date: Thu, 5 Feb 2015 00:24:08 +0100 Subject: set interval smaller --- module/plugins/hooks/ExtractArchive.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 6e6a6862c..b52fa026b 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -140,7 +140,7 @@ class ExtractArchive(Hook): self.queue = ArchiveQueue(self, "Queue") self.failed = ArchiveQueue(self, "Failed") - self.interval = 300 + self.interval = 60 self.extracting = False self.extractors = [] self.passwords = [] -- cgit v1.2.3 From eac9718c284330ca759d09661b98e070351d80ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6rnlein?= <jens.hoernlein@googlemail.com> Date: Thu, 5 Feb 2015 00:26:25 +0100 Subject: [RestartSlow] Fixed AttributeError --- module/plugins/hooks/RestartSlow.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/RestartSlow.py b/module/plugins/hooks/RestartSlow.py index c2fdf6f95..9a0b43b1a 100644 --- a/module/plugins/hooks/RestartSlow.py +++ b/module/plugins/hooks/RestartSlow.py @@ -33,7 +33,7 @@ class RestartSlow(Hook): def periodical(self): - if not self.pyfile.req.dl: + if not self.pyfile.plugin.req.dl: return if self.getConfig("safe_mode") and not self.pyfile.plugin.resumeDownload: @@ -44,7 +44,7 @@ class RestartSlow(Hook): time = max(30, self.getConfig("%s_time" % type) * 60) limit = max(5, self.getConfig("%s_limit" % type) * 1024) - chunks = [chunk for chunk in self.pyfile.req.dl.chunks \ + chunks = [chunk for chunk in self.pyfile.plugin.req.dl.chunks \ if chunk.id not in self.info['chunk'] or self.info['chunk'][chunk.id] is not (time, limit)] for chunk in chunks: @@ -57,5 +57,5 @@ class RestartSlow(Hook): def downloadStarts(self, pyfile, url, filename): if self.cb or (self.getConfig("safe_mode") and not pyfile.plugin.resumeDownload): return - + self.pyfile = pyfile super(RestartSlow, self).initPeriodical() -- cgit v1.2.3 From 09b692852ae556cb3f40ffb3f607106faecd5758 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6rnlein?= <jens.hoernlein@googlemail.com> Date: Thu, 5 Feb 2015 18:41:59 +0100 Subject: [ExtractArchive] Error Handling when broken ExtractArchive was used --- module/plugins/hooks/ExtractArchive.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index b52fa026b..4756d359c 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -63,7 +63,10 @@ class ArchiveQueue(object): def get(self): - return [int(pid) for pid in self.plugin.getStorage("ExtractArchive:%s" % self.storage, "").decode('base64').split()] + try: + return [int(pid) for pid in self.plugin.getStorage("ExtractArchive:%s" % self.storage, "").decode('base64').split()] + except Exception: + return [] def set(self, value): -- cgit v1.2.3 From 767cf1ccb4420e7cb1805bfe302b8909def79679 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6rnlein?= <jens.hoernlein@googlemail.com> Date: Fri, 6 Feb 2015 21:52:10 +0100 Subject: [ExtractArchive] Fixed: Recursive Extraction --- module/plugins/hooks/ExtractArchive.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 4756d359c..e27c544d6 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -77,10 +77,6 @@ class ArchiveQueue(object): return self.plugin.setStorage("ExtractArchive:%s" % self.storage, item.encode('base64')[:-1]) - def clean(self): - return self.set([]) - - def delete(self): return self.plugin.delStorage("ExtractArchive:%s" % self.storage) @@ -99,6 +95,8 @@ class ArchiveQueue(object): queue.remove(item) except ValueError: pass + if queue == []: + return self.delete() return self.set(queue) @@ -315,7 +313,7 @@ class ExtractArchive(Hook): self.setPermissions(new_files) for filename in new_files: - file = fs_encode(save_join(filename, os.path.dirname(archive.filename))) + file = fs_encode(save_join(os.path.dirname(archive.filename), filename)) if not os.path.exists(file): self.logDebug("New file %s does not exists" % filename) continue -- cgit v1.2.3 From d08c34cb6289ef55c6412d6129e343380f7f20d1 Mon Sep 17 00:00:00 2001 From: stickell <l.stickell@yahoo.it> Date: Sat, 7 Feb 2015 00:03:28 +0100 Subject: [ExtractArchive] bump version number after #1152 --- module/plugins/hooks/ExtractArchive.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index e27c544d6..88036da39 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -104,7 +104,7 @@ class ArchiveQueue(object): class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.25" + __version__ = "1.26" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract with full paths" , True ), -- cgit v1.2.3 From 23b49f52109942bd8cc121818d054ea134c63e64 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sat, 7 Feb 2015 23:24:13 +0100 Subject: [RestartSlow] Bump up version --- module/plugins/hooks/RestartSlow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/RestartSlow.py b/module/plugins/hooks/RestartSlow.py index 9a0b43b1a..c3e1e5468 100644 --- a/module/plugins/hooks/RestartSlow.py +++ b/module/plugins/hooks/RestartSlow.py @@ -8,7 +8,7 @@ from module.plugins.Hook import Hook class RestartSlow(Hook): __name__ = "RestartSlow" __type__ = "hook" - __version__ = "0.03" + __version__ = "0.04" __config__ = [("free_limit" , "int" , "Transfer speed threshold in kilobytes" , 100 ), ("free_time" , "int" , "Sample interval in minutes" , 5 ), -- cgit v1.2.3 From b25bc61dd47d8d3c42969bd0f72443b21c4b059e Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sun, 8 Feb 2015 02:09:45 +0100 Subject: Spare code cosmetics --- module/plugins/hooks/AlldebridCom.py | 4 ++-- module/plugins/hooks/Captcha9Kw.py | 6 +++--- module/plugins/hooks/EasybytezCom.py | 4 ++-- module/plugins/hooks/FastixRu.py | 4 ++-- module/plugins/hooks/IRCInterface.py | 4 ++-- module/plugins/hooks/MultishareCz.py | 4 ++-- module/plugins/hooks/OverLoadMe.py | 6 +++--- module/plugins/hooks/PremiumTo.py | 4 ++-- module/plugins/hooks/RealdebridCom.py | 4 ++-- module/plugins/hooks/RehostTo.py | 4 ++-- module/plugins/hooks/SimplydebridCom.py | 4 ++-- 11 files changed, 24 insertions(+), 24 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/AlldebridCom.py b/module/plugins/hooks/AlldebridCom.py index dddd97c0c..fd89571eb 100644 --- a/module/plugins/hooks/AlldebridCom.py +++ b/module/plugins/hooks/AlldebridCom.py @@ -24,6 +24,6 @@ class AlldebridCom(MultiHook): def getHosters(self): https = "https" if self.getConfig("ssl") else "http" - page = self.getURL(https + "://www.alldebrid.com/api.php", get={'action': "get_host"}).replace("\"", "").strip() + html = self.getURL(https + "://www.alldebrid.com/api.php", get={'action': "get_host"}).replace("\"", "").strip() - return [x.strip() for x in page.split(",") if x.strip()] + return [x.strip() for x in html.split(",") if x.strip()] diff --git a/module/plugins/hooks/Captcha9Kw.py b/module/plugins/hooks/Captcha9Kw.py index 1031ef224..544965b0f 100644 --- a/module/plugins/hooks/Captcha9Kw.py +++ b/module/plugins/hooks/Captcha9Kw.py @@ -206,9 +206,9 @@ class Captcha9Kw(Hook): for d in details: hosteroption = d.split("=") - if (len(hosteroption) > 1 - and hosteroption[0].lower() == 'timeout' - and hosteroption[1].isdigit()): + if len(hosteroption) > 1 \ + and hosteroption[0].lower() == 'timeout' \ + and hosteroption[1].isdigit(): timeout = int(hosteroption[1]) break diff --git a/module/plugins/hooks/EasybytezCom.py b/module/plugins/hooks/EasybytezCom.py index e08127514..85c616054 100644 --- a/module/plugins/hooks/EasybytezCom.py +++ b/module/plugins/hooks/EasybytezCom.py @@ -27,6 +27,6 @@ class EasybytezCom(MultiHook): user, data = self.account.selectAccount() req = self.account.getAccountRequest(user) - page = req.load("http://www.easybytez.com") + html = req.load("http://www.easybytez.com") - return re.search(r'</textarea>\s*Supported sites:(.*)', page).group(1).split(',') + return re.search(r'</textarea>\s*Supported sites:(.*)', html).group(1).split(',') diff --git a/module/plugins/hooks/FastixRu.py b/module/plugins/hooks/FastixRu.py index 25126fbd3..6373da8d9 100644 --- a/module/plugins/hooks/FastixRu.py +++ b/module/plugins/hooks/FastixRu.py @@ -23,9 +23,9 @@ class FastixRu(MultiHook): def getHosters(self): - page = self.getURL("http://fastix.ru/api_v2", + html = self.getURL("http://fastix.ru/api_v2", get={'apikey': "5182964c3f8f9a7f0b00000a_kelmFB4n1IrnCDYuIFn2y", 'sub' : "allowed_sources"}) - host_list = json_loads(page) + host_list = json_loads(html) host_list = host_list['allow'] return host_list diff --git a/module/plugins/hooks/IRCInterface.py b/module/plugins/hooks/IRCInterface.py index 98fa1d030..623f2d1bf 100644 --- a/module/plugins/hooks/IRCInterface.py +++ b/module/plugins/hooks/IRCInterface.py @@ -79,10 +79,10 @@ class IRCInterface(Thread, Hook): task.handler.append(self) task.setWaiting(60) - page = getURL("http://www.freeimagehosting.net/upload.php", + html = getURL("http://www.freeimagehosting.net/upload.php", post={"attached": (FORM_FILE, task.captchaFile)}, multipart=True) - url = re.search(r"\[img\]([^\[]+)\[/img\]\[/url\]", page).group(1) + url = re.search(r"\[img\]([^\[]+)\[/img\]\[/url\]", html).group(1) self.response(_("New Captcha Request: %s") % url) self.response(_("Answer with 'c %s text on the captcha'") % task.id) diff --git a/module/plugins/hooks/MultishareCz.py b/module/plugins/hooks/MultishareCz.py index 8349e0de8..d02f4f8e3 100644 --- a/module/plugins/hooks/MultishareCz.py +++ b/module/plugins/hooks/MultishareCz.py @@ -27,5 +27,5 @@ class MultishareCz(MultiHook): def getHosters(self): - page = self.getURL("http://www.multishare.cz/monitoring/") - return re.findall(self.HOSTER_PATTERN, page) + html = self.getURL("http://www.multishare.cz/monitoring/") + return re.findall(self.HOSTER_PATTERN, html) diff --git a/module/plugins/hooks/OverLoadMe.py b/module/plugins/hooks/OverLoadMe.py index 1872f8ccb..b15ce2766 100644 --- a/module/plugins/hooks/OverLoadMe.py +++ b/module/plugins/hooks/OverLoadMe.py @@ -24,8 +24,8 @@ class OverLoadMe(MultiHook): def getHosters(self): https = "https" if self.getConfig("ssl") else "http" - page = self.getURL(https + "://api.over-load.me/hoster.php", + html = self.getURL(https + "://api.over-load.me/hoster.php", get={'auth': "0001-cb1f24dadb3aa487bda5afd3b76298935329be7700cd7-5329be77-00cf-1ca0135f"}).replace("\"", "").strip() - self.logDebug("Hosterlist", page) + self.logDebug("Hosterlist", html) - return [x.strip() for x in page.split(",") if x.strip()] + return [x.strip() for x in html.split(",") if x.strip()] diff --git a/module/plugins/hooks/PremiumTo.py b/module/plugins/hooks/PremiumTo.py index 844ecc89d..b629b111e 100644 --- a/module/plugins/hooks/PremiumTo.py +++ b/module/plugins/hooks/PremiumTo.py @@ -24,6 +24,6 @@ class PremiumTo(MultiHook): def getHosters(self): - page = self.getURL("http://premium.to/api/hosters.php", + html = self.getURL("http://premium.to/api/hosters.php", get={'username': self.account.username, 'password': self.account.password}) - return [x.strip() for x in page.replace("\"", "").split(";")] + return [x.strip() for x in html.replace("\"", "").split(";")] diff --git a/module/plugins/hooks/RealdebridCom.py b/module/plugins/hooks/RealdebridCom.py index cff97c2f9..d9c9407dd 100644 --- a/module/plugins/hooks/RealdebridCom.py +++ b/module/plugins/hooks/RealdebridCom.py @@ -24,6 +24,6 @@ class RealdebridCom(MultiHook): def getHosters(self): https = "https" if self.getConfig("ssl") else "http" - page = self.getURL(https + "://real-debrid.com/api/hosters.php").replace("\"", "").strip() + html = self.getURL(https + "://real-debrid.com/api/hosters.php").replace("\"", "").strip() - return [x.strip() for x in page.split(",") if x.strip()] + return [x.strip() for x in html.split(",") if x.strip()] diff --git a/module/plugins/hooks/RehostTo.py b/module/plugins/hooks/RehostTo.py index ddb8b3eb0..845601c3f 100644 --- a/module/plugins/hooks/RehostTo.py +++ b/module/plugins/hooks/RehostTo.py @@ -23,7 +23,7 @@ class RehostTo(MultiHook): def getHosters(self): user, data = self.account.selectAccount() - page = self.getURL("http://rehost.to/api.php", + html = self.getURL("http://rehost.to/api.php", get={'cmd' : "get_supported_och_dl", 'long_ses': self.account.getAccountInfo(user)['session']}) - return [x.strip() for x in page.replace("\"", "").split(",")] + return [x.strip() for x in html.replace("\"", "").split(",")] diff --git a/module/plugins/hooks/SimplydebridCom.py b/module/plugins/hooks/SimplydebridCom.py index 10c613fb5..4d27f5ae4 100644 --- a/module/plugins/hooks/SimplydebridCom.py +++ b/module/plugins/hooks/SimplydebridCom.py @@ -22,5 +22,5 @@ class SimplydebridCom(MultiHook): def getHosters(self): - page = self.getURL("http://simply-debrid.com/api.php", get={'list': 1}) - return [x.strip() for x in page.rstrip(';').replace("\"", "").split(";")] + html = self.getURL("http://simply-debrid.com/api.php", get={'list': 1}) + return [x.strip() for x in html.rstrip(';').replace("\"", "").split(";")] -- cgit v1.2.3 From 3cea8ed5afb68060951cb20a6e07e3d0dca01e24 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sun, 8 Feb 2015 02:10:34 +0100 Subject: [ExternalScripts] Wait option --- module/plugins/hooks/ExternalScripts.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py index bbd442963..42f4ec481 100644 --- a/module/plugins/hooks/ExternalScripts.py +++ b/module/plugins/hooks/ExternalScripts.py @@ -12,9 +12,10 @@ from module.utils import save_join class ExternalScripts(Hook): __name__ = "ExternalScripts" __type__ = "hook" - __version__ = "0.27" + __version__ = "0.28" - __config__ = [("activated", "bool", "Activated", True)] + __config__ = [("activated", "bool", "Activated" , True), + ("wait" , "bool", "Wait script ending", True)] __description__ = """Run external scripts""" __license__ = "GPLv3" @@ -58,6 +59,7 @@ class ExternalScripts(Hook): if not os.path.exists(path): try: os.makedirs(path) + except Exception: self.logDebug("Script folder %s not created" % folder) return @@ -75,9 +77,13 @@ class ExternalScripts(Hook): def callScript(self, script, *args): try: cmd = [script] + [str(x) if not isinstance(x, basestring) else x for x in args] + self.logDebug("Executing", os.path.abspath(script), " ".join(cmd)) - #output goes to pyload - subprocess.Popen(cmd, bufsize=-1) + + p = subprocess.Popen(cmd, bufsize=-1) #@NOTE: output goes to pyload + if self.getConfig('wait'): + p.communicate() + except Exception, e: self.logError(_("Error in %(script)s: %(error)s") % {"script": os.path.basename(script), "error": e}) -- cgit v1.2.3 From 45295be158d77aa38e7803fbcd90d7ad4ddc7961 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sun, 8 Feb 2015 14:08:55 +0100 Subject: [ExternalScripts] Wait option (2) --- module/plugins/hooks/ExternalScripts.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py index 42f4ec481..8bd803308 100644 --- a/module/plugins/hooks/ExternalScripts.py +++ b/module/plugins/hooks/ExternalScripts.py @@ -12,10 +12,10 @@ from module.utils import save_join class ExternalScripts(Hook): __name__ = "ExternalScripts" __type__ = "hook" - __version__ = "0.28" + __version__ = "0.29" - __config__ = [("activated", "bool", "Activated" , True), - ("wait" , "bool", "Wait script ending", True)] + __config__ = [("activated", "bool", "Activated" , True ), + ("wait" , "bool", "Wait script ending", False)] __description__ = """Run external scripts""" __license__ = "GPLv3" -- cgit v1.2.3 From c5daf5fa18490ff5977f06416b14bf0474822974 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6rnlein?= <jens.hoernlein@googlemail.com> Date: Sat, 7 Feb 2015 03:08:28 +0100 Subject: [ExtractArchive] Fix: Show Status/Progressbar --- module/plugins/hooks/ExtractArchive.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 88036da39..81655b108 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -198,14 +198,14 @@ class ExtractArchive(Hook): @threaded - def allDownloadsProcessed(self): - if self.extract(self.queue.get()): #@NOTE: check only if all gone fine, no failed reporting for now + def allDownloadsProcessed(self, thread): + if self.extract(self.queue.get(), thread): #@NOTE: check only if all gone fine, no failed reporting for now self.manager.dispatchEvent("all_archives_extracted") self.manager.dispatchEvent("all_archives_processed") - def extract(self, ids): + def extract(self, ids, thread=None): if not ids: return False @@ -302,7 +302,7 @@ class ExtractArchive(Hook): fid) archive.init() - new_files = self._extract(archive, fid, pypack.password) + new_files = self._extract(archive, fid, pypack.password, thread) except Exception, e: self.logError(name, e) @@ -348,10 +348,11 @@ class ExtractArchive(Hook): return True if not failed else False - def _extract(self, archive, fid, password): + def _extract(self, archive, fid, password, thread): pyfile = self.core.files.getFile(fid) name = os.path.basename(archive.filename) + thread.addActive(pyfile) pyfile.setStatus("processing") encrypted = False -- cgit v1.2.3 From 2a809297f288a585d96af0d8afd894c2a2f695fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6rnlein?= <jens.hoernlein@googlemail.com> Date: Sun, 8 Feb 2015 13:47:59 +0100 Subject: [ExtractArchive] correct fullpath behavior, bugfix --- module/plugins/hooks/ExtractArchive.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 81655b108..6c0177ae9 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -104,7 +104,7 @@ class ArchiveQueue(object): class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.26" + __version__ = "1.27" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract with full paths" , True ), @@ -258,14 +258,14 @@ class ExtractArchive(Hook): matched = False success = True - files_ids = [(save_join(dl, pypack.folder, pylink['name']), pylink['id']) for pylink in pypack.getChildren().itervalues()] + files_ids = [(save_join(dl, pypack.folder, pylink['name']), pylink['id'], out) for pylink in pypack.getChildren().itervalues()] # check as long there are unseen files while files_ids: new_files_ids = [] if extensions: - files_ids = [(fname, fid) for fname, fid in files_ids \ + files_ids = [(fname, fid, fout) for fname, fid, fout in files_ids \ if filter(lambda ext: fname.lower().endswith(ext), extensions)] for Extractor in self.extractors: @@ -274,7 +274,7 @@ class ExtractArchive(Hook): self.logDebug("Targets for %s: %s" % (Extractor.__name__, targets)) matched = True - for fname, fid in targets: + for fname, fid, fout in targets: name = os.path.basename(fname) pname = replace_patterns(fname, self.NAME_REPLACEMENTS) @@ -283,16 +283,16 @@ class ExtractArchive(Hook): else: self.logDebug(name, "Skipped") continue - + if not os.path.exists(fname): self.logDebug(name, "File not found") continue - self.logInfo(name, _("Extract to: %s") % out) + self.logInfo(name, _("Extract to: %s") % fout) try: archive = Extractor(self, fname, - out, + fout, fullpath, overwrite, excludefiles, @@ -319,7 +319,7 @@ class ExtractArchive(Hook): continue if recursive and os.path.isfile(file): - new_files_ids.append((filename, fid)) # append as new target + new_files_ids.append((filename, fid, os.path.dirname(filename))) # append as new target files_ids = new_files_ids # also check extracted files -- cgit v1.2.3 From 25fc80b4e973049ff85122fefac9fbf8c2bf4c45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6rnlein?= <jens.hoernlein@googlemail.com> Date: Sun, 8 Feb 2015 17:03:27 +0100 Subject: [ExtractArchive] don't try '' as password --- module/plugins/hooks/ExtractArchive.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 6c0177ae9..a0c0ca366 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -104,7 +104,7 @@ class ArchiveQueue(object): class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.27" + __version__ = "1.28" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract with full paths" , True ), @@ -392,7 +392,7 @@ class ExtractArchive(Hook): if not encrypted or not self.getConfig("usepasswordfile"): archive.extract(password) else: - for pw in uniqify([password] + self.getPasswords(False)): + for pw in filter(None, uniqify([password] + self.getPasswords(False))): try: self.logDebug("Try password: %s" % pw) -- cgit v1.2.3 From 2dc3536e36956eab99fa5f7945dcf60073b5fd57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6rnlein?= <jens.hoernlein@googlemail.com> Date: Mon, 9 Feb 2015 23:36:10 +0100 Subject: [ExtractArchive] better Multipart behavior, new version output --- module/plugins/hooks/ExtractArchive.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index a0c0ca366..3ea8839dc 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -104,7 +104,7 @@ class ArchiveQueue(object): class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.28" + __version__ = "1.29" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract with full paths" , True ), @@ -124,7 +124,8 @@ class ExtractArchive(Hook): __description__ = """Extract different kind of archives""" __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + __authors__ = [("Walter Purcaro", "vuolter@gmail.com"), + ("Immenz" , "immenz@gmx.net" )] event_list = ["allDownloadsProcessed"] @@ -171,7 +172,7 @@ class ExtractArchive(Hook): print_exc() if self.extractors: - self.logInfo(_("Activated") + " " + " ".join(Extractor.__name__ for Extractor in self.extractors)) + self.logInfo(_("Activated") + " " + "|".join("%s %s" % (Extractor.__name__,Extractor.VERSION) for Extractor in self.extractors)) if self.getConfig("waitall"): self.extractPackage(*self.queue.get()) #: Resume unfinished extractions @@ -277,13 +278,6 @@ class ExtractArchive(Hook): for fname, fid, fout in targets: name = os.path.basename(fname) - pname = replace_patterns(fname, self.NAME_REPLACEMENTS) - if pname not in processed: - processed.append(pname) #: prevent extracting same file twice - else: - self.logDebug(name, "Skipped") - continue - if not os.path.exists(fname): self.logDebug(name, "File not found") continue @@ -309,6 +303,7 @@ class ExtractArchive(Hook): success = False continue + files_ids.remove((fname, fid, fout)) # don't let other extractors spam log self.logDebug("Extracted files: %s" % new_files) self.setPermissions(new_files) -- cgit v1.2.3 From e58ca4183db292918e4434b22739761185a74b8d Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Wed, 11 Feb 2015 04:26:40 +0100 Subject: [AndroidPhoneNotify][WindowsPhoneNotify] Don't use storage --- module/plugins/hooks/AndroidPhoneNotify.py | 9 +-- module/plugins/hooks/WindowsPhoneNotify.py | 96 +++++++++++++++++++++++++ module/plugins/hooks/WindowsPhoneToastNotify.py | 95 ------------------------ 3 files changed, 101 insertions(+), 99 deletions(-) create mode 100644 module/plugins/hooks/WindowsPhoneNotify.py delete mode 100644 module/plugins/hooks/WindowsPhoneToastNotify.py (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/AndroidPhoneNotify.py b/module/plugins/hooks/AndroidPhoneNotify.py index fbc2acd5c..d4536842d 100644 --- a/module/plugins/hooks/AndroidPhoneNotify.py +++ b/module/plugins/hooks/AndroidPhoneNotify.py @@ -9,7 +9,7 @@ from module.plugins.Hook import Hook class AndroidPhoneNotify(Hook): __name__ = "AndroidPhoneNotify" __type__ = "hook" - __version__ = "0.03" + __version__ = "0.04" __config__ = [("apikey" , "str" , "API key" , "" ), ("notifycaptcha" , "bool", "Notify captcha request" , True ), @@ -33,14 +33,15 @@ class AndroidPhoneNotify(Hook): def setup(self): - self.info = {} #@TODO: Remove in 0.4.10 + self.info = {} #@TODO: Remove in 0.4.10 + self.last_notify = 0 def newCaptchaTask(self, task): if not self.getConfig("notifycaptcha"): return False - if time() - float(self.getStorage("AndroidPhoneNotify", 0)) < self.getConf("timeout"): + if time() - self.last_notify < self.getConf("timeout"): return False self.notify(_("Captcha"), _("New request waiting user input")) @@ -76,4 +77,4 @@ class AndroidPhoneNotify(Hook): 'event' : event, 'description': msg}) - self.setStorage("AndroidPhoneNotify", time()) + self.last_notify = time() diff --git a/module/plugins/hooks/WindowsPhoneNotify.py b/module/plugins/hooks/WindowsPhoneNotify.py new file mode 100644 index 000000000..821b9643c --- /dev/null +++ b/module/plugins/hooks/WindowsPhoneNotify.py @@ -0,0 +1,96 @@ +# -*- coding: utf-8 -*- + +import httplib + +from time import time + +from module.plugins.Hook import Hook + + +class WindowsPhoneNotify(Hook): + __name__ = "WindowsPhoneNotify" + __type__ = "hook" + __version__ = "0.06" + + __config__ = [("id" , "str" , "Push ID" , "" ), + ("url" , "str" , "Push url" , "" ), + ("notifycaptcha" , "bool", "Notify captcha request" , True ), + ("notifypackage" , "bool", "Notify package finished" , True ), + ("notifyprocessed", "bool", "Notify processed packages status" , True ), + ("timeout" , "int" , "Timeout between captchas in seconds" , 5 ), + ("force" , "bool", "Send notifications if client is connected", False)] + + __description__ = """Send push notifications to Windows Phone""" + __license__ = "GPLv3" + __authors__ = [("Andy Voigt", "phone-support@hotmail.de"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + event_list = ["allDownloadsProcessed"] + + + #@TODO: Remove in 0.4.10 + def initPeriodical(self): + pass + + + def setup(self): + self.info = {} #@TODO: Remove in 0.4.10 + self.last_notify = 0 + + + def newCaptchaTask(self, task): + if not self.getConfig("notifycaptcha"): + return False + + if time() - self.last_notify < self.getConf("timeout"): + return False + + self.notify(_("Captcha"), _("New request waiting user input")) + + + def packageFinished(self, pypack): + if self.getConfig("notifypackage"): + self.notify(_("Package finished"), pypack.name) + + + def allDownloadsProcessed(self): + if not self.getConfig("notifyprocessed"): + return False + + if any(True for pdata in self.core.api.getQueue() if pdata.linksdone < pdata.linkstotal): + self.notify(_("Package failed"), _("One or more packages was not completed successfully")) + else: + self.notify(_("All packages finished")) + + + def getXmlData(self, msg): + return ("<?xml version='1.0' encoding='utf-8'?> <wp:Notification xmlns:wp='WPNotification'> " + "<wp:Toast> <wp:Text1>pyLoad</wp:Text1> <wp:Text2>%s</wp:Text2> " + "</wp:Toast> </wp:Notification>" % msg) + + + def notify(self, event, msg=""): + id = self.getConfig("id") + url = self.getConfig("url") + + if not id or not url: + return False + + if self.core.isClientConnected() and not self.getConfig("force"): + return False + + request = self.getXmlData("%s: %s" % (event, msg) if msg else event) + webservice = httplib.HTTP(url) + + webservice.putrequest("POST", id) + webservice.putheader("Host", url) + webservice.putheader("Content-type", "text/xml") + webservice.putheader("X-NotificationClass", "2") + webservice.putheader("X-WindowsPhone-Target", "toast") + webservice.putheader("Content-length", "%d" % len(request)) + webservice.endheaders() + webservice.send(request) + webservice.close() + + self.last_notify = time() diff --git a/module/plugins/hooks/WindowsPhoneToastNotify.py b/module/plugins/hooks/WindowsPhoneToastNotify.py deleted file mode 100644 index 20686ee36..000000000 --- a/module/plugins/hooks/WindowsPhoneToastNotify.py +++ /dev/null @@ -1,95 +0,0 @@ -# -*- coding: utf-8 -*- - -import httplib - -from time import time - -from module.plugins.Hook import Hook - - -class WindowsPhoneToastNotify(Hook): - __name__ = "WindowsPhoneToastNotify" - __type__ = "hook" - __version__ = "0.05" - - __config__ = [("id" , "str" , "Push ID" , "" ), - ("url" , "str" , "Push url" , "" ), - ("notifycaptcha" , "bool", "Notify captcha request" , True ), - ("notifypackage" , "bool", "Notify package finished" , True ), - ("notifyprocessed", "bool", "Notify processed packages status" , True ), - ("timeout" , "int" , "Timeout between captchas in seconds" , 5 ), - ("force" , "bool", "Send notifications if client is connected", False)] - - __description__ = """Send push notifications to Windows Phone""" - __license__ = "GPLv3" - __authors__ = [("Andy Voigt", "phone-support@hotmail.de"), - ("Walter Purcaro", "vuolter@gmail.com")] - - - event_list = ["allDownloadsProcessed"] - - - #@TODO: Remove in 0.4.10 - def initPeriodical(self): - pass - - - def setup(self): - self.info = {} #@TODO: Remove in 0.4.10 - - - def newCaptchaTask(self, task): - if not self.getConfig("notifycaptcha"): - return False - - if time() - float(self.getStorage("WindowsPhoneToastNotify", 0)) < self.getConf("timeout"): - return False - - self.notify(_("Captcha"), _("New request waiting user input")) - - - def packageFinished(self, pypack): - if self.getConfig("notifypackage"): - self.notify(_("Package finished"), pypack.name) - - - def allDownloadsProcessed(self): - if not self.getConfig("notifyprocessed"): - return False - - if any(True for pdata in self.core.api.getQueue() if pdata.linksdone < pdata.linkstotal): - self.notify(_("Package failed"), _("One or more packages was not completed successfully")) - else: - self.notify(_("All packages finished")) - - - def getXmlData(self, msg): - return ("<?xml version='1.0' encoding='utf-8'?> <wp:Notification xmlns:wp='WPNotification'> " - "<wp:Toast> <wp:Text1>pyLoad</wp:Text1> <wp:Text2>%s</wp:Text2> " - "</wp:Toast> </wp:Notification>" % msg) - - - def notify(self, event, msg=""): - id = self.getConfig("id") - url = self.getConfig("url") - - if not id or not url: - return False - - if self.core.isClientConnected() and not self.getConfig("force"): - return False - - request = self.getXmlData("%s: %s" % (event, msg) if msg else event) - webservice = httplib.HTTP(url) - - webservice.putrequest("POST", id) - webservice.putheader("Host", url) - webservice.putheader("Content-type", "text/xml") - webservice.putheader("X-NotificationClass", "2") - webservice.putheader("X-WindowsPhone-Target", "toast") - webservice.putheader("Content-length", "%d" % len(request)) - webservice.endheaders() - webservice.send(request) - webservice.close() - - self.setStorage("WindowsPhoneToastNotify", time()) -- cgit v1.2.3 From ee6746b16c8f56d24f48f55387fee799d8e28b4d Mon Sep 17 00:00:00 2001 From: Stefano <l.stickell@yahoo.it> Date: Wed, 11 Feb 2015 18:40:04 +0100 Subject: [UpdateManager] Bump version number to refresh broken plugins See #1168 --- module/plugins/hooks/AndroidPhoneNotify.py | 2 +- module/plugins/hooks/WindowsPhoneNotify.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/AndroidPhoneNotify.py b/module/plugins/hooks/AndroidPhoneNotify.py index d4536842d..a3b24a255 100644 --- a/module/plugins/hooks/AndroidPhoneNotify.py +++ b/module/plugins/hooks/AndroidPhoneNotify.py @@ -9,7 +9,7 @@ from module.plugins.Hook import Hook class AndroidPhoneNotify(Hook): __name__ = "AndroidPhoneNotify" __type__ = "hook" - __version__ = "0.04" + __version__ = "0.05" __config__ = [("apikey" , "str" , "API key" , "" ), ("notifycaptcha" , "bool", "Notify captcha request" , True ), diff --git a/module/plugins/hooks/WindowsPhoneNotify.py b/module/plugins/hooks/WindowsPhoneNotify.py index 821b9643c..e0dd75f92 100644 --- a/module/plugins/hooks/WindowsPhoneNotify.py +++ b/module/plugins/hooks/WindowsPhoneNotify.py @@ -10,7 +10,7 @@ from module.plugins.Hook import Hook class WindowsPhoneNotify(Hook): __name__ = "WindowsPhoneNotify" __type__ = "hook" - __version__ = "0.06" + __version__ = "0.07" __config__ = [("id" , "str" , "Push ID" , "" ), ("url" , "str" , "Push url" , "" ), -- cgit v1.2.3 From fd7e1994a94c58aa0ba69808223f5f6a9b99f718 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Thu, 12 Feb 2015 00:02:41 +0100 Subject: [ClickAndLoad] Fix https://github.com/pyload/pyload/issues/1158 --- module/plugins/hooks/ClickAndLoad.py | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py index 0bcd6ddef..40e6ded65 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickAndLoad.py @@ -10,16 +10,16 @@ from module.plugins.Hook import Hook, threaded def forward(source, destination): try: - size = 1024 - data = source.recv(size) + bufsize = 1024 + data = source.recv(bufsize) while data: destination.sendall(data) - data = source.recv(size) + data = source.recv(bufsize) finally: destination.shutdown(socket.SHUT_WR) -#: socket.create_connection wrapper for python 2.5 +#: create_connection wrapper for python 2.5 socket module def create_connection(address, timeout=object(), source_address=None): if hasattr(socket, 'create_connection'): if type(timeout) == object: @@ -56,7 +56,7 @@ def create_connection(address, timeout=object(), source_address=None): class ClickAndLoad(Hook): __name__ = "ClickAndLoad" __type__ = "hook" - __version__ = "0.33" + __version__ = "0.34" __config__ = [("activated", "bool", "Activated" , True ), ("port" , "int" , "Port" , 9666 ), @@ -72,7 +72,7 @@ class ClickAndLoad(Hook): if not self.config['webinterface']['activated']: return - ip = "0.0.0.0" if self.getConfig("extern") else "127.0.0.1" + ip = socket.gethostbyname(socket.gethostname()) if self.getConfig("extern") else "127.0.0.1" webport = int(self.config['webinterface']['port']) cnlport = self.getConfig('port') @@ -89,22 +89,23 @@ class ClickAndLoad(Hook): def server(self, ip, webport, cnlport): try: - dock_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - dock_socket.bind((ip, cnlport)) - dock_socket.listen(5) + server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + server_socket.bind((ip, cnlport)) + server_socket.listen(5) while True: - client_socket = dock_socket.accept()[0] - server_socket = create_connection(("127.0.0.1", webport)) + client_socket = server_socket.accept()[0] + dock_socket = create_connection(("127.0.0.1", webport)) - self.manager.startThread(forward, client_socket, server_socket) - self.manager.startThread(forward, server_socket, client_socket) + self.manager.startThread(forward, client_socket, dock_socket) + self.manager.startThread(forward, dock_socket, client_socket) + client_socket.close() + dock_socket.close() except socket.error, e: self.logDebug(e) self.server(ip, webport, cnlport) finally: - client_socket.close() server_socket.close() - dock_socket.close() -- cgit v1.2.3 From 65a02207360423ea83314eb3ea3178095c1bbd2e Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Thu, 12 Feb 2015 00:29:23 +0100 Subject: [ClickAndLoad] Small code cosmetics --- module/plugins/hooks/ClickAndLoad.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py index 40e6ded65..d0f340aae 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickAndLoad.py @@ -3,7 +3,6 @@ import socket from threading import Thread, Lock -from time import sleep from module.plugins.Hook import Hook, threaded @@ -100,6 +99,7 @@ class ClickAndLoad(Hook): self.manager.startThread(forward, client_socket, dock_socket) self.manager.startThread(forward, dock_socket, client_socket) + client_socket.close() dock_socket.close() -- cgit v1.2.3 From 71abae13c5f866e3e2b609ea2da3ab86405840ff Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Thu, 12 Feb 2015 02:48:03 +0100 Subject: [SkipRev] Fix https://github.com/pyload/pyload/issues/1007 --- module/plugins/hooks/SkipRev.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index 51d385bb4..0bbdec3b2 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -18,7 +18,7 @@ def _setup(self): class SkipRev(Hook): __name__ = "SkipRev" __type__ = "hook" - __version__ = "0.24" + __version__ = "0.25" __config__ = [("tokeep", "int", "Number of rev files to keep for package (-1 to auto)", -1)] @@ -60,10 +60,12 @@ class SkipRev(Hook): tokeep = self.getConfig("tokeep") if tokeep: - saved = [True for link in self.core.api.getPackageData(pyfile.package().id).links \ - if link.name.endswith(".rev") and link.status in (0, 12)].count(True) + status_list = (1, 4, 8, 9, 14) if tokeep < 0 else (1, 3, 4, 8, 9, 14) - if not saved or saved < tokeep: #: keep one rev at least in auto mode + queued = [True for link in self.core.api.getPackageData(pyfile.package().id).links \ + if link.name.endswith(".rev") and link.status not in status_list].count(True) + + if not queued or queued < tokeep: #: keep one rev at least in auto mode return pyfile.setCustomStatus("SkipRev", "skipped") -- cgit v1.2.3 From 8ef57f185a386883da33c83ccdd96a12d51f03b8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@gmail.com> Date: Sun, 15 Feb 2015 01:51:37 +0100 Subject: [ClickAndLoad] Fixup --- module/plugins/hooks/ClickAndLoad.py | 49 +++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 18 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py index d0f340aae..8b53872e4 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickAndLoad.py @@ -2,7 +2,7 @@ import socket -from threading import Thread, Lock +from threading import Lock from module.plugins.Hook import Hook, threaded @@ -10,10 +10,10 @@ from module.plugins.Hook import Hook, threaded def forward(source, destination): try: bufsize = 1024 - data = source.recv(bufsize) - while data: - destination.sendall(data) - data = source.recv(bufsize) + bufdata = source.recv(bufsize) + while bufdata: + destination.sendall(bufdata) + bufdata = source.recv(bufsize) finally: destination.shutdown(socket.SHUT_WR) @@ -55,11 +55,11 @@ def create_connection(address, timeout=object(), source_address=None): class ClickAndLoad(Hook): __name__ = "ClickAndLoad" __type__ = "hook" - __version__ = "0.34" + __version__ = "0.35" - __config__ = [("activated", "bool", "Activated" , True ), - ("port" , "int" , "Port" , 9666 ), - ("extern" , "bool", "Listen for requests coming from WAN (internet)", False)] + __config__ = [("activated", "bool", "Activated" , True), + ("port" , "int" , "Port" , 9666), + ("extern" , "bool", "Listen on the public network interface", True)] __description__ = """Click'N'Load hook plugin""" __license__ = "GPLv3" @@ -67,6 +67,11 @@ class ClickAndLoad(Hook): ("Walter Purcaro", "vuolter@gmail.com")] + #@TODO: Remove in 0.4.10 + def initPeriodical(self): + pass + + def coreReady(self): if not self.config['webinterface']['activated']: return @@ -80,13 +85,13 @@ class ClickAndLoad(Hook): @threaded def proxy(self, ip, webport, cnlport): - self.manager.startThread(self.server, ip, webport, cnlport) + self.manager.startThread(self._server, ip, webport, cnlport) lock = Lock() lock.acquire() lock.acquire() - def server(self, ip, webport, cnlport): + def _server(self, ip, webport, cnlport, thread): try: server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) @@ -97,15 +102,23 @@ class ClickAndLoad(Hook): client_socket = server_socket.accept()[0] dock_socket = create_connection(("127.0.0.1", webport)) - self.manager.startThread(forward, client_socket, dock_socket) self.manager.startThread(forward, dock_socket, client_socket) - - client_socket.close() - dock_socket.close() + self.manager.startThread(forward, client_socket, dock_socket) except socket.error, e: self.logDebug(e) - self.server(ip, webport, cnlport) + self._server(ip, webport, cnlport, thread) - finally: - server_socket.close() + except Exception, e: + self.logError(e) + + try: + client_socket.close() + dock_socket.close() + except Exception: + pass + + try: + server_socket.close() + except Exception: + pass -- cgit v1.2.3