diff options
479 files changed, 4015 insertions, 4816 deletions
diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 0c8e3629e..000000000 --- a/.gitignore +++ /dev/null @@ -1,17 +0,0 @@ -.settings -.*project -*.dll -*.exe -*.py[cd] - -qt.conf -UnRAR_license.txt - -/*/ -!/docs -!/icons -!/locale -!/module -/module/config/configdir -!/scripts -!/tests diff --git a/.hgignore b/.hgignore new file mode 100644 index 000000000..1215b241d --- /dev/null +++ b/.hgignore @@ -0,0 +1,36 @@ +# ignoreing unneeded files, using glob syntax +syntax: glob +*.pyc +*~ +*.pidaproject +.svn +*.DS_Store +*.egg-info +*.project +*.pydevproject +Downloads/* +container/* +Logs/* +docs/module/ +docs/_build +module/plugins/container/DLC_*.py +failed_links.txt +module/config/gui.xml +module/config/core.xml +module/config/plugin.xml +links.txt +ssl.crt +ssl.key +cert.pem +module/web/pyload.db +*.svg +*.prefs +*.po +*.orig +*.rej +pyload/* +dist/* +build/* +setup.py +paver-minilib.zip +env/* diff --git a/module/plugins/accounts/AlldebridCom.py b/module/plugins/accounts/AlldebridCom.py index 73ba04a0e..08fde7130 100644 --- a/module/plugins/accounts/AlldebridCom.py +++ b/module/plugins/accounts/AlldebridCom.py @@ -12,7 +12,7 @@ from module.plugins.internal.MultiAccount import MultiAccount class AlldebridCom(MultiAccount): __name__ = "AlldebridCom" __type__ = "account" - __version__ = "0.29" + __version__ = "0.30" __status__ = "testing" __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), diff --git a/module/plugins/accounts/AniStreamCom.py b/module/plugins/accounts/AniStreamCom.py index fdbea5a2b..7eadc2190 100644 --- a/module/plugins/accounts/AniStreamCom.py +++ b/module/plugins/accounts/AniStreamCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class AniStreamCom(XFSAccount): __name__ = "AniStreamCom" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __status__ = "testing" __description__ = """Ani-Stream.com account plugin""" diff --git a/module/plugins/accounts/BackinNet.py b/module/plugins/accounts/BackinNet.py index 8804139e6..f2f7fb6e7 100644 --- a/module/plugins/accounts/BackinNet.py +++ b/module/plugins/accounts/BackinNet.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class BackinNet(XFSAccount): __name__ = "BackinNet" __type__ = "account" - __version__ = "0.04" + __version__ = "0.05" __status__ = "testing" __description__ = """Backin.net account plugin""" diff --git a/module/plugins/accounts/BitshareCom.py b/module/plugins/accounts/BitshareCom.py index 5e9a5dc3b..58a589abc 100644 --- a/module/plugins/accounts/BitshareCom.py +++ b/module/plugins/accounts/BitshareCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.Account import Account class BitshareCom(Account): __name__ = "BitshareCom" __type__ = "account" - __version__ = "0.18" + __version__ = "0.19" __status__ = "testing" __description__ = """Bitshare account plugin""" diff --git a/module/plugins/accounts/CatShareNet.py b/module/plugins/accounts/CatShareNet.py index 7fafaa20f..8831b9014 100644 --- a/module/plugins/accounts/CatShareNet.py +++ b/module/plugins/accounts/CatShareNet.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class CatShareNet(Account): __name__ = "CatShareNet" __type__ = "account" - __version__ = "0.11" + __version__ = "0.12" __status__ = "testing" __description__ = """Catshare.net account plugin""" diff --git a/module/plugins/accounts/CloudsharesNet.py b/module/plugins/accounts/CloudsharesNet.py index 845fe1bc9..04d57d84a 100644 --- a/module/plugins/accounts/CloudsharesNet.py +++ b/module/plugins/accounts/CloudsharesNet.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class CloudsharesNet(XFSAccount): __name__ = "CloudsharesNet" __type__ = "account" - __version__ = "0.01" + __version__ = "0.02" __status__ = "testing" __description__ = """Cloudshares.net account plugin""" diff --git a/module/plugins/accounts/CloudsixMe.py b/module/plugins/accounts/CloudsixMe.py index eeb886647..e9c98c433 100644 --- a/module/plugins/accounts/CloudsixMe.py +++ b/module/plugins/accounts/CloudsixMe.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class CloudsixMe(XFSAccount): __name__ = "CloudsixMe" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __status__ = "testing" __description__ = """Cloudsix.me account plugin""" diff --git a/module/plugins/accounts/CloudzillaTo.py b/module/plugins/accounts/CloudzillaTo.py index 30b17fb4e..cc055cbc8 100644 --- a/module/plugins/accounts/CloudzillaTo.py +++ b/module/plugins/accounts/CloudzillaTo.py @@ -8,7 +8,7 @@ from module.plugins.internal.Account import Account class CloudzillaTo(Account): __name__ = "CloudzillaTo" __type__ = "account" - __version__ = "0.07" + __version__ = "0.08" __status__ = "testing" __description__ = """Cloudzilla.to account plugin""" diff --git a/module/plugins/accounts/CramitIn.py b/module/plugins/accounts/CramitIn.py index 4b1ef4120..146af0c92 100644 --- a/module/plugins/accounts/CramitIn.py +++ b/module/plugins/accounts/CramitIn.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class CramitIn(XFSAccount): __name__ = "CramitIn" __type__ = "account" - __version__ = "0.06" + __version__ = "0.07" __status__ = "testing" __description__ = """Cramit.in account plugin""" diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py index 01030da91..7b61db9f6 100644 --- a/module/plugins/accounts/CzshareCom.py +++ b/module/plugins/accounts/CzshareCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class CzshareCom(Account): __name__ = "CzshareCom" __type__ = "account" - __version__ = "0.25" + __version__ = "0.26" __status__ = "testing" __description__ = """Czshare.com account plugin, now Sdilej.cz""" diff --git a/module/plugins/accounts/DebridItaliaCom.py b/module/plugins/accounts/DebridItaliaCom.py index 65f863d2e..d6486ed81 100644 --- a/module/plugins/accounts/DebridItaliaCom.py +++ b/module/plugins/accounts/DebridItaliaCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.MultiAccount import MultiAccount class DebridItaliaCom(MultiAccount): __name__ = "DebridItaliaCom" __type__ = "account" - __version__ = "0.18" + __version__ = "0.19" __status__ = "testing" __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), diff --git a/module/plugins/accounts/DepositfilesCom.py b/module/plugins/accounts/DepositfilesCom.py index 836fe3dee..f9f97c1ce 100644 --- a/module/plugins/accounts/DepositfilesCom.py +++ b/module/plugins/accounts/DepositfilesCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class DepositfilesCom(Account): __name__ = "DepositfilesCom" __type__ = "account" - __version__ = "0.37" + __version__ = "0.38" __status__ = "testing" __description__ = """Depositfiles.com account plugin""" diff --git a/module/plugins/accounts/EasybytezCom.py b/module/plugins/accounts/EasybytezCom.py index 7599ce633..cd57c0a15 100644 --- a/module/plugins/accounts/EasybytezCom.py +++ b/module/plugins/accounts/EasybytezCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class EasybytezCom(XFSAccount): __name__ = "EasybytezCom" __type__ = "account" - __version__ = "0.15" + __version__ = "0.16" __status__ = "testing" __config__ = [("mh_activated", "bool" , "Use multihoster feature" , True ), diff --git a/module/plugins/accounts/EuroshareEu.py b/module/plugins/accounts/EuroshareEu.py index 78f45c532..b1528c6dc 100644 --- a/module/plugins/accounts/EuroshareEu.py +++ b/module/plugins/accounts/EuroshareEu.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class EuroshareEu(Account): __name__ = "EuroshareEu" __type__ = "account" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __description__ = """Euroshare.eu account plugin""" diff --git a/module/plugins/accounts/ExashareCom.py b/module/plugins/accounts/ExashareCom.py index 95585ce2e..6b9846d62 100644 --- a/module/plugins/accounts/ExashareCom.py +++ b/module/plugins/accounts/ExashareCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class ExashareCom(XFSAccount): __name__ = "ExashareCom" __type__ = "account" - __version__ = "0.04" + __version__ = "0.05" __status__ = "testing" __description__ = """Exashare.com account plugin""" diff --git a/module/plugins/accounts/FastixRu.py b/module/plugins/accounts/FastixRu.py index 777b07ce9..d28cc830b 100644 --- a/module/plugins/accounts/FastixRu.py +++ b/module/plugins/accounts/FastixRu.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- from module.plugins.internal.MultiAccount import MultiAccount -from module.plugins.internal.utils import json +from module.plugins.internal.misc import json class FastixRu(MultiAccount): __name__ = "FastixRu" __type__ = "account" - __version__ = "0.09" + __version__ = "0.10" __status__ = "testing" __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), @@ -21,19 +21,20 @@ class FastixRu(MultiAccount): def grab_hosters(self, user, password, data): html = self.load("http://fastix.ru/api_v2", - get={'apikey': "5182964c3f8f9a7f0b00000a_kelmFB4n1IrnCDYuIFn2y", - 'sub' : "allowed_sources"}) + get={'apikey': "5182964c3f8f9a7f0b00000a_kelmFB4n1IrnCDYuIFn2y", + 'sub' : "allowed_sources"}) host_list = json.loads(html) host_list = host_list['allow'] return host_list def grab_info(self, user, password, data): - html = json.loads(self.load("http://fastix.ru/api_v2/", - get={'apikey': data['apikey'], - 'sub' : "getaccountdetails"})) + html = self.load("http://fastix.ru/api_v2/", + get={'apikey': data['apikey'], + 'sub' : "getaccountdetails"}) + json_data = json.loads(html) - points = html['points'] + points = json_data['points'] kb = float(points) * 1024 ** 2 / 1000 if points > 0: @@ -44,10 +45,11 @@ class FastixRu(MultiAccount): def signin(self, user, password, data): - api = json.loads(self.load("https://fastix.ru/api_v2/", - get={'sub' : "get_apikey", - 'email' : user, - 'password': password})) + html = self.load("https://fastix.ru/api_v2/", + get={'sub' : "get_apikey", + 'email' : user, + 'password': password}) + api = json.loads(html) if 'error' in api: self.fail_login(api['error_txt']) diff --git a/module/plugins/accounts/FastshareCz.py b/module/plugins/accounts/FastshareCz.py index d445428b3..de235f416 100644 --- a/module/plugins/accounts/FastshareCz.py +++ b/module/plugins/accounts/FastshareCz.py @@ -3,13 +3,13 @@ import re from module.plugins.internal.Account import Account -from module.plugins.internal.utils import set_cookie +from module.plugins.internal.misc import set_cookie class FastshareCz(Account): __name__ = "FastshareCz" __type__ = "account" - __version__ = "0.12" + __version__ = "0.13" __status__ = "testing" __description__ = """Fastshare.cz account plugin""" diff --git a/module/plugins/accounts/File4SafeCom.py b/module/plugins/accounts/File4SafeCom.py index 462b66d6a..1b0710bd7 100644 --- a/module/plugins/accounts/File4SafeCom.py +++ b/module/plugins/accounts/File4SafeCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class File4SafeCom(XFSAccount): __name__ = "File4SafeCom" __type__ = "account" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __description__ = """File4Safe.com account plugin""" diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py index 65c7f2f6f..65167e176 100644 --- a/module/plugins/accounts/FilecloudIo.py +++ b/module/plugins/accounts/FilecloudIo.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- from module.plugins.internal.Account import Account -from module.plugins.internal.utils import json, set_cookie +from module.plugins.internal.misc import json, set_cookie class FilecloudIo(Account): __name__ = "FilecloudIo" __type__ = "account" - __version__ = "0.10" + __version__ = "0.11" __status__ = "testing" __description__ = """FilecloudIo account plugin""" @@ -36,7 +36,7 @@ class FilecloudIo(Account): post={'akey': akey}) rep = json.loads(rep) - if rep['is_premium'] == 1: + if rep['is_premium'] is 1: return {'validuntil': float(rep['premium_until']), 'trafficleft': -1} else: return {'premium': False} diff --git a/module/plugins/accounts/FilefactoryCom.py b/module/plugins/accounts/FilefactoryCom.py index fad99d6ad..5be4f3cf6 100644 --- a/module/plugins/accounts/FilefactoryCom.py +++ b/module/plugins/accounts/FilefactoryCom.py @@ -1,16 +1,17 @@ # -*- coding: utf-8 -*- -import pycurl import re import time +import pycurl + from module.plugins.internal.Account import Account class FilefactoryCom(Account): __name__ = "FilefactoryCom" __type__ = "account" - __version__ = "0.20" + __version__ = "0.21" __status__ = "testing" __description__ = """Filefactory.com account plugin""" diff --git a/module/plugins/accounts/FilejungleCom.py b/module/plugins/accounts/FilejungleCom.py index 8c019c940..4439b4696 100644 --- a/module/plugins/accounts/FilejungleCom.py +++ b/module/plugins/accounts/FilejungleCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.Account import Account class FilejungleCom(Account): __name__ = "FilejungleCom" __type__ = "account" - __version__ = "0.17" + __version__ = "0.18" __status__ = "testing" __description__ = """Filejungle.com account plugin""" diff --git a/module/plugins/accounts/FileomCom.py b/module/plugins/accounts/FileomCom.py index 429229a89..1fbe718dd 100644 --- a/module/plugins/accounts/FileomCom.py +++ b/module/plugins/accounts/FileomCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class FileomCom(XFSAccount): __name__ = "FileomCom" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __description__ = """Fileom.com account plugin""" diff --git a/module/plugins/accounts/FilerNet.py b/module/plugins/accounts/FilerNet.py index 26742bf4c..c3759d5e3 100644 --- a/module/plugins/accounts/FilerNet.py +++ b/module/plugins/accounts/FilerNet.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class FilerNet(Account): __name__ = "FilerNet" __type__ = "account" - __version__ = "0.10" + __version__ = "0.11" __status__ = "testing" __description__ = """Filer.net account plugin""" diff --git a/module/plugins/accounts/FilerioCom.py b/module/plugins/accounts/FilerioCom.py index b225b404a..c53cc71b9 100644 --- a/module/plugins/accounts/FilerioCom.py +++ b/module/plugins/accounts/FilerioCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class FilerioCom(XFSAccount): __name__ = "FilerioCom" __type__ = "account" - __version__ = "0.06" + __version__ = "0.07" __status__ = "testing" __description__ = """FileRio.in account plugin""" diff --git a/module/plugins/accounts/FilesMailRu.py b/module/plugins/accounts/FilesMailRu.py index da09c8569..ec60cf3d3 100644 --- a/module/plugins/accounts/FilesMailRu.py +++ b/module/plugins/accounts/FilesMailRu.py @@ -6,7 +6,7 @@ from module.plugins.internal.Account import Account class FilesMailRu(Account): __name__ = "FilesMailRu" __type__ = "account" - __version__ = "0.16" + __version__ = "0.17" __status__ = "testing" __description__ = """Filesmail.ru account plugin""" diff --git a/module/plugins/accounts/FileserveCom.py b/module/plugins/accounts/FileserveCom.py index 2fe710012..88bd8ee79 100644 --- a/module/plugins/accounts/FileserveCom.py +++ b/module/plugins/accounts/FileserveCom.py @@ -3,13 +3,13 @@ import time from module.plugins.internal.Account import Account -from module.plugins.internal.utils import json +from module.plugins.internal.misc import json class FileserveCom(Account): __name__ = "FileserveCom" __type__ = "account" - __version__ = "0.25" + __version__ = "0.26" __status__ = "testing" __description__ = """Fileserve.com account plugin""" diff --git a/module/plugins/accounts/FourSharedCom.py b/module/plugins/accounts/FourSharedCom.py index e3ea517cd..0483fe92f 100644 --- a/module/plugins/accounts/FourSharedCom.py +++ b/module/plugins/accounts/FourSharedCom.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- from module.plugins.internal.Account import Account -from module.plugins.internal.utils import set_cookie +from module.plugins.internal.misc import set_cookie class FourSharedCom(Account): __name__ = "FourSharedCom" __type__ = "account" - __version__ = "0.11" + __version__ = "0.12" __status__ = "testing" __description__ = """FourShared.com account plugin""" diff --git a/module/plugins/accounts/FreakshareCom.py b/module/plugins/accounts/FreakshareCom.py index 2ad8a48b5..5f733b56d 100644 --- a/module/plugins/accounts/FreakshareCom.py +++ b/module/plugins/accounts/FreakshareCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class FreakshareCom(Account): __name__ = "FreakshareCom" __type__ = "account" - __version__ = "0.18" + __version__ = "0.19" __status__ = "testing" __description__ = """Freakshare.com account plugin""" diff --git a/module/plugins/accounts/FreeWayMe.py b/module/plugins/accounts/FreeWayMe.py index f978e813d..d7a7edd50 100644 --- a/module/plugins/accounts/FreeWayMe.py +++ b/module/plugins/accounts/FreeWayMe.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- from module.plugins.internal.MultiAccount import MultiAccount -from module.plugins.internal.utils import json +from module.plugins.internal.misc import json class FreeWayMe(MultiAccount): __name__ = "FreeWayMe" __type__ = "account" - __version__ = "0.20" + __version__ = "0.21" __status__ = "testing" __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), diff --git a/module/plugins/accounts/FshareVn.py b/module/plugins/accounts/FshareVn.py index 6008849f7..e75719082 100644 --- a/module/plugins/accounts/FshareVn.py +++ b/module/plugins/accounts/FshareVn.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class FshareVn(Account): __name__ = "FshareVn" __type__ = "account" - __version__ = "0.15" + __version__ = "0.16" __status__ = "testing" __description__ = """Fshare.vn account plugin""" diff --git a/module/plugins/accounts/Ftp.py b/module/plugins/accounts/Ftp.py index 12f40a89a..5fe25d8a5 100644 --- a/module/plugins/accounts/Ftp.py +++ b/module/plugins/accounts/Ftp.py @@ -6,7 +6,7 @@ from module.plugins.internal.Account import Account class Ftp(Account): __name__ = "Ftp" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __description__ = """Ftp dummy account plugin""" diff --git a/module/plugins/accounts/HellshareCz.py b/module/plugins/accounts/HellshareCz.py index 2e7077796..fa273eeeb 100644 --- a/module/plugins/accounts/HellshareCz.py +++ b/module/plugins/accounts/HellshareCz.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class HellshareCz(Account): __name__ = "HellshareCz" __type__ = "account" - __version__ = "0.23" + __version__ = "0.24" __status__ = "testing" __description__ = """Hellshare.cz account plugin""" diff --git a/module/plugins/accounts/HighWayMe.py b/module/plugins/accounts/HighWayMe.py index e28baeef3..13807c99f 100644 --- a/module/plugins/accounts/HighWayMe.py +++ b/module/plugins/accounts/HighWayMe.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- from module.plugins.internal.MultiAccount import MultiAccount -from module.plugins.internal.utils import json +from module.plugins.internal.misc import json class HighWayMe(MultiAccount): __name__ = "HighWayMe.py" __type__ = "account" - __version__ = "0.07" + __version__ = "0.08" __status__ = "testing" __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), @@ -20,8 +20,8 @@ class HighWayMe(MultiAccount): def grab_hosters(self, user, password, data): - json_data = json.loads(self.load("https://high-way.me/api.php", - get={'hoster': 1})) + html = self.load("https://high-way.me/api.php", get={'hoster': 1}) + json_data = json.loads(html) return [element['name'] for element in json_data['hoster']] diff --git a/module/plugins/accounts/Http.py b/module/plugins/accounts/Http.py index 3240450f0..351cdc774 100644 --- a/module/plugins/accounts/Http.py +++ b/module/plugins/accounts/Http.py @@ -6,7 +6,7 @@ from module.plugins.internal.Account import Account class Http(Account): __name__ = "Http" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __description__ = """Http dummy account plugin""" diff --git a/module/plugins/accounts/HugefilesNet.py b/module/plugins/accounts/HugefilesNet.py index fddc7cfa5..25d8c5c69 100644 --- a/module/plugins/accounts/HugefilesNet.py +++ b/module/plugins/accounts/HugefilesNet.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class HugefilesNet(XFSAccount): __name__ = "HugefilesNet" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __description__ = """Hugefiles.net account plugin""" diff --git a/module/plugins/accounts/HundredEightyUploadCom.py b/module/plugins/accounts/HundredEightyUploadCom.py index ff9383379..e62307194 100644 --- a/module/plugins/accounts/HundredEightyUploadCom.py +++ b/module/plugins/accounts/HundredEightyUploadCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class HundredEightyUploadCom(XFSAccount): __name__ = "HundredEightyUploadCom" __type__ = "account" - __version__ = "0.06" + __version__ = "0.07" __status__ = "testing" __description__ = """180upload.com account plugin""" diff --git a/module/plugins/accounts/JunkyvideoCom.py b/module/plugins/accounts/JunkyvideoCom.py index 1a990b5f7..69ec68222 100644 --- a/module/plugins/accounts/JunkyvideoCom.py +++ b/module/plugins/accounts/JunkyvideoCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class JunkyvideoCom(XFSAccount): __name__ = "JunkyvideoCom" __type__ = "account" - __version__ = "0.04" + __version__ = "0.05" __status__ = "testing" __description__ = """Junkyvideo.com account plugin""" diff --git a/module/plugins/accounts/JunocloudMe.py b/module/plugins/accounts/JunocloudMe.py index f2fe493a6..45ab625d1 100644 --- a/module/plugins/accounts/JunocloudMe.py +++ b/module/plugins/accounts/JunocloudMe.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class JunocloudMe(XFSAccount): __name__ = "JunocloudMe" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __description__ = """Junocloud.me account plugin""" diff --git a/module/plugins/accounts/Keep2ShareCc.py b/module/plugins/accounts/Keep2ShareCc.py index 2e3348efe..58bee5bd4 100644 --- a/module/plugins/accounts/Keep2ShareCc.py +++ b/module/plugins/accounts/Keep2ShareCc.py @@ -4,13 +4,13 @@ import re import time from module.plugins.internal.Account import Account -from module.plugins.internal.utils import set_cookie +from module.plugins.internal.misc import set_cookie class Keep2ShareCc(Account): __name__ = "Keep2ShareCc" __type__ = "account" - __version__ = "0.11" + __version__ = "0.12" __status__ = "testing" __description__ = """Keep2Share.cc account plugin""" diff --git a/module/plugins/accounts/LetitbitNet.py b/module/plugins/accounts/LetitbitNet.py index c272346a2..3d3fb109d 100644 --- a/module/plugins/accounts/LetitbitNet.py +++ b/module/plugins/accounts/LetitbitNet.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- from module.plugins.internal.Account import Account -# from module.plugins.internal.utils import json +# from module.plugins.internal.misc import json class LetitbitNet(Account): __name__ = "LetitbitNet" __type__ = "account" - __version__ = "0.07" + __version__ = "0.08" __status__ = "testing" __description__ = """Letitbit.net account plugin""" diff --git a/module/plugins/accounts/LinksnappyCom.py b/module/plugins/accounts/LinksnappyCom.py index f22dffe15..a810d6e8f 100644 --- a/module/plugins/accounts/LinksnappyCom.py +++ b/module/plugins/accounts/LinksnappyCom.py @@ -3,13 +3,13 @@ import hashlib from module.plugins.internal.MultiAccount import MultiAccount -from module.plugins.internal.utils import json +from module.plugins.internal.misc import json class LinksnappyCom(MultiAccount): __name__ = "LinksnappyCom" __type__ = "account" - __version__ = "0.11" + __version__ = "0.12" __status__ = "testing" __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), diff --git a/module/plugins/accounts/MegaDebridEu.py b/module/plugins/accounts/MegaDebridEu.py index 59f5b58be..c2de1ae59 100644 --- a/module/plugins/accounts/MegaDebridEu.py +++ b/module/plugins/accounts/MegaDebridEu.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- from module.plugins.internal.MultiAccount import MultiAccount -from module.plugins.internal.utils import json +from module.plugins.internal.misc import json class MegaDebridEu(MultiAccount): __name__ = "MegaDebridEu" __type__ = "account" - __version__ = "0.25" + __version__ = "0.26" __status__ = "testing" __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), diff --git a/module/plugins/accounts/MegaRapidCz.py b/module/plugins/accounts/MegaRapidCz.py index ed9144138..165da873d 100644 --- a/module/plugins/accounts/MegaRapidCz.py +++ b/module/plugins/accounts/MegaRapidCz.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class MegaRapidCz(Account): __name__ = "MegaRapidCz" __type__ = "account" - __version__ = "0.40" + __version__ = "0.41" __status__ = "testing" __description__ = """MegaRapid.cz account plugin""" diff --git a/module/plugins/accounts/MegaRapidoNet.py b/module/plugins/accounts/MegaRapidoNet.py index 585d041de..10a0af21d 100644 --- a/module/plugins/accounts/MegaRapidoNet.py +++ b/module/plugins/accounts/MegaRapidoNet.py @@ -9,7 +9,7 @@ from module.plugins.internal.MultiAccount import MultiAccount class MegaRapidoNet(MultiAccount): __name__ = "MegaRapidoNet" __type__ = "account" - __version__ = "0.07" + __version__ = "0.08" __status__ = "testing" __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), diff --git a/module/plugins/accounts/MegasharesCom.py b/module/plugins/accounts/MegasharesCom.py index 9b4d74144..516bfc02c 100644 --- a/module/plugins/accounts/MegasharesCom.py +++ b/module/plugins/accounts/MegasharesCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class MegasharesCom(Account): __name__ = "MegasharesCom" __type__ = "account" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __description__ = """Megashares.com account plugin""" diff --git a/module/plugins/accounts/MovReelCom.py b/module/plugins/accounts/MovReelCom.py index ec8623685..8387d21f3 100644 --- a/module/plugins/accounts/MovReelCom.py +++ b/module/plugins/accounts/MovReelCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class MovReelCom(XFSAccount): __name__ = "MovReelCom" __type__ = "account" - __version__ = "0.06" + __version__ = "0.07" __status__ = "testing" __description__ = """Movreel.com account plugin""" diff --git a/module/plugins/accounts/MultihostersCom.py b/module/plugins/accounts/MultihostersCom.py index 72c9096ad..a52978704 100644 --- a/module/plugins/accounts/MultihostersCom.py +++ b/module/plugins/accounts/MultihostersCom.py @@ -6,7 +6,7 @@ from module.plugins.accounts.ZeveraCom import ZeveraCom class MultihostersCom(ZeveraCom): __name__ = "MultihostersCom" __type__ = "account" - __version__ = "0.06" + __version__ = "0.07" __status__ = "testing" __description__ = """Multihosters.com account plugin""" diff --git a/module/plugins/accounts/MultishareCz.py b/module/plugins/accounts/MultishareCz.py index 3faad42c3..d67dfbf8a 100644 --- a/module/plugins/accounts/MultishareCz.py +++ b/module/plugins/accounts/MultishareCz.py @@ -8,7 +8,7 @@ from module.plugins.internal.MultiAccount import MultiAccount class MultishareCz(MultiAccount): __name__ = "MultishareCz" __type__ = "account" - __version__ = "0.11" + __version__ = "0.12" __status__ = "testing" __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), diff --git a/module/plugins/accounts/MyfastfileCom.py b/module/plugins/accounts/MyfastfileCom.py index ed527cf70..d000b2efe 100644 --- a/module/plugins/accounts/MyfastfileCom.py +++ b/module/plugins/accounts/MyfastfileCom.py @@ -2,14 +2,14 @@ import time -from module.plugins.internal.utils import json +from module.plugins.internal.misc import json from module.plugins.internal.MultiAccount import MultiAccount class MyfastfileCom(MultiAccount): __name__ = "MyfastfileCom" __type__ = "account" - __version__ = "0.09" + __version__ = "0.10" __status__ = "testing" __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), diff --git a/module/plugins/accounts/NitroflareCom.py b/module/plugins/accounts/NitroflareCom.py index 45587b8a0..cc0ce3ea9 100644 --- a/module/plugins/accounts/NitroflareCom.py +++ b/module/plugins/accounts/NitroflareCom.py @@ -9,12 +9,12 @@ from module.plugins.internal.Account import Account class NitroflareCom(Account): __name__ = "NitroflareCom" __type__ = "account" - __version__ = "0.10" + __version__ = "0.11" __status__ = "testing" __description__ = """Nitroflare.com account plugin""" __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com" )] + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] VALID_UNTIL_PATTERN = r'>Time Left</label><strong>(.+?)</' diff --git a/module/plugins/accounts/NoPremiumPl.py b/module/plugins/accounts/NoPremiumPl.py index b5cbd5a05..d61c7cbdd 100644 --- a/module/plugins/accounts/NoPremiumPl.py +++ b/module/plugins/accounts/NoPremiumPl.py @@ -4,14 +4,14 @@ import datetime import hashlib import time -from module.plugins.internal.utils import json +from module.plugins.internal.misc import json from module.plugins.internal.MultiAccount import MultiAccount class NoPremiumPl(MultiAccount): __name__ = "NoPremiumPl" __type__ = "account" - __version__ = "0.07" + __version__ = "0.08" __status__ = "testing" __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), @@ -32,7 +32,8 @@ class NoPremiumPl(MultiAccount): 'info' : "1" } def grab_hosters(self, user, password, data): - hostings = json.loads(self.load("https://www.nopremium.pl/clipboard.php?json=3").strip()) + html = self.load("https://www.nopremium.pl/clipboard.php?json=3").strip() + hostings = json.loads(html) hostings_domains = [domain for row in hostings for domain in row['domains'] if row['sdownload'] == "0"] self.log_debug(hostings_domains) diff --git a/module/plugins/accounts/NosuploadCom.py b/module/plugins/accounts/NosuploadCom.py index e454c7151..c33160188 100644 --- a/module/plugins/accounts/NosuploadCom.py +++ b/module/plugins/accounts/NosuploadCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class NosuploadCom(XFSAccount): __name__ = "NosuploadCom" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __description__ = """Nosupload.com account plugin""" diff --git a/module/plugins/accounts/NovafileCom.py b/module/plugins/accounts/NovafileCom.py index c20d2b66e..9fb1021c6 100644 --- a/module/plugins/accounts/NovafileCom.py +++ b/module/plugins/accounts/NovafileCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class NovafileCom(XFSAccount): __name__ = "NovafileCom" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __description__ = """Novafile.com account plugin""" diff --git a/module/plugins/accounts/NowVideoSx.py b/module/plugins/accounts/NowVideoSx.py index 9ff8f0172..711e66477 100644 --- a/module/plugins/accounts/NowVideoSx.py +++ b/module/plugins/accounts/NowVideoSx.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class NowVideoSx(Account): __name__ = "NowVideoSx" __type__ = "account" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __description__ = """NowVideo.at account plugin""" diff --git a/module/plugins/accounts/OboomCom.py b/module/plugins/accounts/OboomCom.py index e1ad9ca0f..cb3342e49 100644 --- a/module/plugins/accounts/OboomCom.py +++ b/module/plugins/accounts/OboomCom.py @@ -16,14 +16,14 @@ except ImportError: def hexread(self, octets): return b2a_hex(pbkdf2(self.passphrase, self.salt, self.iterations, octets)) -from module.plugins.internal.utils import json +from module.plugins.internal.misc import json from module.plugins.internal.Account import Account class OboomCom(Account): __name__ = "OboomCom" __type__ = "account" - __version__ = "0.30" + __version__ = "0.31" __status__ = "testing" __description__ = """Oboom.com account plugin""" @@ -35,11 +35,12 @@ class OboomCom(Account): salt = password[::-1] pbkdf2 = PBKDF2(password, salt, 1000).hexread(16) - result = json.loads(self.load("http://www.oboom.com/1/login", #@TODO: Revert to `https` in 0.4.10 - get={'auth': user, - 'pass': pbkdf2})) + html = self.load("http://www.oboom.com/1/login", #@TODO: Revert to `https` in 0.4.10 + get={'auth': user, + 'pass': pbkdf2}) + result = json.loads(html) - if result[0] != 200: + if result[0] is not 200: self.log_warning(_("Failed to log in: %s") % result[1]) self.fail_login() diff --git a/module/plugins/accounts/OneFichierCom.py b/module/plugins/accounts/OneFichierCom.py index ed741b373..7391b806a 100644 --- a/module/plugins/accounts/OneFichierCom.py +++ b/module/plugins/accounts/OneFichierCom.py @@ -1,16 +1,17 @@ # -*- coding: utf-8 -*- -import pycurl import re import time +import pycurl + from module.plugins.internal.Account import Account class OneFichierCom(Account): __name__ = "OneFichierCom" __type__ = "account" - __version__ = "0.19" + __version__ = "0.20" __status__ = "testing" __description__ = """1fichier.com account plugin""" diff --git a/module/plugins/accounts/OpenloadCo.py b/module/plugins/accounts/OpenloadCo.py index 0eb1cd050..ab33fa128 100644 --- a/module/plugins/accounts/OpenloadCo.py +++ b/module/plugins/accounts/OpenloadCo.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class OpenloadCo(XFSAccount): __name__ = "OpenloadCo" __type__ = "account" - __version__ = "0.01" + __version__ = "0.02" __status__ = "testing" __description__ = """Openload.co account plugin""" diff --git a/module/plugins/accounts/OverLoadMe.py b/module/plugins/accounts/OverLoadMe.py index 9a302672a..0155d4efc 100644 --- a/module/plugins/accounts/OverLoadMe.py +++ b/module/plugins/accounts/OverLoadMe.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- from module.plugins.internal.MultiAccount import MultiAccount -from module.plugins.internal.utils import json +from module.plugins.internal.misc import json class OverLoadMe(MultiAccount): __name__ = "OverLoadMe" __type__ = "account" - __version__ = "0.09" + __version__ = "0.10" __status__ = "testing" __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), @@ -41,11 +41,11 @@ class OverLoadMe(MultiAccount): def signin(self, user, password, data): - jsondata = self.load("https://api.over-load.me/account.php", - get={'user': user, - 'auth': password}).strip() + html = self.load("https://api.over-load.me/account.php", + get={'user': user, + 'auth': password}).strip() - data = json.loads(jsondata) + data = json.loads(html) - if data['err'] == 1: + if data['err'] is 1: self.fail_login() diff --git a/module/plugins/accounts/PremiumTo.py b/module/plugins/accounts/PremiumTo.py index 39e5012fa..de463c467 100644 --- a/module/plugins/accounts/PremiumTo.py +++ b/module/plugins/accounts/PremiumTo.py @@ -6,7 +6,7 @@ from module.plugins.internal.MultiAccount import MultiAccount class PremiumTo(MultiAccount): __name__ = "PremiumTo" __type__ = "account" - __version__ = "0.14" + __version__ = "0.15" __status__ = "testing" __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), diff --git a/module/plugins/accounts/PremiumizeMe.py b/module/plugins/accounts/PremiumizeMe.py index 76a3b2137..66ecfb214 100644 --- a/module/plugins/accounts/PremiumizeMe.py +++ b/module/plugins/accounts/PremiumizeMe.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- from module.plugins.internal.MultiAccount import MultiAccount -from module.plugins.internal.utils import json +from module.plugins.internal.misc import json class PremiumizeMe(MultiAccount): __name__ = "PremiumizeMe" __type__ = "account" - __version__ = "0.22" + __version__ = "0.23" __status__ = "testing" __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), @@ -29,7 +29,7 @@ class PremiumizeMe(MultiAccount): data = json.loads(answer) #: If account is not valid thera are no hosters available - if data['status'] != 200: + if data['status'] is not 200: return [] #: Extract hosters from json file @@ -56,7 +56,7 @@ class PremiumizeMe(MultiAccount): status = self.get_account_status(user, password) #: Check if user and password are valid - if status['status'] != 200: + if status['status'] is not 200: self.fail_login() diff --git a/module/plugins/accounts/PutdriveCom.py b/module/plugins/accounts/PutdriveCom.py index 81f219a40..d90c16c3f 100644 --- a/module/plugins/accounts/PutdriveCom.py +++ b/module/plugins/accounts/PutdriveCom.py @@ -6,7 +6,7 @@ from module.plugins.accounts.ZeveraCom import ZeveraCom class PutdriveCom(ZeveraCom): __name__ = "PutdriveCom" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __description__ = """Putdrive.com account plugin""" diff --git a/module/plugins/accounts/QuickshareCz.py b/module/plugins/accounts/QuickshareCz.py index 5b67cf169..307a4b598 100644 --- a/module/plugins/accounts/QuickshareCz.py +++ b/module/plugins/accounts/QuickshareCz.py @@ -8,7 +8,7 @@ from module.plugins.internal.Account import Account class QuickshareCz(Account): __name__ = "QuickshareCz" __type__ = "account" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __description__ = """Quickshare.cz account plugin""" diff --git a/module/plugins/accounts/RPNetBiz.py b/module/plugins/accounts/RPNetBiz.py index 01f653483..28f2c854e 100644 --- a/module/plugins/accounts/RPNetBiz.py +++ b/module/plugins/accounts/RPNetBiz.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- from module.plugins.internal.MultiAccount import MultiAccount -from module.plugins.internal.utils import json +from module.plugins.internal.misc import json class RPNetBiz(MultiAccount): __name__ = "RPNetBiz" __type__ = "account" - __version__ = "0.18" + __version__ = "0.19" __status__ = "testing" __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), diff --git a/module/plugins/accounts/RapideoPl.py b/module/plugins/accounts/RapideoPl.py index 27c2a3d54..30e35dc39 100644 --- a/module/plugins/accounts/RapideoPl.py +++ b/module/plugins/accounts/RapideoPl.py @@ -4,14 +4,14 @@ import datetime import hashlib import time -from module.plugins.internal.utils import json +from module.plugins.internal.misc import json from module.plugins.internal.MultiAccount import MultiAccount class RapideoPl(MultiAccount): __name__ = "RapideoPl" __type__ = "account" - __version__ = "0.07" + __version__ = "0.08" __status__ = "testing" __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), @@ -32,7 +32,8 @@ class RapideoPl(MultiAccount): 'info' : "1" } def grab_hosters(self, user, password, data): - hostings = json.loads(self.load("https://www.rapideo.pl/clipboard.php?json=3").strip()) + html = self.load("https://www.rapideo.pl/clipboard.php?json=3").strip() + hostings = json.loads(html) hostings_domains = [domain for row in hostings for domain in row['domains'] if row['sdownload'] == "0"] self.log_debug(hostings_domains) diff --git a/module/plugins/accounts/RapidfileshareNet.py b/module/plugins/accounts/RapidfileshareNet.py index 4c2778c1c..5fb9ce51e 100644 --- a/module/plugins/accounts/RapidfileshareNet.py +++ b/module/plugins/accounts/RapidfileshareNet.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class RapidfileshareNet(XFSAccount): __name__ = "RapidfileshareNet" __type__ = "account" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __description__ = """Rapidfileshare.net account plugin""" diff --git a/module/plugins/accounts/RapidgatorNet.py b/module/plugins/accounts/RapidgatorNet.py index 95ef662ed..3057fb34c 100644 --- a/module/plugins/accounts/RapidgatorNet.py +++ b/module/plugins/accounts/RapidgatorNet.py @@ -3,13 +3,13 @@ import urlparse from module.plugins.internal.Account import Account -from module.plugins.internal.utils import json +from module.plugins.internal.misc import json class RapidgatorNet(Account): __name__ = "RapidgatorNet" __type__ = "account" - __version__ = "0.17" + __version__ = "0.18" __status__ = "testing" __description__ = """Rapidgator.net account plugin""" @@ -34,17 +34,17 @@ class RapidgatorNet(Account): self.log_debug("API:USERINFO", html) - jso = json.loads(html) + json_data = json.loads(html) - if jso['response_status'] == 200: - if "reset_in" in jso['response']: - self._schedule_refresh(user, jso['response']['reset_in']) + if json_data['response_status'] is 200: + if "reset_in" in json_data['response']: + self._schedule_refresh(user, json_data['response']['reset_in']) - validuntil = jso['response']['expire_date'] - trafficleft = float(jso['response']['traffic_left']) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 + validuntil = json_data['response']['expire_date'] + trafficleft = float(json_data['response']['traffic_left']) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 premium = True else: - self.log_error(jso['response_details']) + self.log_error(json_data['response_details']) except Exception, e: self.log_error(e, trace=True) @@ -63,13 +63,13 @@ class RapidgatorNet(Account): self.log_debug("API:LOGIN", html) - jso = json.loads(html) + json_data = json.loads(html) - if jso['response_status'] == 200: - data['sid'] = str(jso['response']['session_id']) + if json_data['response_status'] is 200: + data['sid'] = str(json_data['response']['session_id']) return else: - self.log_error(jso['response_details']) + self.log_error(json_data['response_details']) except Exception, e: self.log_error(e, trace=True) diff --git a/module/plugins/accounts/RapiduNet.py b/module/plugins/accounts/RapiduNet.py index 5a852b906..e9d16977d 100644 --- a/module/plugins/accounts/RapiduNet.py +++ b/module/plugins/accounts/RapiduNet.py @@ -4,7 +4,7 @@ import re import time from module.plugins.internal.Account import Account -from module.plugins.internal.utils import json +from module.plugins.internal.misc import json class RapiduNet(Account): @@ -53,14 +53,15 @@ class RapiduNet(Account): post={'_go' : "", 'lang': "en"}) - jso = json.loads(self.load("https://rapidu.net/ajax.php", - get={'a': "getUserLogin"}, - post={'_go' : "", - 'login' : user, - 'pass' : password, - 'remember': "1"})) + html = self.load("https://rapidu.net/ajax.php", + get={'a': "getUserLogin"}, + post={'_go' : "", + 'login' : user, + 'pass' : password, + 'remember': "1"}) + json_data = json.loads(html) - self.log_debug(jso) + self.log_debug(json_data) - if jso['message'] != "success": + if json_data['message'] != "success": self.fail_login() diff --git a/module/plugins/accounts/RarefileNet.py b/module/plugins/accounts/RarefileNet.py index 614dba00b..be6e07f8b 100644 --- a/module/plugins/accounts/RarefileNet.py +++ b/module/plugins/accounts/RarefileNet.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class RarefileNet(XFSAccount): __name__ = "RarefileNet" __type__ = "account" - __version__ = "0.07" + __version__ = "0.08" __status__ = "testing" __description__ = """RareFile.net account plugin""" diff --git a/module/plugins/accounts/RealdebridCom.py b/module/plugins/accounts/RealdebridCom.py index d023a02c8..e09575a9c 100644 --- a/module/plugins/accounts/RealdebridCom.py +++ b/module/plugins/accounts/RealdebridCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.MultiAccount import MultiAccount class RealdebridCom(MultiAccount): __name__ = "RealdebridCom" __type__ = "account" - __version__ = "0.51" + __version__ = "0.52" __status__ = "testing" __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), diff --git a/module/plugins/accounts/RehostTo.py b/module/plugins/accounts/RehostTo.py index 41e0be150..51b10bb67 100644 --- a/module/plugins/accounts/RehostTo.py +++ b/module/plugins/accounts/RehostTo.py @@ -6,7 +6,7 @@ from module.plugins.internal.MultiAccount import MultiAccount class RehostTo(MultiAccount): __name__ = "RehostTo" __type__ = "account" - __version__ = "0.22" + __version__ = "0.23" __status__ = "testing" __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), diff --git a/module/plugins/accounts/SafesharingEu.py b/module/plugins/accounts/SafesharingEu.py index 17a48a62e..541b8ccbf 100644 --- a/module/plugins/accounts/SafesharingEu.py +++ b/module/plugins/accounts/SafesharingEu.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class SafesharingEu(XFSAccount): __name__ = "SafesharingEu" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __description__ = """Safesharing.eu account plugin""" diff --git a/module/plugins/accounts/SecureUploadEu.py b/module/plugins/accounts/SecureUploadEu.py index fef0506f0..912455c1b 100644 --- a/module/plugins/accounts/SecureUploadEu.py +++ b/module/plugins/accounts/SecureUploadEu.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class SecureUploadEu(XFSAccount): __name__ = "SecureUploadEu" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __description__ = """SecureUpload.eu account plugin""" diff --git a/module/plugins/accounts/SendmywayCom.py b/module/plugins/accounts/SendmywayCom.py index 8b9d4a934..39ab861dd 100644 --- a/module/plugins/accounts/SendmywayCom.py +++ b/module/plugins/accounts/SendmywayCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class SendmywayCom(XFSAccount): __name__ = "SendmywayCom" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __description__ = """Sendmyway.com account plugin""" diff --git a/module/plugins/accounts/SharebeastCom.py b/module/plugins/accounts/SharebeastCom.py index e4dc7c4b3..dac203e24 100644 --- a/module/plugins/accounts/SharebeastCom.py +++ b/module/plugins/accounts/SharebeastCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class SharebeastCom(XFSAccount): __name__ = "SharebeastCom" __type__ = "account" - __version__ = "0.04" + __version__ = "0.05" __status__ = "testing" __description__ = """Sharebeast.com account plugin""" diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py index 47f6043dc..be5a537c1 100644 --- a/module/plugins/accounts/ShareonlineBiz.py +++ b/module/plugins/accounts/ShareonlineBiz.py @@ -3,7 +3,7 @@ import re from module.plugins.internal.Account import Account -from module.plugins.internal.utils import set_cookie +from module.plugins.internal.misc import set_cookie class ShareonlineBiz(Account): diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py index 4e6014505..76e933d4e 100644 --- a/module/plugins/accounts/SimplyPremiumCom.py +++ b/module/plugins/accounts/SimplyPremiumCom.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- from module.plugins.internal.MultiAccount import MultiAccount -from module.plugins.internal.utils import json, set_cookie +from module.plugins.internal.misc import json, set_cookie class SimplyPremiumCom(MultiAccount): __name__ = "SimplyPremiumCom" __type__ = "account" - __version__ = "0.11" + __version__ = "0.12" __status__ = "testing" __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), diff --git a/module/plugins/accounts/SimplydebridCom.py b/module/plugins/accounts/SimplydebridCom.py index 94096b8a2..a44cb4108 100644 --- a/module/plugins/accounts/SimplydebridCom.py +++ b/module/plugins/accounts/SimplydebridCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.MultiAccount import MultiAccount class SimplydebridCom(MultiAccount): __name__ = "SimplydebridCom" __type__ = "account" - __version__ = "0.16" + __version__ = "0.17" __status__ = "testing" __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), diff --git a/module/plugins/accounts/SmoozedCom.py b/module/plugins/accounts/SmoozedCom.py index 78642dca1..a6b9ba3be 100644 --- a/module/plugins/accounts/SmoozedCom.py +++ b/module/plugins/accounts/SmoozedCom.py @@ -19,14 +19,14 @@ except ImportError: def hexread(self, octets): return b2a_hex(pbkdf2(self.passphrase, self.salt, self.iterations, octets)) -from module.plugins.internal.utils import json +from module.plugins.internal.misc import json from module.plugins.internal.MultiAccount import MultiAccount class SmoozedCom(MultiAccount): __name__ = "SmoozedCom" __type__ = "account" - __version__ = "0.10" + __version__ = "0.11" __status__ = "testing" __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), @@ -83,6 +83,7 @@ class SmoozedCom(MultiAccount): salt = hashlib.sha256(password).hexdigest() encrypted = PBKDF2(password, salt, iterations=1000).hexread(32) - return json.loads(self.load("http://www2.smoozed.com/api/login", - get={'auth': user, - 'password': encrypted})) + html = self.load("http://www2.smoozed.com/api/login", + get={'auth': user, + 'password': encrypted}) + return json.loads(html) diff --git a/module/plugins/accounts/StreamcloudEu.py b/module/plugins/accounts/StreamcloudEu.py index dc91cc3a7..73a4cb4da 100644 --- a/module/plugins/accounts/StreamcloudEu.py +++ b/module/plugins/accounts/StreamcloudEu.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class StreamcloudEu(XFSAccount): __name__ = "StreamcloudEu" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __description__ = """Streamcloud.eu account plugin""" diff --git a/module/plugins/accounts/TurbobitNet.py b/module/plugins/accounts/TurbobitNet.py index bd4f587f1..da183bebe 100644 --- a/module/plugins/accounts/TurbobitNet.py +++ b/module/plugins/accounts/TurbobitNet.py @@ -4,13 +4,13 @@ import re import time from module.plugins.internal.Account import Account -from module.plugins.internal.utils import set_cookie +from module.plugins.internal.misc import set_cookie class TurbobitNet(Account): __name__ = "TurbobitNet" __type__ = "account" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __description__ = """TurbobitNet account plugin""" diff --git a/module/plugins/accounts/TusfilesNet.py b/module/plugins/accounts/TusfilesNet.py index 883a86cf1..21498b7b1 100644 --- a/module/plugins/accounts/TusfilesNet.py +++ b/module/plugins/accounts/TusfilesNet.py @@ -9,7 +9,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class TusfilesNet(XFSAccount): __name__ = "TusfilesNet" __type__ = "account" - __version__ = "0.09" + __version__ = "0.10" __status__ = "testing" __description__ = """Tusfile.net account plugin""" diff --git a/module/plugins/accounts/UlozTo.py b/module/plugins/accounts/UlozTo.py index 0080375de..2f8ffac1f 100644 --- a/module/plugins/accounts/UlozTo.py +++ b/module/plugins/accounts/UlozTo.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class UlozTo(Account): __name__ = "UlozTo" __type__ = "account" - __version__ = "0.15" + __version__ = "0.16" __status__ = "testing" __description__ = """Uloz.to account plugin""" diff --git a/module/plugins/accounts/UploadableCh.py b/module/plugins/accounts/UploadableCh.py index 1dd9f5fc6..a8f17ad6d 100644 --- a/module/plugins/accounts/UploadableCh.py +++ b/module/plugins/accounts/UploadableCh.py @@ -6,7 +6,7 @@ from module.plugins.internal.Account import Account class UploadableCh(Account): __name__ = "UploadableCh" __type__ = "account" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __description__ = """Uploadable.ch account plugin""" diff --git a/module/plugins/accounts/UploadcCom.py b/module/plugins/accounts/UploadcCom.py index c9298f03d..d41ff40fa 100644 --- a/module/plugins/accounts/UploadcCom.py +++ b/module/plugins/accounts/UploadcCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class UploadcCom(XFSAccount): __name__ = "UploadcCom" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __description__ = """Uploadc.com account plugin""" diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py index 53fd5309e..412df6c0d 100644 --- a/module/plugins/accounts/UploadedTo.py +++ b/module/plugins/accounts/UploadedTo.py @@ -61,11 +61,11 @@ class UploadedTo(Account): def signin(self, user, password, data): try: self.load("http://uploaded.net/me") - + html = self.load("http://uploaded.net/io/login", post={'id': user, 'pw': password}) - + m = re.search(r'"err":"(.+?)"', html) if m is not None: self.fail_login(m.group(1)) diff --git a/module/plugins/accounts/UploadheroCom.py b/module/plugins/accounts/UploadheroCom.py index c1dd8d5e9..31cefb89b 100644 --- a/module/plugins/accounts/UploadheroCom.py +++ b/module/plugins/accounts/UploadheroCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.Account import Account class UploadheroCom(Account): __name__ = "UploadheroCom" __type__ = "account" - __version__ = "0.26" + __version__ = "0.27" __status__ = "testing" __description__ = """Uploadhero.co account plugin""" diff --git a/module/plugins/accounts/UploadingCom.py b/module/plugins/accounts/UploadingCom.py index 48bc75739..777ffb6b2 100644 --- a/module/plugins/accounts/UploadingCom.py +++ b/module/plugins/accounts/UploadingCom.py @@ -4,13 +4,13 @@ import re import time from module.plugins.internal.Account import Account -from module.plugins.internal.utils import set_cookies +from module.plugins.internal.misc import set_cookies class UploadingCom(Account): __name__ = "UploadingCom" __type__ = "account" - __version__ = "0.17" + __version__ = "0.18" __status__ = "testing" __description__ = """Uploading.com account plugin""" diff --git a/module/plugins/accounts/UptoboxCom.py b/module/plugins/accounts/UptoboxCom.py index af23c7458..19223d192 100644 --- a/module/plugins/accounts/UptoboxCom.py +++ b/module/plugins/accounts/UptoboxCom.py @@ -3,14 +3,14 @@ import re import urlparse -from module.plugins.internal.utils import json +from module.plugins.internal.misc import json from module.plugins.internal.XFSAccount import XFSAccount class UptoboxCom(XFSAccount): __name__ = "UptoboxCom" __type__ = "account" - __version__ = "0.19" + __version__ = "0.20" __status__ = "testing" __description__ = """Uptobox.com account plugin""" diff --git a/module/plugins/accounts/VidPlayNet.py b/module/plugins/accounts/VidPlayNet.py index ad68469b6..35d1d9483 100644 --- a/module/plugins/accounts/VidPlayNet.py +++ b/module/plugins/accounts/VidPlayNet.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class VidPlayNet(XFSAccount): __name__ = "VidPlayNet" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __description__ = """VidPlay.net account plugin""" diff --git a/module/plugins/accounts/WebshareCz.py b/module/plugins/accounts/WebshareCz.py index f7d50e74b..23ad90750 100644 --- a/module/plugins/accounts/WebshareCz.py +++ b/module/plugins/accounts/WebshareCz.py @@ -4,7 +4,7 @@ import hashlib import re import time -from passlib.hash import md5_crypt +import passlib.hash from module.plugins.internal.Account import Account @@ -12,7 +12,7 @@ from module.plugins.internal.Account import Account class WebshareCz(Account): __name__ = "WebshareCz" __type__ = "account" - __version__ = "0.13" + __version__ = "0.14" __status__ = "testing" __description__ = """Webshare.cz account plugin""" @@ -50,7 +50,7 @@ class WebshareCz(Account): self.fail_login() salt = re.search('<salt>(.+)</salt>', salt).group(1) - password = hashlib.sha1(md5_crypt.encrypt(password, salt=salt)).hexdigest() + password = hashlib.sha1(passlib.hash.md5_crypt.encrypt(password, salt=salt)).hexdigest() digest = hashlib.md5(user + ":Webshare:" + password).hexdigest() login = self.load("https://webshare.cz/api/login/", diff --git a/module/plugins/accounts/WorldbytezCom.py b/module/plugins/accounts/WorldbytezCom.py index ddbc08ded..75907b951 100644 --- a/module/plugins/accounts/WorldbytezCom.py +++ b/module/plugins/accounts/WorldbytezCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class WorldbytezCom(XFSAccount): __name__ = "WorldbytezCom" __type__ = "account" - __version__ = "0.04" + __version__ = "0.05" __status__ = "testing" __description__ = """Worldbytez.com account plugin""" diff --git a/module/plugins/accounts/YibaishiwuCom.py b/module/plugins/accounts/YibaishiwuCom.py index 3ff0c33d6..805301cff 100644 --- a/module/plugins/accounts/YibaishiwuCom.py +++ b/module/plugins/accounts/YibaishiwuCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.Account import Account class YibaishiwuCom(Account): __name__ = "YibaishiwuCom" __type__ = "account" - __version__ = "0.07" + __version__ = "0.08" __status__ = "testing" __description__ = """115.com account plugin""" diff --git a/module/plugins/accounts/ZeveraCom.py b/module/plugins/accounts/ZeveraCom.py index 48219357f..4c8d535cc 100644 --- a/module/plugins/accounts/ZeveraCom.py +++ b/module/plugins/accounts/ZeveraCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.MultiAccount import MultiAccount class ZeveraCom(MultiAccount): __name__ = "ZeveraCom" __type__ = "account" - __version__ = "0.31" + __version__ = "0.32" __status__ = "testing" __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), diff --git a/module/plugins/captcha/AdYouLike.py b/module/plugins/captcha/AdYouLike.py index c374c5bcf..c21a3d4fa 100644 --- a/module/plugins/captcha/AdYouLike.py +++ b/module/plugins/captcha/AdYouLike.py @@ -2,14 +2,14 @@ import re -from module.plugins.internal.utils import json +from module.plugins.internal.misc import json from module.plugins.internal.CaptchaService import CaptchaService class AdYouLike(CaptchaService): __name__ = "AdYouLike" __type__ = "captcha" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __description__ = """AdYouLike captcha service plugin""" @@ -42,7 +42,7 @@ class AdYouLike(CaptchaService): #: 'all':{'element_id':"ayl_private_cap_92300",'lang':"fr",'env':"prod"}} ayl = json.loads(ayl) - html = self.plugin.load("http://api-ayl.appspot.com/challenge", + html = self.pyfile.plugin.load("http://api-ayl.appspot.com/challenge", get={'key' : ayl['adyoulike']['key'], 'env' : ayl['all']['env'], 'callback': callback}) diff --git a/module/plugins/captcha/AdsCaptcha.py b/module/plugins/captcha/AdsCaptcha.py index e8c578e96..234d2a0cf 100644 --- a/module/plugins/captcha/AdsCaptcha.py +++ b/module/plugins/captcha/AdsCaptcha.py @@ -9,7 +9,7 @@ from module.plugins.internal.CaptchaService import CaptchaService class AdsCaptcha(CaptchaService): __name__ = "AdsCaptcha" __type__ = "captcha" - __version__ = "0.11" + __version__ = "0.12" __status__ = "testing" __description__ = """AdsCaptcha captcha service plugin""" @@ -38,7 +38,7 @@ class AdsCaptcha(CaptchaService): def challenge(self, key=None, data=None): PublicKey, CaptchaId = key or self.retrieve_key(data) - html = self.plugin.load("http://api.adscaptcha.com/Get.aspx", + html = self.pyfile.plugin.load("http://api.adscaptcha.com/Get.aspx", get={'CaptchaId': CaptchaId, 'PublicKey': PublicKey}) try: diff --git a/module/plugins/captcha/CircleCaptcha.py b/module/plugins/captcha/CircleCaptcha.py index 98e54e5ed..482779321 100644 --- a/module/plugins/captcha/CircleCaptcha.py +++ b/module/plugins/captcha/CircleCaptcha.py @@ -31,7 +31,7 @@ class ImageSequence: class CircleCaptcha(OCR): __name__ = "CircleCaptcha" __type__ = "ocr" - __version__ = "1.05" + __version__ = "1.06" __status__ = "testing" __description__ = """Circle captcha ocr plugin""" @@ -71,7 +71,7 @@ class CircleCaptcha(OCR): curcolor = curpix # self.log_debug(x, y, jump, 2) else: - if howmany == 0: + if howmany is 0: #: Found pixel jump = True howmany = howmany + 1 @@ -79,7 +79,7 @@ class CircleCaptcha(OCR): # self.log_debug(x, y, jump, 2) else: howmany = howmany + 1 - if howmany == 1: + if howmany is 1: #: Clean pixel pix[x-1, y] = self.BACKGROUND @@ -102,7 +102,7 @@ class CircleCaptcha(OCR): curcolor = curpix # self.log_debug(x, y, jump) else: - if howmany == 0: + if howmany is 0: #: Found pixel jump = True howmany = howmany + 1 @@ -110,7 +110,7 @@ class CircleCaptcha(OCR): # self.log_debug(x, y, jump) else: howmany = howmany + 1 - if howmany == 1: + if howmany is 1: #: Clean pixel pix[x-1, y] = self.BACKGROUND @@ -277,19 +277,19 @@ class CircleCaptcha(OCR): return -2 cardinalpoints = 0 - if self.verify_point(im, pix, c[0] + c[2], c[1], True) == 1: + if self.verify_point(im, pix, c[0] + c[2], c[1], True) is 1: cardinalpoints = cardinalpoints + 1 if self.verify_point(im, pix, c[0] + c[2], c[1], False) == -1: return -2 - if self.verify_point(im, pix, c[0] - c[2], c[1], True) == 1: + if self.verify_point(im, pix, c[0] - c[2], c[1], True) is 1: cardinalpoints = cardinalpoints + 1 if self.verify_point(im, pix, c[0] - c[2], c[1], False) == -1: return -2 - if self.verify_point(im, pix, c[0], c[1] + c[2], True) == 1: + if self.verify_point(im, pix, c[0], c[1] + c[2], True) is 1: cardinalpoints = cardinalpoints + 1 if self.verify_point(im, pix, c[0], c[1] + c[2], False) == -1: return -2 - if self.verify_point(im, pix, c[0], c[1] - c[2], True) == 1: + if self.verify_point(im, pix, c[0], c[1] - c[2], True) is 1: cardinalpoints = cardinalpoints + 1 if self.verify_point(im, pix, c[0], c[1] - c[2], False) == -1: return -2 @@ -302,7 +302,7 @@ class CircleCaptcha(OCR): y2= int(round(c[1]+ math.sqrt(c[2]**2-(c[0]-x)**2))) howmany = howmany + 2 - if self.verify_point(im, pix, x, y, exactfind) == 0: + if self.verify_point(im, pix, x, y, exactfind) is 0: missing = missing + 1 missinglist.append((x, y)) else: @@ -311,7 +311,7 @@ class CircleCaptcha(OCR): if self.verify_point(im, pix, x, y, False) == -1: return -2 - if self.verify_point(im, pix, x, y2, exactfind) == 0: + if self.verify_point(im, pix, x, y2, exactfind) is 0: missing = missing + 1 missinglist.append((x, y2)) else: @@ -363,19 +363,19 @@ class CircleCaptcha(OCR): return -2 cardinalpoints = 0 - if self.verify_point(im, pix, c[0] + c[2], c[1], True) == 1: + if self.verify_point(im, pix, c[0] + c[2], c[1], True) is 1: cardinalpoints = cardinalpoints + 1 if self.verify_point(im, pix, c[0] + c[2], c[1], False) == -1: return -2 - if self.verify_point(im, pix, c[0] - c[2], c[1], True) == 1: + if self.verify_point(im, pix, c[0] - c[2], c[1], True) is 1: cardinalpoints = cardinalpoints + 1 if self.verify_point(im, pix, c[0] - c[2], c[1], False) == -1: return -2 - if self.verify_point(im, pix, c[0], c[1] + c[2], True) == 1: + if self.verify_point(im, pix, c[0], c[1] + c[2], True) is 1: cardinalpoints = cardinalpoints + 1 if self.verify_point(im, pix, c[0], c[1] + c[2], False) == -1: return -2 - if self.verify_point(im, pix, c[0], c[1] - c[2], True) == 1: + if self.verify_point(im, pix, c[0], c[1] - c[2], True) is 1: cardinalpoints = cardinalpoints + 1 if self.verify_point(im, pix, c[0], c[1] - c[2], False) == -1: return -2 @@ -388,7 +388,7 @@ class CircleCaptcha(OCR): y2= int(round(c[1]+ math.sqrt(c[2]**2-(c[0]-x)**2))) howmany = howmany + 2 - if self.verify_point(im, pix, x, y, exactfind) == 0: + if self.verify_point(im, pix, x, y, exactfind) is 0: missing = missing + 1 missinglist.append((x, y)) else: @@ -397,7 +397,7 @@ class CircleCaptcha(OCR): if self.verify_point(im, pix, x, y, False) == -1: return -2 - if self.verify_point(im, pix, x, y2, exactfind) == 0: + if self.verify_point(im, pix, x, y2, exactfind) is 0: missing = missing + 1 missinglist.append((x, y2)) else: @@ -412,7 +412,7 @@ class CircleCaptcha(OCR): x2= int(round(c[0]+ math.sqrt(c[2]**2-(c[1]-y)**2))) howmany = howmany + 2 - if self.verify_point(im, pix, x, y, exactfind) == 0: + if self.verify_point(im, pix, x, y, exactfind) is 0: missing = missing + 1 missinglist.append((x, y)) else: @@ -421,7 +421,7 @@ class CircleCaptcha(OCR): if self.verify_point(im, pix, x, y, False) == -1: return -2 - if self.verify_point(im, pix, x2, y, exactfind) == 0: + if self.verify_point(im, pix, x2, y, exactfind) is 0: missing = missing + 1 missinglist.append((x2, y)) else: @@ -432,19 +432,19 @@ class CircleCaptcha(OCR): for p in missinglist: #: Left and bottom - if (self.verify_point(im, pix, p[0]-1, p[1], exactfind) == 1 - and self.verify_point(im, pix, p[0], p[1]+1, exactfind) == 1): + if (self.verify_point(im, pix, p[0]-1, p[1], exactfind) is 1 + and self.verify_point(im, pix, p[0], p[1]+1, exactfind) is 1): missing = missing - 1 - elif (self.verify_point(im, pix, p[0]-1, p[1], exactfind) == 1 - and self.verify_point(im, pix, p[0], p[1]-1, exactfind) == 1): + elif (self.verify_point(im, pix, p[0]-1, p[1], exactfind) is 1 + and self.verify_point(im, pix, p[0], p[1]-1, exactfind) is 1): missing = missing - 1 #: Right and bottom - elif (self.verify_point(im, pix, p[0]+1, p[1], exactfind) == 1 - and self.verify_point(im, pix, p[0], p[1]+1, exactfind) == 1): + elif (self.verify_point(im, pix, p[0]+1, p[1], exactfind) is 1 + and self.verify_point(im, pix, p[0], p[1]+1, exactfind) is 1): missing = missing - 1 #: Right and up - elif (self.verify_point(im, pix, p[0]+1, p[1], exactfind) == 1 - and self.verify_point(im, pix, p[0], p[1]-1, exactfind) == 1): + elif (self.verify_point(im, pix, p[0]+1, p[1], exactfind) is 1 + and self.verify_point(im, pix, p[0], p[1]-1, exactfind) is 1): missing = missing - 1 if ((p[0], p[1]+1) in missinglist @@ -455,7 +455,7 @@ class CircleCaptcha(OCR): or (p[0]-1, p[1]+1) in missinglist or (p[0]+1, p[1]-1) in missinglist or (p[0]-1, p[1]-1) in missinglist - or self.verify_point(im, pix, p[0], p[1], False) == 1): + or self.verify_point(im, pix, p[0], p[1], False) is 1): missingconsecutive = missingconsecutive + 1 # else: # pix[p[0], p[1]] = 0 @@ -501,7 +501,7 @@ class CircleCaptcha(OCR): howmany < 80: return -1 # elif missing / howmany < 0.10: - elif missing == 0: + elif missing is 0: self.pointsofcirclefound.extend(pointsofcircle) return 1 elif (missing - missingconsecutive) / howmany < 0.20: @@ -641,7 +641,7 @@ class CircleCaptcha(OCR): x3 = math.floor(x2 - ((x2 - x1) / 2)) y3 = y1 for j in xrange(1, 50): - retval = self.find_last_pixel_y(im, pix, x3, y3, True if invert == 1 else False, -1, True) + retval = self.find_last_pixel_y(im, pix, x3, y3, True if invert is 1 else False, -1, True) # self.log_debug(x3, y3, retval[0], invert) y3 = retval[0] if y3 == -2: @@ -675,10 +675,10 @@ class CircleCaptcha(OCR): if verified == -1: verified = -1 - elif verified == 0: + elif verified is 0: found.add(((c[0], c[1], c[2]), verified)) findnewcircle = True - elif verified == 1: + elif verified is 1: found.add(((c[0], c[1], c[2]), verified)) findnewcircle = True @@ -688,11 +688,11 @@ class CircleCaptcha(OCR): # draw.ellipse((c[0]-c[2], c[1]-c[2], c[0]+c[2], c[1]+c[2]), outline=0) # _pause = "NOTDOUND" # imdebug.save("debug.png", "png") - if verified == 0: + if verified is 0: draw.ellipse((c[0]-c[2], c[1]-c[2], c[0]+c[2], c[1]+c[2]), outline=120) _pause = "OPENED" - if verified == 1: + if verified is 1: draw.ellipse((c[0]-c[2], c[1]-c[2], c[0]+c[2], c[1]+c[2]), outline=65) _pause = "CLOSED" @@ -716,7 +716,7 @@ class CircleCaptcha(OCR): #: Clean results for c in found: verify = c[1] - if verify == 0: + if verify is 0: p = c[0] if (((p[0], p[1]+1, p[2]), 1) in found or ((p[0], p[1]-1, p[2]), 1) in found @@ -752,12 +752,12 @@ class CircleCaptcha(OCR): #: Delete nearly circle verify = -1 - # if verify == 0: + # if verify is 0: # if self.pyload.debug: # pix[c[0][0], c[0][1]] = 90 #(255, 255, 0) # im.save("output.png", "png") # return c[0][0], c[0][1] - # elif verify == 1: + # elif verify is 1: # if self.pyload.debug: # pix[c[0][0], c[0][1]] = 40 #(255, 0, 0) # im.save("output.png", "png") diff --git a/module/plugins/captcha/GigasizeCom.py b/module/plugins/captcha/GigasizeCom.py index bcaceee03..c870ac6a7 100644 --- a/module/plugins/captcha/GigasizeCom.py +++ b/module/plugins/captcha/GigasizeCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.OCR import OCR class GigasizeCom(OCR): __name__ = "GigasizeCom" __type__ = "ocr" - __version__ = "0.15" + __version__ = "0.16" __status__ = "testing" __description__ = """Gigasize.com ocr plugin""" diff --git a/module/plugins/captcha/LinksaveIn.py b/module/plugins/captcha/LinksaveIn.py index 283d9f6eb..34e32a208 100644 --- a/module/plugins/captcha/LinksaveIn.py +++ b/module/plugins/captcha/LinksaveIn.py @@ -15,7 +15,7 @@ from module.plugins.internal.OCR import OCR class LinksaveIn(OCR): __name__ = "LinksaveIn" __type__ = "ocr" - __version__ = "0.15" + __version__ = "0.16" __status__ = "testing" __description__ = """Linksave.in ocr plugin""" @@ -50,15 +50,15 @@ class LinksaveIn(OCR): npix[x, y] = lut[pix[x, y]] frame_nr += 1 new.save(self.data_dir+"unblacked.png") - self.image = new.copy() - self.pixels = self.image.load() + self.img = new.copy() + self.pixels = self.img.load() self.result_captcha = "" def get_bg(self): stat = {} cstat = {} - img = self.image.convert("P") + img = self.img.convert("P") for bgpath in glob.glob(self.data_dir+"bg/*.gif"): stat[bgpath] = 0 bg = Image.open(bgpath) @@ -96,7 +96,7 @@ class LinksaveIn(OCR): def substract_bg(self, bgpath): bg = Image.open(bgpath) - img = self.image.convert("P") + img = self.img.convert("P") bglut = bg.resize((256, 1)) bglut.putdata(xrange(256)) @@ -108,7 +108,7 @@ class LinksaveIn(OCR): bgpix = bg.load() pix = img.load() - orgpix = self.image.load() + orgpix = self.img.load() for x in xrange(bg.size[0]): for y in xrange(bg.size[1]): rgb_bg = bglut[bgpix[x, y]] @@ -120,7 +120,7 @@ class LinksaveIn(OCR): def eval_black_white(self): new = Image.new("RGB", (140, 75)) pix = new.load() - orgpix = self.image.load() + orgpix = self.img.load() thresh = 4 for x in xrange(new.size[0]): for y in xrange(new.size[1]): @@ -135,8 +135,8 @@ class LinksaveIn(OCR): pix[x, y] = (0, 0, 0) if b > max(r, g)+thresh: pix[x, y] = (0, 0, 0) - self.image = new - self.pixels = self.image.load() + self.img = new + self.pixels = self.img.load() def recognize(self, image): @@ -145,15 +145,15 @@ class LinksaveIn(OCR): self.substract_bg(bg) self.eval_black_white() self.to_greyscale() - self.image.save(self.data_dir+"cleaned_pass1.png") + self.img.save(self.data_dir+"cleaned_pass1.png") self.clean(4) self.clean(4) - self.image.save(self.data_dir+"cleaned_pass2.png") + self.img.save(self.data_dir+"cleaned_pass2.png") letters = self.split_captcha_letters() final = "" for n, letter in enumerate(letters): - self.image = letter - self.image.save(ocr.data_dir+"letter%d.png" % n) + self.img = letter + self.img.save(ocr.data_dir+"letter%d.png" % n) self.run_tesser(True, True, False, False) final += self.result_captcha diff --git a/module/plugins/captcha/NetloadIn.py b/module/plugins/captcha/NetloadIn.py index a7b2131c1..b1a9d7027 100644 --- a/module/plugins/captcha/NetloadIn.py +++ b/module/plugins/captcha/NetloadIn.py @@ -6,7 +6,7 @@ from module.plugins.internal.OCR import OCR class NetloadIn(OCR): __name__ = "NetloadIn" __type__ = "ocr" - __version__ = "0.15" + __version__ = "0.16" __status__ = "testing" __description__ = """Netload.in ocr plugin""" diff --git a/module/plugins/captcha/ReCaptcha.py b/module/plugins/captcha/ReCaptcha.py index e2bd5e8ca..b30f110d4 100644 --- a/module/plugins/captcha/ReCaptcha.py +++ b/module/plugins/captcha/ReCaptcha.py @@ -1,19 +1,18 @@ # -*- coding: utf-8 -*- +import base64 import random import re import time import urlparse -from base64 import b64encode - from module.plugins.internal.CaptchaService import CaptchaService class ReCaptcha(CaptchaService): __name__ = "ReCaptcha" __type__ = "captcha" - __version__ = "0.19" + __version__ = "0.20" __status__ = "testing" __description__ = """ReCaptcha captcha service plugin""" @@ -52,7 +51,7 @@ class ReCaptcha(CaptchaService): def _challenge_v1(self, key): - html = self.plugin.load("http://www.google.com/recaptcha/api/challenge", + html = self.pyfile.plugin.load("http://www.google.com/recaptcha/api/challenge", get={'k': key}) try: challenge = re.search("challenge : '(.+?)',", html).group(1) @@ -67,8 +66,8 @@ class ReCaptcha(CaptchaService): def result(self, server, challenge, key): - self.plugin.load("http://www.google.com/recaptcha/api/js/recaptcha.js") - html = self.plugin.load("http://www.google.com/recaptcha/api/reload", + self.pyfile.plugin.load("http://www.google.com/recaptcha/api/js/recaptcha.js") + html = self.pyfile.plugin.load("http://www.google.com/recaptcha/api/reload", get={'c' : challenge, 'k' : key, 'reason': "i", @@ -92,7 +91,7 @@ class ReCaptcha(CaptchaService): def _collect_api_info(self): - html = self.plugin.load("http://www.google.com/recaptcha/api.js") + html = self.pyfile.plugin.load("http://www.google.com/recaptcha/api.js") a = re.search(r'po.src = \'(.*?)\';', html).group(1) vers = a.split("/")[5] @@ -102,7 +101,7 @@ class ReCaptcha(CaptchaService): self.log_debug("API language: %s" % language) - html = self.plugin.load("https://apis.google.com/js/api.js") + html = self.pyfile.plugin.load("https://apis.google.com/js/api.js") b = re.search(r'"h":"(.*?)","', html).group(1) jsh = b.decode('unicode-escape') @@ -112,7 +111,7 @@ class ReCaptcha(CaptchaService): def _prepare_time_and_rpc(self): - self.plugin.load("http://www.google.com/recaptcha/api2/demo") + self.pyfile.plugin.load("http://www.google.com/recaptcha/api2/demo") millis = int(round(time.time() * 1000)) @@ -130,7 +129,7 @@ class ReCaptcha(CaptchaService): def _challenge_v2(self, key, parent=None): if parent is None: try: - parent = urlparse.urljoin("http://", urlparse.urlparse(self.plugin.pyfile.url).netloc) + parent = urlparse.urljoin("http://", urlparse.urlparse(self.pyfile.url).netloc) except Exception: parent = "" @@ -139,7 +138,7 @@ class ReCaptcha(CaptchaService): vers, language, jsh = self._collect_api_info() millis, rpc = self._prepare_time_and_rpc() - html = self.plugin.load("https://www.google.com/recaptcha/api2/anchor", + html = self.pyfile.plugin.load("https://www.google.com/recaptcha/api2/anchor", get={'k' : key, 'hl' : language, 'v' : vers, @@ -152,7 +151,7 @@ class ReCaptcha(CaptchaService): token1 = re.search(r'id="recaptcha-token" value="(.*?)">', html) self.log_debug("Token #1: %s" % token1.group(1)) - html = self.plugin.load("https://www.google.com/recaptcha/api2/frame", + html = self.pyfile.plugin.load("https://www.google.com/recaptcha/api2/frame", get={'c' : token1.group(1), 'hl' : language, 'v' : vers, @@ -174,14 +173,14 @@ class ReCaptcha(CaptchaService): cookies=True, ocr=False, timeout=30) - response = b64encode('{"response":"%s"}' % captcha_response) + response = base64.b64encode('{"response":"%s"}' % captcha_response) self.log_debug("Result: %s" % response) timeToSolve = int(round(time.time() * 1000)) - millis_captcha_loading timeToSolveMore = timeToSolve + int(float("0." + str(random.randint(1, 99999999))) * 500) - html = self.plugin.load("https://www.google.com/recaptcha/api2/userverify", + html = self.pyfile.plugin.load("https://www.google.com/recaptcha/api2/userverify", post={'k' : key, 'c' : token3.group(1), 'response': response, diff --git a/module/plugins/captcha/ShareonlineBiz.py b/module/plugins/captcha/ShareonlineBiz.py index da36fa910..126d022ee 100644 --- a/module/plugins/captcha/ShareonlineBiz.py +++ b/module/plugins/captcha/ShareonlineBiz.py @@ -6,7 +6,7 @@ from module.plugins.internal.OCR import OCR class ShareonlineBiz(OCR): __name__ = "ShareonlineBiz" __type__ = "ocr" - __version__ = "0.15" + __version__ = "0.16" __status__ = "testing" __description__ = """Shareonline.biz ocr plugin""" @@ -18,8 +18,8 @@ class ShareonlineBiz(OCR): def recognize(self, image): self.load_image(image) self.to_greyscale() - self.image = self.image.resize((160, 50)) - self.pixels = self.image.load() + self.img = self.img.resize((160, 50)) + self.pixels = self.img.load() self.threshold(1.85) # self.eval_black_white(240) # self.derotate_by_average() @@ -28,7 +28,7 @@ class ShareonlineBiz(OCR): final = "" for letter in letters: - self.image = letter + self.img = letter self.run_tesser(True, True, False, False) final += self.result_captcha diff --git a/module/plugins/captcha/SolveMedia.py b/module/plugins/captcha/SolveMedia.py index 7acb7d85d..f5fb28fa0 100644 --- a/module/plugins/captcha/SolveMedia.py +++ b/module/plugins/captcha/SolveMedia.py @@ -9,7 +9,7 @@ from module.plugins.internal.CaptchaService import CaptchaService class SolveMedia(CaptchaService): __name__ = "SolveMedia" __type__ = "captcha" - __version__ = "0.16" + __version__ = "0.17" __status__ = "testing" __description__ = """SolveMedia captcha service plugin""" @@ -36,7 +36,7 @@ class SolveMedia(CaptchaService): def challenge(self, key=None, data=None): key = key or self.retrieve_key(data) - html = self.plugin.load("http://api.solvemedia.com/papi/challenge.noscript", + html = self.pyfile.plugin.load("http://api.solvemedia.com/papi/challenge.noscript", get={'k': key}) for i in xrange(1, 11): @@ -62,10 +62,10 @@ class SolveMedia(CaptchaService): except Fail, e: self.log_warning(e, trace=True) - self.plugin.invalidCaptcha() + self.pyfile.plugin.invalidCaptcha() result = None - html = self.plugin.load("http://api.solvemedia.com/papi/verify.noscript", + html = self.pyfile.plugin.load("http://api.solvemedia.com/papi/verify.noscript", post={'adcopy_response' : result, 'k' : key, 'l' : "en", @@ -73,7 +73,7 @@ class SolveMedia(CaptchaService): 's' : "standard", 'magic' : magic, 'adcopy_challenge': challenge, - 'ref' : self.plugin.pyfile.url}) + 'ref' : self.pyfile.url}) try: redirect = re.search(r'URL=(.+?)">', html).group(1) @@ -84,7 +84,7 @@ class SolveMedia(CaptchaService): if "error" in html: self.log_warning(_("Captcha code was invalid")) self.log_debug("Retry #%d" % i) - html = self.plugin.load(redirect) + html = self.pyfile.plugin.load(redirect) else: break diff --git a/module/plugins/container/CCF.py b/module/plugins/container/CCF.py index 563eaef6d..2cafb2977 100644 --- a/module/plugins/container/CCF.py +++ b/module/plugins/container/CCF.py @@ -8,19 +8,19 @@ import urllib2 import MultipartPostHandler from module.plugins.internal.Container import Container -from module.plugins.internal.utils import encode, fs_join +from module.plugins.internal.misc import encode, fsjoin class CCF(Container): __name__ = "CCF" __type__ = "container" - __version__ = "0.27" + __version__ = "0.28" __status__ = "testing" __pattern__ = r'.+\.ccf$' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available", True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default")] __description__ = """CCF container decrypter plugin""" __license__ = "GPLv3" @@ -29,7 +29,7 @@ class CCF(Container): def decrypt(self, pyfile): - fs_filename = encode(pyfile.url.strip()) + fs_filename = encode(pyfile.url) opener = urllib2.build_opener(MultipartPostHandler.MultipartPostHandler) dlc_content = opener.open('http://service.jdownloader.net/dlcrypt/getDLC.php', @@ -38,7 +38,7 @@ class CCF(Container): 'upload' : open(fs_filename, "rb")}).read() dl_folder = self.pyload.config.get("general", "download_folder") - dlc_file = fs_join(dl_folder, "tmp_%s.dlc" % pyfile.name) + dlc_file = fsjoin(dl_folder, "tmp_%s.dlc" % pyfile.name) try: dlc = re.search(r'<dlc>(.+)</dlc>', dlc_content, re.S).group(1).decode('base64') diff --git a/module/plugins/container/DLC.py b/module/plugins/container/DLC.py index 7b4364a0a..91e421590 100644 --- a/module/plugins/container/DLC.py +++ b/module/plugins/container/DLC.py @@ -5,22 +5,22 @@ from __future__ import with_statement import re import xml.dom.minidom -from Crypto.Cipher import AES +import Crypto.Cipher from module.plugins.internal.Container import Container -from module.plugins.internal.utils import decode, encode +from module.plugins.internal.misc import decode, encode class DLC(Container): __name__ = "DLC" __type__ = "container" - __version__ = "0.28" + __version__ = "0.29" __status__ = "testing" __pattern__ = r'(.+\.dlc|[\w\+^_]+==[\w\+^_/]+==)$' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available", True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default")] __description__ = """DLC container decrypter plugin""" __license__ = "GPLv3" @@ -37,7 +37,7 @@ class DLC(Container): def decrypt(self, pyfile): - fs_filename = encode(pyfile.url.strip()) + fs_filename = encode(pyfile.url) with open(fs_filename) as dlc: data = dlc.read().strip() @@ -53,9 +53,9 @@ class DLC(Container): except AttributeError: self.fail(_("Container is corrupted")) - key = iv = AES.new(self.KEY, AES.MODE_CBC, self.IV).decrypt(rc) + key = iv = Crypto.Cipher.AES.new(self.KEY, Crypto.Cipher.AES.MODE_CBC, self.IV).decrypt(rc) - self.data = AES.new(key, AES.MODE_CBC, iv).decrypt(dlc_data).decode('base64') + self.data = Crypto.Cipher.AES.new(key, Crypto.Cipher.AES.MODE_CBC, iv).decrypt(dlc_data).decode('base64') self.packages = [(name or pyfile.name, links, name or pyfile.name) \ for name, links in self.get_packages()] diff --git a/module/plugins/container/RSDF.py b/module/plugins/container/RSDF.py index 2401a79ce..ec9e89171 100644 --- a/module/plugins/container/RSDF.py +++ b/module/plugins/container/RSDF.py @@ -5,22 +5,22 @@ from __future__ import with_statement import binascii import re -from Crypto.Cipher import AES +import Crypto.Cipher from module.plugins.internal.Container import Container -from module.plugins.internal.utils import encode +from module.plugins.internal.misc import encode class RSDF(Container): __name__ = "RSDF" __type__ = "container" - __version__ = "0.33" + __version__ = "0.34" __status__ = "testing" __pattern__ = r'.+\.rsdf$' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available", True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default")] __description__ = """RSDF container decrypter plugin""" __license__ = "GPLv3" @@ -37,11 +37,11 @@ class RSDF(Container): KEY = binascii.unhexlify(self.KEY) IV = binascii.unhexlify(self.IV) - iv = AES.new(KEY, AES.MODE_ECB).encrypt(IV) - cipher = AES.new(KEY, AES.MODE_CFB, iv) + iv = Crypto.Cipher.AES.new(KEY, Crypto.Cipher.AES.MODE_ECB).encrypt(IV) + cipher = Crypto.Cipher.AES.new(KEY, Crypto.Cipher.AES.MODE_CFB, iv) try: - fs_filename = encode(pyfile.url.strip()) + fs_filename = encode(pyfile.url) with open(fs_filename, 'r') as rsdf: data = rsdf.read() diff --git a/module/plugins/container/TXT.py b/module/plugins/container/TXT.py index 741538947..6ab870d94 100644 --- a/module/plugins/container/TXT.py +++ b/module/plugins/container/TXT.py @@ -3,21 +3,21 @@ import codecs from module.plugins.internal.Container import Container -from module.plugins.internal.utils import encode +from module.plugins.internal.misc import encode class TXT(Container): __name__ = "TXT" __type__ = "container" - __version__ = "0.19" + __version__ = "0.20" __status__ = "testing" __pattern__ = r'.+\.(txt|text)$' - __config__ = [("activated" , "bool", "Activated" , True ), - ("use_subfolder" , "bool", "Save package to subfolder" , True ), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True ), - ("flush" , "bool", "Flush list after adding" , False ), - ("encoding" , "str" , "File encoding" , "utf-8")] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available", True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("flush" , "bool" , "Flush list after adding" , False ), + ("encoding" , "str" , "File encoding" , "utf-8" )] __description__ = """Read link lists in plain text formats""" __license__ = "GPLv3" @@ -27,12 +27,12 @@ class TXT(Container): def decrypt(self, pyfile): try: - encoding = codecs.lookup(self.get_config('encoding')).name + encoding = codecs.lookup(self.config.get('encoding')).name except Exception: encoding = "utf-8" - fs_filename = encode(pyfile.url.strip()) + fs_filename = encode(pyfile.url) txt = codecs.open(fs_filename, 'r', encoding) curPack = "Parsed links from %s" % pyfile.name packages = {curPack:[],} @@ -61,7 +61,7 @@ class TXT(Container): if not value: packages.pop(key, None) - if self.get_config('flush'): + if self.config.get('flush'): try: txt = open(fs_filename, 'wb') txt.close() diff --git a/module/plugins/crypter/BitshareComFolder.py b/module/plugins/crypter/BitshareComFolder.py index c1c4a915b..ab7cec80a 100644 --- a/module/plugins/crypter/BitshareComFolder.py +++ b/module/plugins/crypter/BitshareComFolder.py @@ -1,20 +1,19 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter class BitshareComFolder(SimpleCrypter): __name__ = "BitshareComFolder" __type__ = "crypter" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __pattern__ = r'http://(?:www\.)?bitshare\.com/\?d=\w+' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Bitshare.com folder decrypter plugin""" __license__ = "GPLv3" @@ -23,6 +22,3 @@ class BitshareComFolder(SimpleCrypter): LINK_PATTERN = r'<a href="(http://bitshare\.com/files/.+)">.+</a></td>' NAME_PATTERN = r'View public folder "(?P<N>.+?)"</h1>' - - -getInfo = create_getInfo(BitshareComFolder) diff --git a/module/plugins/crypter/C1NeonCom.py b/module/plugins/crypter/C1NeonCom.py index de0868fa1..b00fa1eae 100644 --- a/module/plugins/crypter/C1NeonCom.py +++ b/module/plugins/crypter/C1NeonCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from module.plugins.internal.DeadCrypter import DeadCrypter class C1NeonCom(DeadCrypter): __name__ = "C1NeonCom" __type__ = "crypter" - __version__ = "0.08" + __version__ = "0.09" __status__ = "stable" __pattern__ = r'http://(?:www\.)?c1neon\.com/.+' @@ -15,6 +15,3 @@ class C1NeonCom(DeadCrypter): __description__ = """C1neon.com decrypter plugin""" __license__ = "GPLv3" __authors__ = [("godofdream", "soilfiction@gmail.com")] - - -getInfo = create_getInfo(C1NeonCom) diff --git a/module/plugins/crypter/ChipDe.py b/module/plugins/crypter/ChipDe.py index ced06fe0c..66ef9c5bf 100644 --- a/module/plugins/crypter/ChipDe.py +++ b/module/plugins/crypter/ChipDe.py @@ -2,20 +2,19 @@ import re -from module.plugins.internal.Crypter import Crypter, create_getInfo +from module.plugins.internal.Crypter import Crypter class ChipDe(Crypter): __name__ = "ChipDe" __type__ = "crypter" - __version__ = "0.14" + __version__ = "0.15" __status__ = "testing" __pattern__ = r'http://(?:www\.)?chip\.de/video/.+\.html' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available", True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default")] __description__ = """Chip.de decrypter plugin""" __license__ = "GPLv3" @@ -33,6 +32,3 @@ class ChipDe(Crypter): else: self.links = [f.group(1)] self.log_debug("The file URL is %s" % self.links[0]) - - -getInfo = create_getInfo(ChipDe) diff --git a/module/plugins/crypter/CloudzillaToFolder.py b/module/plugins/crypter/CloudzillaToFolder.py index e8a2b5525..22f477300 100644 --- a/module/plugins/crypter/CloudzillaToFolder.py +++ b/module/plugins/crypter/CloudzillaToFolder.py @@ -2,21 +2,20 @@ import re -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter class CloudzillaToFolder(SimpleCrypter): __name__ = "CloudzillaToFolder" __type__ = "crypter" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __pattern__ = r'http://(?:www\.)?cloudzilla\.to/share/folder/(?P<ID>[\w^_]+)' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Cloudzilla.to folder decrypter plugin""" __license__ = "GPLv3" @@ -38,6 +37,3 @@ class CloudzillaToFolder(SimpleCrypter): if re.search(self.PASSWORD_PATTERN, self.data): self.retry(msg="Wrong password") - - -getInfo = create_getInfo(CloudzillaToFolder) diff --git a/module/plugins/crypter/CrockoComFolder.py b/module/plugins/crypter/CrockoComFolder.py index b6d3ba214..c07773c0d 100644 --- a/module/plugins/crypter/CrockoComFolder.py +++ b/module/plugins/crypter/CrockoComFolder.py @@ -1,20 +1,19 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter class CrockoComFolder(SimpleCrypter): __name__ = "CrockoComFolder" __type__ = "crypter" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __pattern__ = r'http://(?:www\.)?crocko\.com/f/.+' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Crocko.com folder decrypter plugin""" __license__ = "GPLv3" @@ -22,6 +21,3 @@ class CrockoComFolder(SimpleCrypter): LINK_PATTERN = r'<td class="last"><a href="(.+?)">download</a>' - - -getInfo = create_getInfo(CrockoComFolder) diff --git a/module/plugins/crypter/CryptItCom.py b/module/plugins/crypter/CryptItCom.py index 742483017..c30595f29 100644 --- a/module/plugins/crypter/CryptItCom.py +++ b/module/plugins/crypter/CryptItCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from module.plugins.internal.DeadCrypter import DeadCrypter class CryptItCom(DeadCrypter): __name__ = "CryptItCom" __type__ = "crypter" - __version__ = "0.14" + __version__ = "0.15" __status__ = "stable" __pattern__ = r'http://(?:www\.)?crypt-it\.com/(s|e|d|c)/\w+' @@ -15,6 +15,3 @@ class CryptItCom(DeadCrypter): __description__ = """Crypt-it.com decrypter plugin""" __license__ = "GPLv3" __authors__ = [("jeix", "jeix@hasnomail.de")] - - -getInfo = create_getInfo(CryptItCom) diff --git a/module/plugins/crypter/CzshareComFolder.py b/module/plugins/crypter/CzshareComFolder.py index 07c8471d5..4bf2c2a8e 100644 --- a/module/plugins/crypter/CzshareComFolder.py +++ b/module/plugins/crypter/CzshareComFolder.py @@ -2,20 +2,19 @@ import re -from module.plugins.internal.Crypter import Crypter, create_getInfo +from module.plugins.internal.Crypter import Crypter class CzshareComFolder(Crypter): __name__ = "CzshareComFolder" __type__ = "crypter" - __version__ = "0.25" + __version__ = "0.26" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/folders/.+' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available", True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default")] __description__ = """Czshare.com folder decrypter plugin, now Sdilej.cz""" __license__ = "GPLv3" @@ -34,6 +33,3 @@ class CzshareComFolder(Crypter): self.error(_("FOLDER_PATTERN not found")) self.links.extend(re.findall(self.LINK_PATTERN, m.group(1))) - - -getInfo = create_getInfo(CzshareComFolder) diff --git a/module/plugins/crypter/DailymotionComFolder.py b/module/plugins/crypter/DailymotionComFolder.py index 35db79a0d..04eb4d939 100644 --- a/module/plugins/crypter/DailymotionComFolder.py +++ b/module/plugins/crypter/DailymotionComFolder.py @@ -3,21 +3,20 @@ import re import urlparse -from module.plugins.internal.Crypter import Crypter, create_getInfo -from module.plugins.internal.utils import fs_join, json +from module.plugins.internal.Crypter import Crypter +from module.plugins.internal.misc import fsjoin, json class DailymotionComFolder(Crypter): __name__ = "DailymotionComFolder" __type__ = "crypter" - __version__ = "0.06" + __version__ = "0.07" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?dailymotion\.com/((playlists/)?(?P<TYPE>playlist|user)/)?(?P<ID>[\w^_]+)(?(TYPE)|#)' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available", True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default")] __description__ = """Dailymotion.com channel & playlist decrypter""" __license__ = "GPLv3" @@ -101,9 +100,6 @@ class DailymotionComFolder(Crypter): for p_id, p_name, p_owner in playlists: p_videos = self.get_videos(p_id) - p_folder = fs_join(self.pyload.config.get("general", "download_folder"), p_owner, p_name) + p_folder = fsjoin(self.pyload.config.get("general", "download_folder"), p_owner, p_name) self.log_debug("%s video\s found on playlist \"%s\"" % (len(p_videos), p_name)) self.packages.append((p_name, p_videos, p_folder)) #@NOTE: Folder is NOT recognized by pyload 0.4.9! - - -getInfo = create_getInfo(DailymotionComFolder) diff --git a/module/plugins/crypter/DataHuFolder.py b/module/plugins/crypter/DataHuFolder.py index ff8ae6b74..270a41b3c 100644 --- a/module/plugins/crypter/DataHuFolder.py +++ b/module/plugins/crypter/DataHuFolder.py @@ -2,21 +2,20 @@ import re -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter class DataHuFolder(SimpleCrypter): __name__ = "DataHuFolder" __type__ = "crypter" - __version__ = "0.11" + __version__ = "0.12" __status__ = "testing" __pattern__ = r'http://(?:www\.)?data\.hu/dir/\w+' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Data.hu folder decrypter plugin""" __license__ = "GPLv3" @@ -42,6 +41,3 @@ class DataHuFolder(SimpleCrypter): if u'Hib\xe1s jelsz\xf3' in self.data: #: Wrong password self.fail(_("Wrong password")) - - -getInfo = create_getInfo(DataHuFolder) diff --git a/module/plugins/crypter/DdlstorageComFolder.py b/module/plugins/crypter/DdlstorageComFolder.py index cf0b72071..62751503b 100644 --- a/module/plugins/crypter/DdlstorageComFolder.py +++ b/module/plugins/crypter/DdlstorageComFolder.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from module.plugins.internal.DeadCrypter import DeadCrypter class DdlstorageComFolder(DeadCrypter): __name__ = "DdlstorageComFolder" __type__ = "crypter" - __version__ = "0.07" + __version__ = "0.08" __status__ = "stable" __pattern__ = r'https?://(?:www\.)?ddlstorage\.com/folder/\w+' @@ -16,6 +16,3 @@ class DdlstorageComFolder(DeadCrypter): __license__ = "GPLv3" __authors__ = [("godofdream", "soilfiction@gmail.com"), ("stickell", "l.stickell@yahoo.it")] - - -getInfo = create_getInfo(DdlstorageComFolder) diff --git a/module/plugins/crypter/DepositfilesComFolder.py b/module/plugins/crypter/DepositfilesComFolder.py index 5b5a096ea..e34b07486 100644 --- a/module/plugins/crypter/DepositfilesComFolder.py +++ b/module/plugins/crypter/DepositfilesComFolder.py @@ -1,20 +1,19 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter class DepositfilesComFolder(SimpleCrypter): __name__ = "DepositfilesComFolder" __type__ = "crypter" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __pattern__ = r'http://(?:www\.)?depositfiles\.com/folders/\w+' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Depositfiles.com folder decrypter plugin""" __license__ = "GPLv3" @@ -22,6 +21,3 @@ class DepositfilesComFolder(SimpleCrypter): LINK_PATTERN = r'<div class="progressName".*?>\s*<a href="(.+?)" title=".+?" target="_blank">' - - -getInfo = create_getInfo(DepositfilesComFolder) diff --git a/module/plugins/crypter/Dereferer.py b/module/plugins/crypter/Dereferer.py index 8581134c0..52898eb62 100644 --- a/module/plugins/crypter/Dereferer.py +++ b/module/plugins/crypter/Dereferer.py @@ -8,15 +8,14 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter class Dereferer(SimpleCrypter): __name__ = "Dereferer" __type__ = "crypter" - __version__ = "0.24" + __version__ = "0.25" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(?:\w+\.)*?(?P<DOMAIN>(?:[\d.]+|[\w\-]{3,63}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/.*?(?P<LINK>[\w^_]+://.+)' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Universal link dereferer""" __license__ = "GPLv3" diff --git a/module/plugins/crypter/DevhostStFolder.py b/module/plugins/crypter/DevhostStFolder.py index 68c069cfc..0d6753baa 100644 --- a/module/plugins/crypter/DevhostStFolder.py +++ b/module/plugins/crypter/DevhostStFolder.py @@ -6,21 +6,20 @@ import re import urlparse -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter class DevhostStFolder(SimpleCrypter): __name__ = "DevhostStFolder" __type__ = "crypter" - __version__ = "0.09" + __version__ = "0.10" __status__ = "testing" __pattern__ = r'http://(?:www\.)?d-h\.st/users/(?P<USER>\w+)(/\?fld_id=(?P<ID>\d+))?' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """D-h.st folder decrypter plugin""" __license__ = "GPLv3" @@ -63,6 +62,3 @@ class DevhostStFolder(SimpleCrypter): self.log_debug("File name: %s" % self.pyfile.name, "File folder: %s" % self.pyfile.name) - - -getInfo = create_getInfo(DevhostStFolder) diff --git a/module/plugins/crypter/DlProtectCom.py b/module/plugins/crypter/DlProtectCom.py index 874815eee..c9c28ba48 100644 --- a/module/plugins/crypter/DlProtectCom.py +++ b/module/plugins/crypter/DlProtectCom.py @@ -1,26 +1,23 @@ # -*- coding: utf-8 -*- +import base64 import re import time -import base64 -from base64 import urlsafe_b64encode - -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter class DlProtectCom(SimpleCrypter): __name__ = "DlProtectCom" __type__ = "crypter" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?dl-protect\.com/((en|fr)/)?\w+' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Dl-protect.com decrypter plugin""" __license__ = "GPLv3" @@ -31,6 +28,7 @@ class DlProtectCom(SimpleCrypter): OFFLINE_PATTERN = r'Unfortunately, the link you are looking for is not found' + # Information decoding # For test purposes def info_decode(self, i): @@ -43,7 +41,7 @@ class DlProtectCom(SimpleCrypter): i = base64.b64decode(i) # Split information infos = i.split('|') - assert(len(infos) == 4) + assert(len(infos) is 4) res = infos[0] user_agent = infos[1] plugins = [x.split(';') for x in infos[2].split('&')] @@ -72,7 +70,7 @@ class DlProtectCom(SimpleCrypter): # Sample configuration def conf(self): - useragent = self.get_config('useragent', plugin="UserAgentSwitcher") + useragent = self.pyload.api.getConfigValue("UserAgentSwitcher", "useragent", "plugin") conf = {'res': '1280x611x24', 'java': True, 'user_agent': useragent, @@ -98,7 +96,7 @@ class DlProtectCom(SimpleCrypter): else: mstime = int(round(time.time() * 1000)) - b64time = "_" + urlsafe_b64encode(str(mstime)).replace("=", "%3D") + b64time = "_" + base64.urlsafe_b64encode(str(mstime)).replace("=", "%3D") post_req.update({'i' : b64time, 'submitform': "Decrypt+link"}) @@ -124,6 +122,3 @@ class DlProtectCom(SimpleCrypter): # Filters interesting urls from ads return re.findall(r'<a href="(?P<id>[^/].+?)" target="_blank">(?P=id)</a>', self.data) - - -getInfo = create_getInfo(DlProtectCom) diff --git a/module/plugins/crypter/DuckCryptInfo.py b/module/plugins/crypter/DuckCryptInfo.py index c12ffc977..d16a0287d 100644 --- a/module/plugins/crypter/DuckCryptInfo.py +++ b/module/plugins/crypter/DuckCryptInfo.py @@ -4,20 +4,19 @@ import re import BeautifulSoup -from module.plugins.internal.Crypter import Crypter, create_getInfo +from module.plugins.internal.Crypter import Crypter class DuckCryptInfo(Crypter): __name__ = "DuckCryptInfo" __type__ = "crypter" - __version__ = "0.06" + __version__ = "0.07" __status__ = "testing" __pattern__ = r'http://(?:www\.)?duckcrypt\.info/(folder|wait|link)/(\w+)/?(\w*)' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available", True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default")] __description__ = """DuckCrypt.info decrypter plugin""" __license__ = "GPLv3" @@ -60,6 +59,3 @@ class DuckCryptInfo(Crypter): self.links = [soup.find("iframe")['src']] if not self.links: self.log_info(_("No link found")) - - -getInfo = create_getInfo(DuckCryptInfo) diff --git a/module/plugins/crypter/DuploadOrgFolder.py b/module/plugins/crypter/DuploadOrgFolder.py index 897736669..3f96012ca 100644 --- a/module/plugins/crypter/DuploadOrgFolder.py +++ b/module/plugins/crypter/DuploadOrgFolder.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from module.plugins.internal.DeadCrypter import DeadCrypter class DuploadOrgFolder(DeadCrypter): __name__ = "DuploadOrgFolder" __type__ = "crypter" - __version__ = "0.06" + __version__ = "0.07" __status__ = "stable" __pattern__ = r'http://(?:www\.)?dupload\.org/folder/\d+' @@ -15,6 +15,3 @@ class DuploadOrgFolder(DeadCrypter): __description__ = """Dupload.org folder decrypter plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] - - -getInfo = create_getInfo(DuploadOrgFolder) diff --git a/module/plugins/crypter/EasybytezComFolder.py b/module/plugins/crypter/EasybytezComFolder.py index 9fa2740b8..ef874dc1e 100644 --- a/module/plugins/crypter/EasybytezComFolder.py +++ b/module/plugins/crypter/EasybytezComFolder.py @@ -1,20 +1,19 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSCrypter import XFSCrypter, create_getInfo +from module.plugins.internal.XFSCrypter import XFSCrypter class EasybytezComFolder(XFSCrypter): __name__ = "EasybytezComFolder" __type__ = "crypter" - __version__ = "0.15" + __version__ = "0.16" __status__ = "testing" __pattern__ = r'http://(?:www\.)?easybytez\.com/users/\d+/\d+' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Easybytez.com folder decrypter plugin""" __license__ = "GPLv3" @@ -24,6 +23,3 @@ class EasybytezComFolder(XFSCrypter): PLUGIN_DOMAIN = "easybytez.com" LOGIN_ACCOUNT = True - - -getInfo = create_getInfo(EasybytezComFolder) diff --git a/module/plugins/crypter/EmbeduploadCom.py b/module/plugins/crypter/EmbeduploadCom.py index 4e232f38e..b0805aa80 100644 --- a/module/plugins/crypter/EmbeduploadCom.py +++ b/module/plugins/crypter/EmbeduploadCom.py @@ -2,23 +2,22 @@ import re -from module.plugins.internal.Crypter import Crypter, create_getInfo +from module.plugins.internal.Crypter import Crypter from module.network.HTTPRequest import BadHeader class EmbeduploadCom(Crypter): __name__ = "EmbeduploadCom" __type__ = "crypter" - __version__ = "0.06" + __version__ = "0.07" __status__ = "testing" __pattern__ = r'http://(?:www\.)?embedupload\.com/\?d=.+' - __config__ = [("activated" , "bool", "Activated" , True ), - ("use_premium" , "bool", "Use premium account if available" , True ), - ("use_subfolder" , "bool", "Save package to subfolder" , True ), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True ), - ("preferedHoster" , "str" , "Prefered hoster list (bar-separated)", "embedupload"), - ("ignoredHoster" , "str" , "Ignored hoster list (bar-separated)" , "" )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default" ), + ("preferedHoster" , "str" , "Prefered hoster list (bar-separated)", "embedupload"), + ("ignoredHoster" , "str" , "Ignored hoster list (bar-separated)" , "" )] __description__ = """EmbedUpload.com decrypter plugin""" __license__ = "GPLv3" @@ -34,7 +33,7 @@ class EmbeduploadCom(Crypter): m = re.findall(self.LINK_PATTERN, self.data) if m is not None: - prefered_set = set(self.get_config('preferedHoster').split('|')) + prefered_set = set(self.config.get('preferedHoster').split('|')) prefered_set = map(lambda s: s.lower().split('.')[0], prefered_set) self.log_debug("PF: %s" % prefered_set) @@ -43,7 +42,7 @@ class EmbeduploadCom(Crypter): self.links = self.get_location(tmp_links) if not self.links: - ignored_set = set(self.get_config('ignoredHoster').split('|')) + ignored_set = set(self.config.get('ignoredHoster').split('|')) ignored_set = map(lambda s: s.lower().split('.')[0], ignored_set) self.log_debug("IG: %s" % ignored_set) @@ -62,6 +61,3 @@ class EmbeduploadCom(Crypter): except BadHeader: pass return new_links - - -getInfo = create_getInfo(EmbeduploadCom) diff --git a/module/plugins/crypter/FilebeerInfoFolder.py b/module/plugins/crypter/FilebeerInfoFolder.py index b3c2e1903..ed2abf7ce 100644 --- a/module/plugins/crypter/FilebeerInfoFolder.py +++ b/module/plugins/crypter/FilebeerInfoFolder.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from module.plugins.internal.DeadCrypter import DeadCrypter class FilebeerInfoFolder(DeadCrypter): __name__ = "FilebeerInfoFolder" __type__ = "crypter" - __version__ = "0.06" + __version__ = "0.07" __status__ = "stable" __pattern__ = r'http://(?:www\.)?filebeer\.info/\d*~f\w+' @@ -15,6 +15,3 @@ class FilebeerInfoFolder(DeadCrypter): __description__ = """Filebeer.info folder decrypter plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - -getInfo = create_getInfo(FilebeerInfoFolder) diff --git a/module/plugins/crypter/FilecloudIoFolder.py b/module/plugins/crypter/FilecloudIoFolder.py index 61ff1de5c..d7f576559 100644 --- a/module/plugins/crypter/FilecloudIoFolder.py +++ b/module/plugins/crypter/FilecloudIoFolder.py @@ -1,20 +1,19 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter class FilecloudIoFolder(SimpleCrypter): __name__ = "FilecloudIoFolder" __type__ = "crypter" - __version__ = "0.07" + __version__ = "0.08" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(filecloud\.io|ifile\.it)/_\w+' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Filecloud.io folder decrypter plugin""" __license__ = "GPLv3" @@ -23,6 +22,3 @@ class FilecloudIoFolder(SimpleCrypter): LINK_PATTERN = r'href="(http://filecloud\.io/\w+)" title' NAME_PATTERN = r'>(?P<N>.+?) - filecloud\.io<' - - -getInfo = create_getInfo(FilecloudIoFolder) diff --git a/module/plugins/crypter/FilecryptCc.py b/module/plugins/crypter/FilecryptCc.py index d435f4b9d..517dc7652 100644 --- a/module/plugins/crypter/FilecryptCc.py +++ b/module/plugins/crypter/FilecryptCc.py @@ -7,9 +7,9 @@ import binascii import re import urlparse -from Crypto.Cipher import AES +import Crypto.Cipher -from module.plugins.internal.Crypter import Crypter, create_getInfo +from module.plugins.internal.Crypter import Crypter from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.captcha.SolveMedia import SolveMedia @@ -17,7 +17,7 @@ from module.plugins.captcha.SolveMedia import SolveMedia class FilecryptCc(Crypter): __name__ = "FilecryptCc" __type__ = "crypter" - __version__ = "0.22" + __version__ = "0.23" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?filecrypt\.cc/Container/\w+' @@ -119,10 +119,11 @@ class FilecryptCc(Crypter): elif m3: #: Solvemedia captcha self.log_debug("Solvemedia Captcha URL: %s" % urlparse.urljoin(self.pyfile.url, m3.group(1))) - solvemedia = SolveMedia(self) + solvemedia = SolveMedia(self.pyfile) captcha_key = solvemedia.detect_key() if captcha_key: + self.captcha = solvemedia response, challenge = solvemedia.challenge(captcha_key) self.site_with_links = self.load(self.pyfile.url, post={'adcopy_response' : response, @@ -133,10 +134,12 @@ class FilecryptCc(Crypter): self.retry() else: - recaptcha = ReCaptcha(self) + recaptcha = ReCaptcha(self.pyfile) captcha_key = recaptcha.detect_key() if captcha_key: + self.captcha = recaptcha + try: response, challenge = recaptcha.challenge(captcha_key) @@ -202,7 +205,7 @@ class FilecryptCc(Crypter): #: Decrypt Key = key IV = key - obj = AES.new(Key, AES.MODE_CBC, IV) + obj = Crypto.Cipher.AES.new(Key, Crypto.Cipher.AES.MODE_CBC, IV) text = obj.decrypt(crypted.decode('base64')) #: Extract links @@ -210,6 +213,3 @@ class FilecryptCc(Crypter): links = filter(bool, text.split('\n')) return links - - -getInfo = create_getInfo(FilecryptCc) diff --git a/module/plugins/crypter/FilefactoryComFolder.py b/module/plugins/crypter/FilefactoryComFolder.py index e5623435f..f1793890f 100644 --- a/module/plugins/crypter/FilefactoryComFolder.py +++ b/module/plugins/crypter/FilefactoryComFolder.py @@ -1,20 +1,19 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter class FilefactoryComFolder(SimpleCrypter): __name__ = "FilefactoryComFolder" __type__ = "crypter" - __version__ = "0.36" + __version__ = "0.37" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?filefactory\.com/(?:f|folder)/\w+' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Filefactory.com folder decrypter plugin""" __license__ = "GPLv3" @@ -30,6 +29,3 @@ class FilefactoryComFolder(SimpleCrypter): def load_page(self, page_n): return self.load(self.pyfile.url, get={'page': page_n, 'show': 100}) - - -getInfo = create_getInfo(FilefactoryComFolder) diff --git a/module/plugins/crypter/FilerNetFolder.py b/module/plugins/crypter/FilerNetFolder.py index b48b8b38e..6049485a4 100644 --- a/module/plugins/crypter/FilerNetFolder.py +++ b/module/plugins/crypter/FilerNetFolder.py @@ -1,20 +1,19 @@ import re -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter class FilerNetFolder(SimpleCrypter): __name__ = "FilerNetFolder" __type__ = "crypter" - __version__ = "0.46" + __version__ = "0.47" __status__ = "testing" __pattern__ = r'https?://filer\.net/folder/\w{16}' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Filer.net decrypter plugin""" __license__ = "GPLv3" @@ -26,6 +25,3 @@ class FilerNetFolder(SimpleCrypter): NAME_PATTERN = r'<h3>(?P<N>.+?) - <small' OFFLINE_PATTERN = r'Nicht gefunden' - - -getInfo = create_getInfo(FilerNetFolder) diff --git a/module/plugins/crypter/FileserveComFolder.py b/module/plugins/crypter/FileserveComFolder.py index 80b1f974d..eff80fde1 100644 --- a/module/plugins/crypter/FileserveComFolder.py +++ b/module/plugins/crypter/FileserveComFolder.py @@ -2,20 +2,19 @@ import re -from module.plugins.internal.Crypter import Crypter, create_getInfo +from module.plugins.internal.Crypter import Crypter class FileserveComFolder(Crypter): __name__ = "FileserveComFolder" __type__ = "crypter" - __version__ = "0.16" + __version__ = "0.17" __status__ = "testing" __pattern__ = r'http://(?:www\.)?fileserve\.com/list/\w+' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available", True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default")] __description__ = """FileServe.com folder decrypter plugin""" __license__ = "GPLv3" @@ -39,6 +38,3 @@ class FileserveComFolder(Crypter): if new_links: self.links = [map(lambda s: "http://fileserve.com%s" % s, new_links)] - - -getInfo = create_getInfo(FileserveComFolder) diff --git a/module/plugins/crypter/FilesonicComFolder.py b/module/plugins/crypter/FilesonicComFolder.py index e9f0e9c4d..088c3ad82 100644 --- a/module/plugins/crypter/FilesonicComFolder.py +++ b/module/plugins/crypter/FilesonicComFolder.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from module.plugins.internal.DeadCrypter import DeadCrypter class FilesonicComFolder(DeadCrypter): __name__ = "FilesonicComFolder" __type__ = "crypter" - __version__ = "0.16" + __version__ = "0.17" __status__ = "stable" __pattern__ = r'http://(?:www\.)?filesonic\.com/folder/\w+' @@ -15,6 +15,3 @@ class FilesonicComFolder(DeadCrypter): __description__ = """Filesonic.com folder decrypter plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - -getInfo = create_getInfo(FilesonicComFolder) diff --git a/module/plugins/crypter/FilestubeCom.py b/module/plugins/crypter/FilestubeCom.py index 4e93e6aac..b56a4cc87 100644 --- a/module/plugins/crypter/FilestubeCom.py +++ b/module/plugins/crypter/FilestubeCom.py @@ -1,20 +1,19 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter class FilestubeCom(SimpleCrypter): __name__ = "FilestubeCom" __type__ = "crypter" - __version__ = "0.09" + __version__ = "0.10" __status__ = "testing" __pattern__ = r'http://(?:www\.)?filestube\.(?:com|to)/\w+' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Filestube.com decrypter plugin""" __license__ = "GPLv3" @@ -23,6 +22,3 @@ class FilestubeCom(SimpleCrypter): LINK_PATTERN = r'<a class=\"file-link-main(?: noref)?\" [^>]* href=\"(http://[^\"]+)' NAME_PATTERN = r'<h1\s*> (?P<N>.+?) download\s*</h1>' - - -getInfo = create_getInfo(FilestubeCom) diff --git a/module/plugins/crypter/FiletramCom.py b/module/plugins/crypter/FiletramCom.py index aacedf9ee..eb19c45e1 100644 --- a/module/plugins/crypter/FiletramCom.py +++ b/module/plugins/crypter/FiletramCom.py @@ -1,20 +1,19 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter class FiletramCom(SimpleCrypter): __name__ = "FiletramCom" __type__ = "crypter" - __version__ = "0.06" + __version__ = "0.07" __status__ = "testing" __pattern__ = r'http://(?:www\.)?filetram\.com/[^/]+/.+' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Filetram.com decrypter plugin""" __license__ = "GPLv3" @@ -24,6 +23,3 @@ class FiletramCom(SimpleCrypter): LINK_PATTERN = r'\s+(http://.+)' NAME_PATTERN = r'<title>(?P<N>.+?) - Free Download' - - -getInfo = create_getInfo(FiletramCom) diff --git a/module/plugins/crypter/FiredriveComFolder.py b/module/plugins/crypter/FiredriveComFolder.py index 0b9290e2e..b51c74845 100644 --- a/module/plugins/crypter/FiredriveComFolder.py +++ b/module/plugins/crypter/FiredriveComFolder.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from module.plugins.internal.DeadCrypter import DeadCrypter class FiredriveComFolder(DeadCrypter): __name__ = "FiredriveComFolder" __type__ = "crypter" - __version__ = "0.07" + __version__ = "0.08" __status__ = "stable" __pattern__ = r'https?://(?:www\.)?(firedrive|putlocker)\.com/share/.+' @@ -15,6 +15,3 @@ class FiredriveComFolder(DeadCrypter): __description__ = """Firedrive.com folder decrypter plugin""" __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - -getInfo = create_getInfo(FiredriveComFolder) diff --git a/module/plugins/crypter/FourChanOrg.py b/module/plugins/crypter/FourChanOrg.py index 7fa38a736..c6a5fc5d6 100644 --- a/module/plugins/crypter/FourChanOrg.py +++ b/module/plugins/crypter/FourChanOrg.py @@ -5,20 +5,19 @@ import re import urlparse -from module.plugins.internal.Crypter import Crypter, create_getInfo +from module.plugins.internal.Crypter import Crypter class FourChanOrg(Crypter): __name__ = "FourChanOrg" __type__ = "crypter" - __version__ = "0.36" + __version__ = "0.37" __status__ = "testing" __pattern__ = r'http://(?:www\.)?boards\.4chan\.org/\w+/res/(\d+)' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available", True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default")] __description__ = """4chan.org folder decrypter plugin""" __license__ = "GPLv3" @@ -29,6 +28,3 @@ class FourChanOrg(Crypter): pagehtml = self.load(pyfile.url) images = set(re.findall(r'(images\.4chan\.org/[^/]*/src/[^"<]+)', pagehtml)) self.links = [urlparse.urljoin("http://", image) for image in images] - - -getInfo = create_getInfo(FourChanOrg) diff --git a/module/plugins/crypter/FreakhareComFolder.py b/module/plugins/crypter/FreakhareComFolder.py index 23f235205..7afd44ec7 100644 --- a/module/plugins/crypter/FreakhareComFolder.py +++ b/module/plugins/crypter/FreakhareComFolder.py @@ -2,21 +2,20 @@ import re -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter class FreakhareComFolder(SimpleCrypter): __name__ = "FreakhareComFolder" __type__ = "crypter" - __version__ = "0.07" + __version__ = "0.08" __status__ = "testing" __pattern__ = r'http://(?:www\.)?freakshare\.com/folder/.+' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Freakhare.com folder decrypter plugin""" __license__ = "GPLv3" @@ -40,6 +39,3 @@ class FreakhareComFolder(SimpleCrypter): 'entrys': '20', 'page': page_n - 1, 'order': ''}) - - -getInfo = create_getInfo(FreakhareComFolder) diff --git a/module/plugins/crypter/FreetexthostCom.py b/module/plugins/crypter/FreetexthostCom.py index f9822bb0d..c3d8fe06d 100644 --- a/module/plugins/crypter/FreetexthostCom.py +++ b/module/plugins/crypter/FreetexthostCom.py @@ -2,21 +2,20 @@ import re -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter class FreetexthostCom(SimpleCrypter): __name__ = "FreetexthostCom" __type__ = "crypter" - __version__ = "0.04" + __version__ = "0.05" __status__ = "testing" __pattern__ = r'http://(?:www\.)?freetexthost\.com/\w+' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Freetexthost.com decrypter plugin""" __license__ = "GPLv3" @@ -29,6 +28,3 @@ class FreetexthostCom(SimpleCrypter): self.error(_("Unable to extract links")) links = m.group(1) return links.strip().split("<br />\r\n") - - -getInfo = create_getInfo(FreetexthostCom) diff --git a/module/plugins/crypter/FshareVnFolder.py b/module/plugins/crypter/FshareVnFolder.py index 0e0b8b4cc..1818c11c2 100644 --- a/module/plugins/crypter/FshareVnFolder.py +++ b/module/plugins/crypter/FshareVnFolder.py @@ -1,20 +1,19 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter class FshareVnFolder(SimpleCrypter): __name__ = "FshareVnFolder" __type__ = "crypter" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __pattern__ = r'http://(?:www\.)?fshare\.vn/folder/.+' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Fshare.vn folder decrypter plugin""" __license__ = "GPLv3" @@ -22,6 +21,3 @@ class FshareVnFolder(SimpleCrypter): LINK_PATTERN = r'<li class="w_80pc"><a href="(.+?)" target="_blank">' - - -getInfo = create_getInfo(FshareVnFolder) diff --git a/module/plugins/crypter/FurLy.py b/module/plugins/crypter/FurLy.py index 582c2dca0..75c799224 100644 --- a/module/plugins/crypter/FurLy.py +++ b/module/plugins/crypter/FurLy.py @@ -1,20 +1,19 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter class FurLy(SimpleCrypter): __name__ = "FurLy" __type__ = "crypter" - __version__ = "0.04" + __version__ = "0.05" __status__ = "testing" __pattern__ = r'http://(?:www\.)?fur\.ly/(\d/)?\w+' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Fur.ly decrypter plugin""" __license__ = "GPLv3" @@ -25,6 +24,3 @@ class FurLy(SimpleCrypter): LINK_PATTERN = r'urls\[\d+\] = "(.+?)"' OFFLINE_PATTERN = r'var output;\s*var total' - - -getInfo = create_getInfo(FurLy) diff --git a/module/plugins/crypter/Go4UpCom.py b/module/plugins/crypter/Go4UpCom.py index 9a3315399..33bde9889 100755 --- a/module/plugins/crypter/Go4UpCom.py +++ b/module/plugins/crypter/Go4UpCom.py @@ -3,22 +3,21 @@ import re import urlparse -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo -from module.plugins.internal.utils import json +from module.plugins.internal.SimpleCrypter import SimpleCrypter +from module.plugins.internal.misc import json class Go4UpCom(SimpleCrypter): __name__ = "Go4UpCom" __type__ = "crypter" - __version__ = "0.16" + __version__ = "0.17" __status__ = "testing" __pattern__ = r'http://go4up\.com/(dl/\w{12}|rd/\w{12}/\d+)' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Go4Up.com decrypter plugin""" __license__ = "GPLv3" @@ -35,13 +34,13 @@ class Go4UpCom(SimpleCrypter): def get_links(self): links = [] - preference = self.get_config("preferred_hoster") + preference = self.config.get("preferred_hoster") hosterslink_re = re.search(r'(/download/gethosts/.+?)"', self.data) if hosterslink_re: hosters = self.load(urlparse.urljoin("http://go4up.com/", hosterslink_re.group(1))) for hoster in json.loads(hosters): - if preference != 0 and preference != int(hoster["hostId"]): + if preference is not 0 and preference != int(hoster["hostId"]): continue pagelink_re = re.search(self.LINK_PATTERN, hoster["link"]) if pagelink_re: @@ -51,6 +50,3 @@ class Go4UpCom(SimpleCrypter): links.append(link_re.group(1)) return links - - -getInfo = create_getInfo(Go4UpCom) diff --git a/module/plugins/crypter/GooGl.py b/module/plugins/crypter/GooGl.py index 5d5a42274..68e99d1c6 100644 --- a/module/plugins/crypter/GooGl.py +++ b/module/plugins/crypter/GooGl.py @@ -1,21 +1,20 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo -from module.plugins.internal.utils import json +from module.plugins.internal.SimpleCrypter import SimpleCrypter +from module.plugins.internal.misc import json class GooGl(SimpleCrypter): __name__ = "GooGl" __type__ = "crypter" - __version__ = "0.06" + __version__ = "0.07" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?goo\.gl/([a-zA-Z]+/)?\w+' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Goo.gl decrypter plugin""" __license__ = "GPLv3" @@ -33,6 +32,3 @@ class GooGl(SimpleCrypter): self.log_debug("JSON data: " + rep) rep = json.loads(rep) return [rep['longUrl']] if "longUrl" in rep else None - - -getInfo = create_getInfo(GooGl) diff --git a/module/plugins/crypter/GoogledriveComFolder.py b/module/plugins/crypter/GoogledriveComFolder.py index fe517c222..44fcb76d3 100644 --- a/module/plugins/crypter/GoogledriveComFolder.py +++ b/module/plugins/crypter/GoogledriveComFolder.py @@ -1,20 +1,19 @@ # -*- coding: utf-8 -* -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter class GoogledriveComFolder(SimpleCrypter): __name__ = "GoogledriveComFolder" __type__ = "crypter" - __version__ = "0.06" + __version__ = "0.07" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?drive\.google\.com/folderview\?.*id=\w+' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Drive.google.com folder decrypter plugin""" __license__ = "GPLv3" @@ -24,6 +23,3 @@ class GoogledriveComFolder(SimpleCrypter): NAME_PATTERN = r"folderName: '(?P<N>.+?)'" LINK_PATTERN = r'\[,"\w+"(?:,,".+?")?,"(.+?)"' OFFLINE_PATTERN = r'<TITLE>' - - -getInfo = create_getInfo(GoogledriveComFolder) diff --git a/module/plugins/crypter/HflixIn.py b/module/plugins/crypter/HflixIn.py index f0bcd7d3a..ebb140353 100644 --- a/module/plugins/crypter/HflixIn.py +++ b/module/plugins/crypter/HflixIn.py @@ -2,17 +2,18 @@ import re -from module.plugins.internal.Crypter import Crypter +from module.plugins.internal.SimpleCrypter import SimpleCrypter -class HflixIn(Crypter): - __name__ = "HflixIn" - __type__ = "crypter" - __version__ = "0.1" + +class HflixIn(SimpleCrypter): + __name__ = "HflixIn" + __type__ = "crypter" + __version__ = "0.11" __status__ = "testing" - __pattern__ = r"http://hflix.in/\w{5}" + __pattern__ = r'http://(www\.)?hflix\.in/\w+' - __description__ = """Hflix.in Decrypter Plugin""" + __description__ = """Hflix.in decrypter plugin""" __license__ = "GPLv3" __authors__ = [("GammaC0de", "nitzo2001[AT]yahoo[DOT]com")] diff --git a/module/plugins/crypter/HoerbuchIn.py b/module/plugins/crypter/HoerbuchIn.py index 6ed600f4d..ad9c8cce3 100644 --- a/module/plugins/crypter/HoerbuchIn.py +++ b/module/plugins/crypter/HoerbuchIn.py @@ -4,20 +4,19 @@ import re import BeautifulSoup -from module.plugins.internal.Crypter import Crypter, create_getInfo +from module.plugins.internal.Crypter import Crypter class HoerbuchIn(Crypter): __name__ = "HoerbuchIn" __type__ = "crypter" - __version__ = "0.64" + __version__ = "0.65" __status__ = "testing" __pattern__ = r'http://(?:www\.)?hoerbuch\.in/(wp/horbucher/\d+/.+/|tp/out\.php\?.+|protection/folder_\d+\.html)' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available", True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default")] __description__ = """Hoerbuch.in decrypter plugin""" __license__ = "GPLv3" @@ -63,6 +62,3 @@ class HoerbuchIn(Crypter): links.append(self.req.lastEffectiveURL) return links - - -getInfo = create_getInfo(HoerbuchIn) diff --git a/module/plugins/crypter/HotfileComFolder.py b/module/plugins/crypter/HotfileComFolder.py index a06a24a54..a97fdf3f1 100644 --- a/module/plugins/crypter/HotfileComFolder.py +++ b/module/plugins/crypter/HotfileComFolder.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from module.plugins.internal.DeadCrypter import DeadCrypter class HotfileComFolder(DeadCrypter): __name__ = "HotfileComFolder" __type__ = "crypter" - __version__ = "0.34" + __version__ = "0.35" __status__ = "stable" __pattern__ = r'https?://(?:www\.)?hotfile\.com/list/\w+/\w+' @@ -15,6 +15,3 @@ class HotfileComFolder(DeadCrypter): __description__ = """Hotfile.com folder decrypter plugin""" __license__ = "GPLv3" __authors__ = [("RaNaN", "RaNaN@pyload.org")] - - -getInfo = create_getInfo(HotfileComFolder) diff --git a/module/plugins/crypter/ILoadTo.py b/module/plugins/crypter/ILoadTo.py index 7fdbeeaa0..e3c0c644c 100644 --- a/module/plugins/crypter/ILoadTo.py +++ b/module/plugins/crypter/ILoadTo.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from module.plugins.internal.DeadCrypter import DeadCrypter class ILoadTo(DeadCrypter): __name__ = "ILoadTo" __type__ = "crypter" - __version__ = "0.14" + __version__ = "0.15" __status__ = "stable" __pattern__ = r'http://(?:www\.)?iload\.to/go/\d+\-[\w\-.]+/' @@ -15,6 +15,3 @@ class ILoadTo(DeadCrypter): __description__ = """Iload.to decrypter plugin""" __license__ = "GPLv3" __authors__ = [("hzpz", None)] - - -getInfo = create_getInfo(ILoadTo) diff --git a/module/plugins/crypter/ImgurCom.py b/module/plugins/crypter/ImgurCom.py new file mode 100644 index 000000000..710f556c9 --- /dev/null +++ b/module/plugins/crypter/ImgurCom.py @@ -0,0 +1,30 @@ +import re + +from module.plugins.internal.SimpleCrypter import SimpleCrypter +from module.plugins.internal.misc import uniqify + + +class ImgurCom(SimpleCrypter): + __name__ = "ImgurCom" + __type__ = "crypter" + __version__ = "0.55" + __status__ = "testing" + + __pattern__ = r'https?://(?:www\.|m\.)?imgur\.com/(a|gallery|)/?\w{5,7}' + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + + __description__ = """Imgur.com decrypter plugin""" + __license__ = "GPLv3" + __authors__ = [("nath_schwarz", "nathan.notwhite@gmail.com")] + + + NAME_PATTERN = r'(?P<N>.+?) - Imgur' + LINK_PATTERN = r'i\.imgur\.com/\w{7}s?\.(?:jpeg|jpg|png|gif|apng)' + + + def get_links(self): + f = lambda url: "http://" + re.sub(r'(\w{7})s\.', r'\1.', url) + return uniqify(map(f, re.findall(self.LINK_PATTERN, self.data))) diff --git a/module/plugins/crypter/ImgurComAlbum.py b/module/plugins/crypter/ImgurComAlbum.py deleted file mode 100644 index 620b0e036..000000000 --- a/module/plugins/crypter/ImgurComAlbum.py +++ /dev/null @@ -1,34 +0,0 @@ -import re - -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo -from module.plugins.internal.utils import uniqify - - -class ImgurComAlbum(SimpleCrypter): - __name__ = "ImgurComAlbum" - __type__ = "crypter" - __version__ = "0.54" - __status__ = "testing" - - __pattern__ = r'https?://(?:www\.|m\.)?imgur\.com/(a|gallery|)/?\w{5,7}' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] - - __description__ = """Imgur.com decrypter plugin""" - __license__ = "GPLv3" - __authors__ = [("nath_schwarz", "nathan.notwhite@gmail.com")] - - - NAME_PATTERN = r'(?P<N>.+?) - Imgur' - LINK_PATTERN = r'i\.imgur\.com/\w{7}s?\.(?:jpeg|jpg|png|gif|apng)' - - - def get_links(self): - f = lambda url: "http://" + re.sub(r'(\w{7})s\.', r'\1.', url) - return uniqify(map(f, re.findall(self.LINK_PATTERN, self.data))) - - -getInfo = create_getInfo(ImgurComAlbum) diff --git a/module/plugins/crypter/JDlist.py b/module/plugins/crypter/JDlist.py index 29ad0d5fe..0c321ef80 100644 --- a/module/plugins/crypter/JDlist.py +++ b/module/plugins/crypter/JDlist.py @@ -1,19 +1,18 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.Crypter import Crypter, create_getInfo +from module.plugins.internal.Crypter import Crypter class JDlist(Crypter): __name__ = "JDlist" __type__ = "crypter" - __version__ = "0.03" + __version__ = "0.04" __status__ = "testing" __pattern__ = r'jdlist://(?P<LIST>[\w\+^_]+==)' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available", True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default")] __description__ = """JDlist decrypter plugin""" __license__ = "GPLv3" @@ -22,6 +21,3 @@ class JDlist(Crypter): def decrypt(self, pyfile): self.links.extend(self.info['pattern']['LIST'].decode('base64').split(',')) - - -getInfo = create_getInfo(JDlist) diff --git a/module/plugins/crypter/LetitbitNetFolder.py b/module/plugins/crypter/LetitbitNetFolder.py index 635dc1737..03d656189 100644 --- a/module/plugins/crypter/LetitbitNetFolder.py +++ b/module/plugins/crypter/LetitbitNetFolder.py @@ -2,20 +2,19 @@ import re -from module.plugins.internal.Crypter import Crypter, create_getInfo +from module.plugins.internal.Crypter import Crypter class LetitbitNetFolder(Crypter): __name__ = "LetitbitNet" __type__ = "crypter" - __version__ = "0.15" + __version__ = "0.16" __status__ = "testing" __pattern__ = r'http://(?:www\.)?letitbit\.net/folder/\w+' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available", True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default")] __description__ = """Letitbit.net folder decrypter plugin""" __license__ = "GPLv3" @@ -35,6 +34,3 @@ class LetitbitNetFolder(Crypter): self.error(_("FOLDER_PATTERN not found")) self.links.extend(re.findall(self.LINK_PATTERN, folder.group(0))) - - -getInfo = create_getInfo(LetitbitNetFolder) diff --git a/module/plugins/crypter/LinkCryptWs.py b/module/plugins/crypter/LinkCryptWs.py index 9d421ad03..0cdfa1e34 100644 --- a/module/plugins/crypter/LinkCryptWs.py +++ b/module/plugins/crypter/LinkCryptWs.py @@ -3,12 +3,11 @@ import binascii import re +import Crypto.Cipher import pycurl -from Crypto.Cipher import AES - -from module.plugins.internal.Crypter import Crypter, create_getInfo -from module.plugins.internal.utils import html_unescape +from module.plugins.internal.Crypter import Crypter +from module.plugins.internal.misc import html_unescape, set_cookie class LinkCryptWs(Crypter): @@ -41,7 +40,7 @@ class LinkCryptWs(Crypter): #: Init self.fileid = re.match(self.__pattern__, self.pyfile.url).group('ID') - self.req.cj.setCookie("linkcrypt.ws", "language", "en") + set_cookie(req.cj, "linkcrypt.ws", "language", "en") #: Request package self.req.http.c.setopt(pycurl.USERAGENT, "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko") #: Better chance to not get those key-captchas @@ -74,7 +73,7 @@ class LinkCryptWs(Crypter): self.getunrarpw() #: Get package name and folder - package_name, folder_name = self.get_package_info() + pack_name, folder_name = self.get_package_info() #: Get the container definitions from script section self.get_container_html() @@ -88,7 +87,7 @@ class LinkCryptWs(Crypter): break if self.urls: - self.packages = [(package_name, self.urls, folder_name)] + self.packages = [(pack_name, self.urls, folder_name)] def is_online(self): @@ -183,7 +182,7 @@ class LinkCryptWs(Crypter): def handle_web_links(self): self.log_debug("Search for Web links ") - package_links = [] + pack_links = [] pattern = r'<form action="http://linkcrypt.ws/out.html"[^>]*?>.*?<input[^>]*?value="(.+?)"[^>]*?name="file"' ids = re.findall(pattern, self.data, re.I | re.S) @@ -199,12 +198,12 @@ class LinkCryptWs(Crypter): link2 = res[indexs:indexe] link2 = html_unescape(link2) - package_links.append(link2) + pack_links.append(link2) except Exception, detail: self.log_debug("Error decrypting Web link %s, %s" % (weblink_id, detail)) - return package_links + return pack_links def get_container_html(self): @@ -223,7 +222,7 @@ class LinkCryptWs(Crypter): def handle_container(self, type): - package_links = [] + pack_links = [] type = type.lower() self.log_debug('Search for %s Container links' % type.upper()) @@ -241,18 +240,18 @@ class LinkCryptWs(Crypter): self.log_debug("clink found") - package_name, folder_name = self.get_package_info() - self.log_debug("Added package with name %s.%s and container link %s" %( package_name, type, clink.group(1))) - self.pyload.api.uploadContainer('.'.join([package_name, type]), self.load(clink.group(1))) + pack_name, folder_name = self.get_package_info() + self.log_debug("Added package with name %s.%s and container link %s" %( pack_name, type, clink.group(1))) + self.pyload.api.uploadContainer('.'.join([pack_name, type]), self.load(clink.group(1))) return "Found it" - return package_links + return pack_links def handle_CNL2(self): self.log_debug("Search for CNL links") - package_links = [] + pack_links = [] cnl_line = None for line in self.container_html: @@ -267,13 +266,13 @@ class LinkCryptWs(Crypter): cnl_section = self.handle_javascript(cnl_line) (vcrypted, vjk) = self._get_cipher_params(cnl_section) for (crypted, jk) in zip(vcrypted, vjk): - package_links.extend(self._get_links(crypted, jk)) + pack_links.extend(self._get_links(crypted, jk)) except Exception: self.log_error(_("Unable to decrypt CNL links (JS Error) try to get over links"), trace=True) return self.handle_web_links() - return package_links + return pack_links def _get_cipher_params(self, cnl_section): @@ -299,7 +298,7 @@ class LinkCryptWs(Crypter): #: Decrypt Key = key IV = key - obj = AES.new(Key, AES.MODE_CBC, IV) + obj = Crypto.Cipher.AES.new(Key, Crypto.Cipher.AES.MODE_CBC, IV) text = obj.decrypt(crypted.decode('base64')) #: Extract links @@ -310,6 +309,3 @@ class LinkCryptWs(Crypter): self.log_debug("Package has %d links" % len(links)) return links - - -getInfo = create_getInfo(LinkCryptWs) diff --git a/module/plugins/crypter/LinkSaveIn.py b/module/plugins/crypter/LinkSaveIn.py index 45ef59063..06d1c48f8 100644 --- a/module/plugins/crypter/LinkSaveIn.py +++ b/module/plugins/crypter/LinkSaveIn.py @@ -1,20 +1,19 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter class LinkSaveIn(SimpleCrypter): __name__ = "LinkSaveIn" __type__ = "crypter" - __version__ = "2.08" + __version__ = "2.09" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?linksave\.in/\w+' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """LinkSave.in decrypter plugin""" __license__ = "GPLv3" @@ -24,6 +23,3 @@ class LinkSaveIn(SimpleCrypter): COOKIES = [("linksave.in", "Linksave_Language", "english")] OFFLINE_PATTERN = r'>(Error )?404 -' - - -getInfo = create_getInfo(LinkSaveIn) diff --git a/module/plugins/crypter/LinkdecrypterCom.py b/module/plugins/crypter/LinkdecrypterCom.py index ad55ce55d..b3b0048e1 100644 --- a/module/plugins/crypter/LinkdecrypterCom.py +++ b/module/plugins/crypter/LinkdecrypterCom.py @@ -8,14 +8,13 @@ from module.plugins.internal.MultiCrypter import MultiCrypter class LinkdecrypterCom(MultiCrypter): __name__ = "LinkdecrypterCom" __type__ = "crypter" - __version__ = "0.35" + __version__ = "0.36" __status__ = "testing" __pattern__ = r'^unmatchable$' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available", True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default")] __description__ = """Linkdecrypter.com decrypter plugin""" __license__ = "GPLv3" diff --git a/module/plugins/crypter/LixIn.py b/module/plugins/crypter/LixIn.py index e3dcf9d89..3398ce87a 100644 --- a/module/plugins/crypter/LixIn.py +++ b/module/plugins/crypter/LixIn.py @@ -3,20 +3,19 @@ import re import urlparse -from module.plugins.internal.Crypter import Crypter, create_getInfo +from module.plugins.internal.Crypter import Crypter class LixIn(Crypter): __name__ = "LixIn" __type__ = "crypter" - __version__ = "0.26" + __version__ = "0.27" __status__ = "testing" __pattern__ = r'http://(?:www\.)?lix\.in/(?P<ID>.+)' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available", True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default")] __description__ = """Lix.in decrypter plugin""" __license__ = "GPLv3" @@ -61,6 +60,3 @@ class LixIn(Crypter): else: self.links = [m.group(1)] self.log_debug("Found link %s, adding to package" % self.links[0]) - - -getInfo = create_getInfo(LixIn) diff --git a/module/plugins/crypter/LofCc.py b/module/plugins/crypter/LofCc.py index 4836bbb67..16d3c0d63 100644 --- a/module/plugins/crypter/LofCc.py +++ b/module/plugins/crypter/LofCc.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from module.plugins.internal.DeadCrypter import DeadCrypter class LofCc(DeadCrypter): __name__ = "LofCc" __type__ = "crypter" - __version__ = "0.24" + __version__ = "0.25" __status__ = "stable" __pattern__ = r'http://(?:www\.)?lof\.cc/(.+)' @@ -15,6 +15,3 @@ class LofCc(DeadCrypter): __description__ = """Lof.cc decrypter plugin""" __license__ = "GPLv3" __authors__ = [("mkaay", "mkaay@mkaay.de")] - - -getInfo = create_getInfo(LofCc) diff --git a/module/plugins/crypter/MBLinkInfo.py b/module/plugins/crypter/MBLinkInfo.py index ba0952d7d..2e765b2c9 100644 --- a/module/plugins/crypter/MBLinkInfo.py +++ b/module/plugins/crypter/MBLinkInfo.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from module.plugins.internal.DeadCrypter import DeadCrypter class MBLinkInfo(DeadCrypter): __name__ = "MBLinkInfo" __type__ = "crypter" - __version__ = "0.06" + __version__ = "0.07" __status__ = "stable" __pattern__ = r'http://(?:www\.)?mblink\.info/?\?id=(\d+)' @@ -16,6 +16,3 @@ class MBLinkInfo(DeadCrypter): __license__ = "GPLv3" __authors__ = [("Gummibaer", "Gummibaer@wiki-bierkiste.de"), ("stickell", "l.stickell@yahoo.it")] - - -getInfo = create_getInfo(MBLinkInfo) diff --git a/module/plugins/crypter/MediafireComFolder.py b/module/plugins/crypter/MediafireComFolder.py index 604d78687..b0e2e5e51 100644 --- a/module/plugins/crypter/MediafireComFolder.py +++ b/module/plugins/crypter/MediafireComFolder.py @@ -2,21 +2,20 @@ import re -from module.plugins.internal.Crypter import Crypter, create_getInfo -from module.plugins.internal.utils import json +from module.plugins.internal.Crypter import Crypter +from module.plugins.internal.misc import json class MediafireComFolder(Crypter): __name__ = "MediafireComFolder" __type__ = "crypter" - __version__ = "0.20" + __version__ = "0.21" __status__ = "testing" __pattern__ = r'http://(?:www\.)?mediafire\.com/(folder/|\?sharekey=|\?\w{13}($|[/#]))' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available", True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default")] __description__ = """Mediafire.com folder decrypter plugin""" __license__ = "GPLv3" @@ -73,22 +72,20 @@ class MediafireComFolder(Crypter): folder_key = m.group(1) self.log_debug("FOLDER KEY: %s" % folder_key) - json_resp = json.loads(self.load("http://www.mediafire.com/api/folder/get_info.php", - get={'folder_key' : folder_key, - 'response_format': "json", - 'version' : 1})) - # self.log_info(json_resp) - if json_resp['response']['result'] == "Success": - for link in json_resp['response']['folder_info']['files']: + html = self.load("http://www.mediafire.com/api/folder/get_info.php", + get={'folder_key' : folder_key, + 'response_format': "json", + 'version' : 1}) + json_data = json.loads(html) + # self.log_info(json_data) + if json_data['response']['result'] == "Success": + for link in json_data['response']['folder_info']['files']: self.links.append("http://www.mediafire.com/file/%s" % link['quickkey']) else: - self.fail(json_resp['response']['message']) + self.fail(json_data['response']['message']) elif result is 1: self.offline() else: self.links.append(url) - - -getInfo = create_getInfo(MediafireComFolder) diff --git a/module/plugins/crypter/MegaCoNzFolder.py b/module/plugins/crypter/MegaCoNzFolder.py index 01e8338ac..442e6beea 100644 --- a/module/plugins/crypter/MegaCoNzFolder.py +++ b/module/plugins/crypter/MegaCoNzFolder.py @@ -2,20 +2,19 @@ import re -from module.plugins.internal.Crypter import Crypter, create_getInfo +from module.plugins.internal.Crypter import Crypter class MegaCoNzFolder(Crypter): __name__ = "MegaCoNzFolder" __type__ = "crypter" - __version__ = "0.09" + __version__ = "0.10" __status__ = "broken" __pattern__ = r'(https?://(?:www\.)?mega(\.co)?\.nz/|mega:|chrome:.+?)#F!(?P<ID>[\w^_]+)!(?P<KEY>[\w,\\-]+)' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available", True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default")] __description__ = """Mega.co.nz folder decrypter plugin""" __license__ = "GPLv3" @@ -30,6 +29,3 @@ class MegaCoNzFolder(Crypter): url = "https://mega.co.nz/#F!%s!%s" % re.match(self.__pattern__, pyfile.url).groups() self.data = self.load("http://rapidgen.org/linkfinder", post={'linklisturl': url}) self.links = re.findall(r'(https://mega(\.co)?\.nz/#N!.+?)<', self.data) - - -getInfo = create_getInfo(MegaCoNzFolder) diff --git a/module/plugins/crypter/MegaRapidCzFolder.py b/module/plugins/crypter/MegaRapidCzFolder.py index c49f6297e..05dec6e16 100644 --- a/module/plugins/crypter/MegaRapidCzFolder.py +++ b/module/plugins/crypter/MegaRapidCzFolder.py @@ -1,20 +1,19 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter class MegaRapidCzFolder(SimpleCrypter): __name__ = "MegaRapidCzFolder" __type__ = "crypter" - __version__ = "0.06" + __version__ = "0.07" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(share|mega)rapid\.cz/slozka/\d+/\w+' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Share-Rapid.com folder decrypter plugin""" __license__ = "GPLv3" @@ -22,6 +21,3 @@ class MegaRapidCzFolder(SimpleCrypter): LINK_PATTERN = r'<td class="soubor".*?><a href="(.+?)">' - - -getInfo = create_getInfo(MegaRapidCzFolder) diff --git a/module/plugins/crypter/MegauploadComFolder.py b/module/plugins/crypter/MegauploadComFolder.py index 532ab9b88..9161b228c 100644 --- a/module/plugins/crypter/MegauploadComFolder.py +++ b/module/plugins/crypter/MegauploadComFolder.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from module.plugins.internal.DeadCrypter import DeadCrypter class MegauploadComFolder(DeadCrypter): __name__ = "MegauploadComFolder" __type__ = "crypter" - __version__ = "0.06" + __version__ = "0.07" __status__ = "stable" __pattern__ = r'http://(?:www\.)?megaupload\.com/(\?f|xml/folderfiles\.php\?.*&?folderid)=\w+' @@ -15,6 +15,3 @@ class MegauploadComFolder(DeadCrypter): __description__ = """Megaupload.com folder decrypter plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - -getInfo = create_getInfo(MegauploadComFolder) diff --git a/module/plugins/crypter/Movie2KTo.py b/module/plugins/crypter/Movie2KTo.py index 6c0abfd88..d2b365178 100644 --- a/module/plugins/crypter/Movie2KTo.py +++ b/module/plugins/crypter/Movie2KTo.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from module.plugins.internal.DeadCrypter import DeadCrypter class Movie2KTo(DeadCrypter): __name__ = "Movie2KTo" __type__ = "crypter" - __version__ = "0.54" + __version__ = "0.55" __status__ = "stable" __pattern__ = r'http://(?:www\.)?movie2k\.to/(.+)\.html' @@ -15,6 +15,3 @@ class Movie2KTo(DeadCrypter): __description__ = """Movie2k.to decrypter plugin""" __license__ = "GPLv3" __authors__ = [("4Christopher", "4Christopher@gmx.de")] - - -getInfo = create_getInfo(Movie2KTo) diff --git a/module/plugins/crypter/MultiUpOrg.py b/module/plugins/crypter/MultiUpOrg.py index 82dd64eb0..a546ecc22 100644 --- a/module/plugins/crypter/MultiUpOrg.py +++ b/module/plugins/crypter/MultiUpOrg.py @@ -3,21 +3,20 @@ import re import urlparse -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter class MultiUpOrg(SimpleCrypter): __name__ = "MultiUpOrg" __type__ = "crypter" - __version__ = "0.07" + __version__ = "0.08" __status__ = "testing" __pattern__ = r'http://(?:www\.)?multiup\.org/(en|fr)/(?P<TYPE>project|download|mirror)/\w+(/\w+)?' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """MultiUp.org crypter plugin""" __license__ = "GPLv3" @@ -40,6 +39,3 @@ class MultiUpOrg(SimpleCrypter): self.data = self.load(mirror_page) return re.findall(pattern, self.data) - - -getInfo = create_getInfo(MultiUpOrg) diff --git a/module/plugins/crypter/MultiloadCz.py b/module/plugins/crypter/MultiloadCz.py index 87a900a2a..657f101d6 100644 --- a/module/plugins/crypter/MultiloadCz.py +++ b/module/plugins/crypter/MultiloadCz.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.Crypter import Crypter, create_getInfo +from module.plugins.internal.Crypter import Crypter class MultiloadCz(Crypter): __name__ = "MultiloadCz" __type__ = "crypter" - __version__ = "0.44" + __version__ = "0.45" __status__ = "testing" __pattern__ = r'http://(?:[^/]*\.)?multiload\.cz/(stahnout|slozka)/.+' @@ -38,12 +38,9 @@ class MultiloadCz(Crypter): else: m = re.findall(self.LINK_PATTERN, self.data) if m is not None: - prefered_set = set(self.get_config('usedHoster').split('|')) + prefered_set = set(self.config.get('usedHoster').split('|')) self.links.extend(x[1] for x in m if x[0] in prefered_set) if not self.links: - ignored_set = set(self.get_config('ignoredHoster').split('|')) + ignored_set = set(self.config.get('ignoredHoster').split('|')) self.links.extend(x[1] for x in m if x[0] not in ignored_set) - - -getInfo = create_getInfo(MultiloadCz) diff --git a/module/plugins/crypter/MultiuploadCom.py b/module/plugins/crypter/MultiuploadCom.py index 6b7ea9f16..662c624d0 100644 --- a/module/plugins/crypter/MultiuploadCom.py +++ b/module/plugins/crypter/MultiuploadCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from module.plugins.internal.DeadCrypter import DeadCrypter class MultiuploadCom(DeadCrypter): __name__ = "MultiuploadCom" __type__ = "crypter" - __version__ = "0.05" + __version__ = "0.06" __status__ = "stable" __pattern__ = r'http://(?:www\.)?multiupload\.(com|nl)/\w+' @@ -15,6 +15,3 @@ class MultiuploadCom(DeadCrypter): __description__ = """MultiUpload.com decrypter plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - -getInfo = create_getInfo(MultiuploadCom) diff --git a/module/plugins/crypter/NCryptIn.py b/module/plugins/crypter/NCryptIn.py index a60e99ce7..d1a2b3bcc 100644 --- a/module/plugins/crypter/NCryptIn.py +++ b/module/plugins/crypter/NCryptIn.py @@ -3,23 +3,22 @@ import binascii import re -from Crypto.Cipher import AES +import Crypto.Cipher -from module.plugins.internal.Crypter import Crypter, create_getInfo +from module.plugins.internal.Crypter import Crypter from module.plugins.captcha.ReCaptcha import ReCaptcha class NCryptIn(Crypter): __name__ = "NCryptIn" __type__ = "crypter" - __version__ = "1.39" + __version__ = "1.40" __status__ = "testing" __pattern__ = r'http://(?:www\.)?ncrypt\.in/(?P<TYPE>folder|link|frame)-([^/\?]+)' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available", True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default")] __description__ = """NCrypt.in decrypter plugin""" __license__ = "GPLv3" @@ -43,13 +42,13 @@ class NCryptIn(Crypter): def decrypt(self, pyfile): #: Init self.package = pyfile.package() - package_links = [] - package_name = self.package.name + pack_links = [] + pack_name = self.package.name folder_name = self.package.folder #: Deal with single links if self.is_single_link(): - package_links.extend(self.handle_single_link()) + pack_links.extend(self.handle_single_link()) #: Deal with folders else: @@ -67,18 +66,18 @@ class NCryptIn(Crypter): self.handle_errors() #: Prepare package name and folder - (package_name, folder_name) = self.get_package_info() + (pack_name, folder_name) = self.get_package_info() #: Extract package links for link_source_type in self.links_source_order: - package_links.extend(self.handle_link_source(link_source_type)) - if package_links: #: Use only first source which provides links + pack_links.extend(self.handle_link_source(link_source_type)) + if pack_links: #: Use only first source which provides links break - package_links = set(package_links) + pack_links = set(pack_links) #: Pack and return links - if package_links: - self.packages = [(package_name, package_links, folder_name)] + if pack_links: + self.packages = [(pack_name, pack_links, folder_name)] def is_single_link(self): @@ -157,8 +156,8 @@ class NCryptIn(Crypter): self.log_debug("ReCaptcha protected") captcha_key = re.search(r'\?k=(.*?)"', form).group(1) self.log_debug("Resolving ReCaptcha with key [%s]" % captcha_key) - recaptcha = ReCaptcha(self) - response, challenge = recaptcha.challenge(captcha_key) + self.captcha = ReCaptcha(self.pyfile) + response, challenge = self.captcha.challenge(captcha_key) postData['recaptcha_challenge_field'] = challenge postData['recaptcha_response_field'] = response @@ -210,44 +209,44 @@ class NCryptIn(Crypter): def handle_single_link(self): self.log_debug("Handling Single link") - package_links = [] + pack_links = [] #: Decrypt single link decrypted_link = self.decrypt_link(self.pyfile.url) if decrypted_link: - package_links.append(decrypted_link) + pack_links.append(decrypted_link) - return package_links + return pack_links def handle_CNL2(self): self.log_debug("Handling CNL2 links") - package_links = [] + pack_links = [] if 'cnl2_output' in self.cleaned_html: try: (vcrypted, vjk) = self._get_cipher_params() for (crypted, jk) in zip(vcrypted, vjk): - package_links.extend(self._get_links(crypted, jk)) + pack_links.extend(self._get_links(crypted, jk)) except Exception: self.fail(_("Unable to decrypt CNL2 links")) - return package_links + return pack_links def handle_containers(self): self.log_debug("Handling Container links") - package_links = [] + pack_links = [] pattern = r'/container/(rsdf|dlc|ccf)/(\w+)' containersLinks = re.findall(pattern, self.data) self.log_debug("Decrypting %d Container links" % len(containersLinks)) for containerLink in containersLinks: link = "http://ncrypt.in/container/%s/%s.%s" % (containerLink[0], containerLink[1], containerLink[0]) - package_links.append(link) + pack_links.append(link) - return package_links + return pack_links def handle_web_links(self): @@ -255,15 +254,15 @@ class NCryptIn(Crypter): pattern = r'(http://ncrypt\.in/link-.*?=)' links = re.findall(pattern, self.data) - package_links = [] + pack_links = [] self.log_debug("Decrypting %d Web links" % len(links)) for i, link in enumerate(links): self.log_debug("Decrypting Web link %d, %s" % (i + 1, link)) decrypted_link = self.decrypt(link) if decrypted_link: - package_links.append(decrypted_link) + pack_links.append(decrypted_link) - return package_links + return pack_links def decrypt_link(self, link): @@ -301,7 +300,7 @@ class NCryptIn(Crypter): #: Decrypt Key = key IV = key - obj = AES.new(Key, AES.MODE_CBC, IV) + obj = Crypto.Cipher.AES.new(Key, Crypto.Cipher.AES.MODE_CBC, IV) text = obj.decrypt(crypted.decode('base64')) #: Extract links @@ -311,6 +310,3 @@ class NCryptIn(Crypter): #: Log and return self.log_debug("Block has %d links" % len(links)) return links - - -getInfo = create_getInfo(NCryptIn) diff --git a/module/plugins/crypter/NetfolderIn.py b/module/plugins/crypter/NetfolderIn.py index eba13d1b6..1e25ee0d1 100644 --- a/module/plugins/crypter/NetfolderIn.py +++ b/module/plugins/crypter/NetfolderIn.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from module.plugins.internal.DeadCrypter import DeadCrypter class NetfolderIn(DeadCrypter): __name__ = "NetfolderIn" __type__ = "crypter" - __version__ = "0.76" + __version__ = "0.77" __status__ = "stable" __pattern__ = r'http://(?:www\.)?netfolder\.(in|me)/(folder\.php\?folder_id=)?(?P<ID>\w+)(?(1)|/\w+)' @@ -16,6 +16,3 @@ class NetfolderIn(DeadCrypter): __license__ = "GPLv3" __authors__ = [("RaNaN", "RaNaN@pyload.org"), ("fragonib", "fragonib[AT]yahoo[DOT]es")] - - -getInfo = create_getInfo(NetfolderIn) diff --git a/module/plugins/crypter/NitroflareComFolder.py b/module/plugins/crypter/NitroflareComFolder.py index ae7ca27da..df6564e18 100644 --- a/module/plugins/crypter/NitroflareComFolder.py +++ b/module/plugins/crypter/NitroflareComFolder.py @@ -1,21 +1,20 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo -from module.plugins.internal.utils import json +from module.plugins.internal.SimpleCrypter import SimpleCrypter +from module.plugins.internal.misc import json class NitroflareComFolder(SimpleCrypter): __name__ = "NitroflareComFolder" __type__ = "crypter" - __version__ = "0.06" + __version__ = "0.07" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?nitroflare\.com/folder/(?P<USER>\d+)/(?P<ID>[\w=]+)' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Nitroflare.com folder decrypter plugin""" __license__ = "GPLv3" @@ -23,17 +22,15 @@ class NitroflareComFolder(SimpleCrypter): def get_links(self): - res = json.loads(self.load("http://nitroflare.com/ajax/folder.php", - post={'userId' : self.info['pattern']['USER'], - 'folder' : self.info['pattern']['ID'], - 'page' : 1, - 'perPage': 10000})) + html = self.load("http://nitroflare.com/ajax/folder.php", + post={'userId' : self.info['pattern']['USER'], + 'folder' : self.info['pattern']['ID'], + 'page' : 1, + 'perPage': 10000}) + res = json.loads(html) if res['name']: self.pyfile.name = res['name'] else: self.offline() return [link['url'] for link in res['files']] if 'files' in res else None - - -getInfo = create_getInfo(NitroflareComFolder) diff --git a/module/plugins/crypter/NosvideoCom.py b/module/plugins/crypter/NosvideoCom.py index a8d5d741d..fe989420f 100644 --- a/module/plugins/crypter/NosvideoCom.py +++ b/module/plugins/crypter/NosvideoCom.py @@ -1,20 +1,19 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter class NosvideoCom(SimpleCrypter): __name__ = "NosvideoCom" __type__ = "crypter" - __version__ = "0.06" + __version__ = "0.07" __status__ = "testing" __pattern__ = r'http://(?:www\.)?nosvideo\.com/\?v=\w+' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Nosvideo.com decrypter plugin""" __license__ = "GPLv3" @@ -23,6 +22,3 @@ class NosvideoCom(SimpleCrypter): LINK_PATTERN = r'href="(http://(?:w{3}\.)?nosupload\.com/\?d=\w+)"' NAME_PATTERN = r'<[tT]itle>Watch (?P<N>.+?)<' - - -getInfo = create_getInfo(NosvideoCom) diff --git a/module/plugins/crypter/OronComFolder.py b/module/plugins/crypter/OronComFolder.py index ad650d751..85b61f437 100644 --- a/module/plugins/crypter/OronComFolder.py +++ b/module/plugins/crypter/OronComFolder.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from module.plugins.internal.DeadCrypter import DeadCrypter class OronComFolder(DeadCrypter): __name__ = "OronComFolder" __type__ = "crypter" - __version__ = "0.15" + __version__ = "0.16" __status__ = "stable" __pattern__ = r'http://(?:www\.)?oron\.com/folder/\w+' @@ -15,6 +15,3 @@ class OronComFolder(DeadCrypter): __description__ = """Oron.com folder decrypter plugin""" __license__ = "GPLv3" __authors__ = [("DHMH", "webmaster@pcProfil.de")] - - -getInfo = create_getInfo(OronComFolder) diff --git a/module/plugins/crypter/PastebinCom.py b/module/plugins/crypter/PastebinCom.py index fe759320f..8b0f9ecf0 100644 --- a/module/plugins/crypter/PastebinCom.py +++ b/module/plugins/crypter/PastebinCom.py @@ -1,20 +1,19 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter class PastebinCom(SimpleCrypter): __name__ = "PastebinCom" __type__ = "crypter" - __version__ = "0.07" + __version__ = "0.08" __status__ = "testing" __pattern__ = r'https://(?:www\.)?pastebin\.com/(.+i=)?(?P<ID>\w{8})' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Pastebin.com decrypter plugin""" __license__ = "GPLv3" @@ -25,6 +24,3 @@ class PastebinCom(SimpleCrypter): NAME_PATTERN = r'<div class="paste_box_line1" title="(?P<N>.+?)"' LINK_PATTERN = r'<div class="de\d+">(.+?)<' - - -getInfo = create_getInfo(PastebinCom) diff --git a/module/plugins/crypter/PastedCo.py b/module/plugins/crypter/PastedCo.py index 204853ed1..f6988ed11 100644 --- a/module/plugins/crypter/PastedCo.py +++ b/module/plugins/crypter/PastedCo.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.Crypter import Crypter, create_getInfo +from module.plugins.internal.Crypter import Crypter import re @@ -8,7 +8,7 @@ import re class PastedCo(Crypter): __name__ = "PastedCo" __type__ = "crypter" - __version__ = "0.04" + __version__ = "0.05" __status__ = "testing" __pattern__ = r'http://pasted\.co/\w+' @@ -27,8 +27,8 @@ class PastedCo(Crypter): def decrypt(self, pyfile): package = pyfile.package() - package_name = package.name - package_folder = package.folder + pack_name = package.name + pack_folder = package.folder html = self.load(pyfile.url, decode = True).splitlines() fs_url = None FS_URL_RE = re.compile('%s/fullscreen\.php\?hash=[0-9a-f]*' % pyfile.url) @@ -42,7 +42,4 @@ class PastedCo(Crypter): urls = self.load(fs_url, decode = True) urls = urls[urls.find(PastedCo.FS_URL_PREFIX) + len(PastedCo.FS_URL_PREFIX):] urls = urls[:urls.find(PastedCo.FS_URL_SUFFIX)].splitlines() - self.packages.append((package_name, urls, package_folder)) - - -getInfo = create_getInfo(PastedCo) + self.packages.append((pack_name, urls, pack_folder)) diff --git a/module/plugins/crypter/QuickshareCzFolder.py b/module/plugins/crypter/QuickshareCzFolder.py index c2ab3e144..ad0bf5704 100644 --- a/module/plugins/crypter/QuickshareCzFolder.py +++ b/module/plugins/crypter/QuickshareCzFolder.py @@ -2,20 +2,19 @@ import re -from module.plugins.internal.Crypter import Crypter, create_getInfo +from module.plugins.internal.Crypter import Crypter class QuickshareCzFolder(Crypter): __name__ = "QuickshareCzFolder" __type__ = "crypter" - __version__ = "0.15" + __version__ = "0.16" __status__ = "testing" __pattern__ = r'http://(?:www\.)?quickshare\.cz/slozka-\d+' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available", True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default")] __description__ = """Quickshare.cz folder decrypter plugin""" __license__ = "GPLv3" @@ -33,6 +32,3 @@ class QuickshareCzFolder(Crypter): if m is None: self.error(_("FOLDER_PATTERN not found")) self.links.extend(re.findall(self.LINK_PATTERN, m.group(1))) - - -getInfo = create_getInfo(QuickshareCzFolder) diff --git a/module/plugins/crypter/RSLayerCom.py b/module/plugins/crypter/RSLayerCom.py index b59b4f108..02d97b4c8 100644 --- a/module/plugins/crypter/RSLayerCom.py +++ b/module/plugins/crypter/RSLayerCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from module.plugins.internal.DeadCrypter import DeadCrypter class RSLayerCom(DeadCrypter): __name__ = "RSLayerCom" __type__ = "crypter" - __version__ = "0.24" + __version__ = "0.25" __status__ = "stable" __pattern__ = r'http://(?:www\.)?rs-layer\.com/directory-' @@ -15,6 +15,3 @@ class RSLayerCom(DeadCrypter): __description__ = """RS-Layer.com decrypter plugin""" __license__ = "GPLv3" __authors__ = [("hzpz", None)] - - -getInfo = create_getInfo(RSLayerCom) diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py index d8933be0a..621c80216 100644 --- a/module/plugins/crypter/RelinkUs.py +++ b/module/plugins/crypter/RelinkUs.py @@ -6,23 +6,22 @@ import binascii import os import re -from Crypto.Cipher import AES +import Crypto.Cipher -from module.plugins.internal.Crypter import Crypter, create_getInfo -from module.plugins.internal.utils import fs_join +from module.plugins.internal.Crypter import Crypter +from module.plugins.internal.misc import fsjoin class RelinkUs(Crypter): __name__ = "RelinkUs" __type__ = "crypter" - __version__ = "3.16" + __version__ = "3.17" __status__ = "testing" __pattern__ = r'http://(?:www\.)?relink\.us/(f/|((view|go)\.php\?id=))(?P<ID>.+)' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available", True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default")] __description__ = """Relink.us decrypter plugin""" __license__ = "GPLv3" @@ -87,19 +86,19 @@ class RelinkUs(Crypter): self.handle_errors() #: Get package name and folder - (package_name, folder_name) = self.get_package_info() + (pack_name, folder_name) = self.get_package_info() #: Extract package links - package_links = [] + pack_links = [] for sources in self.PREFERRED_LINK_SOURCES: - package_links.extend(self.handle_link_source(sources)) - if package_links: #: Use only first source which provides links + pack_links.extend(self.handle_link_source(sources)) + if pack_links: #: Use only first source which provides links break - package_links = set(package_links) + pack_links = set(pack_links) #: Pack - if package_links: - self.packages = [(package_name, package_links, folder_name)] + if pack_links: + self.packages = [(pack_name, pack_links, folder_name)] def init_package(self, pyfile): @@ -197,24 +196,24 @@ class RelinkUs(Crypter): def handle_CNL2Links(self): self.log_debug("Search for CNL2 links") - package_links = [] + pack_links = [] m = re.search(self.CNL2_FORM_REGEX, self.data, re.S) if m is not None: cnl2_form = m.group(1) try: (vcrypted, vjk) = self._get_cipher_params(cnl2_form) for (crypted, jk) in zip(vcrypted, vjk): - package_links.extend(self._get_links(crypted, jk)) + pack_links.extend(self._get_links(crypted, jk)) except Exception: self.log_debug("Unable to decrypt CNL2 links", trace=True) - return package_links + return pack_links def handle_DLC_links(self): self.log_debug("Search for DLC links") - package_links = [] + pack_links = [] m = re.search(self.DLC_LINK_REGEX, self.data) if m is not None: container_url = self.DLC_DOWNLOAD_URL + "?id=%s&dlc=1" % self.fileid @@ -222,21 +221,21 @@ class RelinkUs(Crypter): try: dlc = self.load(container_url) dlc_filename = self.fileid + ".dlc" - dlc_filepath = fs_join(self.pyload.config.get("general", "download_folder"), dlc_filename) + dlc_filepath = fsjoin(self.pyload.config.get("general", "download_folder"), dlc_filename) with open(dlc_filepath, "wb") as f: f.write(dlc) - package_links.append(dlc_filepath) + pack_links.append(dlc_filepath) except Exception: self.fail(_("Unable to download DLC container")) - return package_links + return pack_links def handle_WEB_links(self): self.log_debug("Search for WEB links") - package_links = [] + pack_links = [] params = re.findall(self.WEB_FORWARD_REGEX, self.data) self.log_debug("Decrypting %d Web links" % len(params)) @@ -250,14 +249,14 @@ class RelinkUs(Crypter): res = self.load(url) link = re.search(self.WEB_LINK_REGEX, res).group(1) - package_links.append(link) + pack_links.append(link) except Exception, detail: self.log_debug("Error decrypting Web link %s, %s" % (index, detail)) self.wait(4) - return package_links + return pack_links def _get_cipher_params(self, cnl2_form): @@ -283,7 +282,7 @@ class RelinkUs(Crypter): #: Decrypt Key = key IV = key - obj = AES.new(Key, AES.MODE_CBC, IV) + obj = Crypto.Cipher.AES.new(Key, Crypto.Cipher.AES.MODE_CBC, IV) text = obj.decrypt(crypted.decode('base64')) #: Extract links @@ -293,6 +292,3 @@ class RelinkUs(Crypter): #: Log and return self.log_debug("Package has %d links" % len(links)) return links - - -getInfo = create_getInfo(RelinkUs) diff --git a/module/plugins/crypter/SafelinkingNet.py b/module/plugins/crypter/SafelinkingNet.py index 98af1522f..d1c23d14f 100644 --- a/module/plugins/crypter/SafelinkingNet.py +++ b/module/plugins/crypter/SafelinkingNet.py @@ -4,22 +4,21 @@ import re import BeautifulSoup -from module.plugins.internal.utils import json -from module.plugins.internal.Crypter import Crypter, create_getInfo +from module.plugins.internal.misc import json +from module.plugins.internal.Crypter import Crypter from module.plugins.captcha.SolveMedia import SolveMedia class SafelinkingNet(Crypter): __name__ = "SafelinkingNet" __type__ = "crypter" - __version__ = "0.19" + __version__ = "0.20" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?safelinking\.net/([pd])/\w+' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available", True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default")] __description__ = """Safelinking.net decrypter plugin""" __license__ = "GPLv3" @@ -52,7 +51,7 @@ class SafelinkingNet(Crypter): m = re.search(self.SOLVEMEDIA_PATTERN, self.data) if m is not None: captchaKey = m.group(1) - captcha = SolveMedia(self) + captcha = SolveMedia(pyfile) captchaProvider = "Solvemedia" else: self.fail(_("Error parsing captcha")) @@ -83,6 +82,3 @@ class SafelinkingNet(Crypter): self.links.append("https://safelinking.net/d/" + link['full']) else: self.links.append(link['full']) - - -getInfo = create_getInfo(SafelinkingNet) diff --git a/module/plugins/crypter/SecuredIn.py b/module/plugins/crypter/SecuredIn.py index 62ec9ea7d..cb219c41c 100644 --- a/module/plugins/crypter/SecuredIn.py +++ b/module/plugins/crypter/SecuredIn.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from module.plugins.internal.DeadCrypter import DeadCrypter class SecuredIn(DeadCrypter): __name__ = "SecuredIn" __type__ = "crypter" - __version__ = "0.24" + __version__ = "0.25" __status__ = "stable" __pattern__ = r'http://(?:www\.)?secured\.in/download-[\d]+\-\w{8}\.html' @@ -15,6 +15,3 @@ class SecuredIn(DeadCrypter): __description__ = """Secured.in decrypter plugin""" __license__ = "GPLv3" __authors__ = [("mkaay", "mkaay@mkaay.de")] - - -getInfo = create_getInfo(SecuredIn) diff --git a/module/plugins/crypter/SexuriaCom.py b/module/plugins/crypter/SexuriaCom.py index 8ccf0c83a..edeecf80b 100644 --- a/module/plugins/crypter/SexuriaCom.py +++ b/module/plugins/crypter/SexuriaCom.py @@ -2,19 +2,19 @@ import re -from module.plugins.internal.Crypter import Crypter, create_getInfo +from module.plugins.internal.Crypter import Crypter class SexuriaCom(Crypter): __name__ = "SexuriaCom" __type__ = "crypter" - __version__ = "0.12" + __version__ = "0.13" __status__ = "testing" __pattern__ = r'http://(?:www\.)?sexuria\.com/(v1/)?(Pornos_Kostenlos_.+?_(\d+)\.html|dl_links_\d+_\d+\.html|id=\d+\&part=\d+\&link=\d+)' __config__ = [("activated" , "bool", "Activated" , True), ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default")] __description__ = """Sexuria.com decrypter plugin""" __license__ = "GPLv3" @@ -36,10 +36,10 @@ class SexuriaCom(Crypter): self.package = pyfile.package() #: Decrypt and add links - package_name, self.urls, folder_name, package_pwd = self.decrypt_links(self.pyfile.url) - if package_pwd: - self.pyfile.package().password = package_pwd - self.packages = [(package_name, self.urls, folder_name)] + pack_name, self.urls, folder_name, pack_pwd = self.decrypt_links(self.pyfile.url) + if pack_pwd: + self.pyfile.package().password = pack_pwd + self.packages = [(pack_name, self.urls, folder_name)] def decrypt_links(self, url): @@ -107,6 +107,3 @@ class SexuriaCom(Crypter): #: All done, return to caller return name, linklist, folder, password - - -getInfo = create_getInfo(SexuriaCom) diff --git a/module/plugins/crypter/ShSt.py b/module/plugins/crypter/ShSt.py index be2fea9e1..fdb40bd76 100644 --- a/module/plugins/crypter/ShSt.py +++ b/module/plugins/crypter/ShSt.py @@ -4,13 +4,13 @@ import re import pycurl -from module.plugins.internal.Crypter import Crypter, create_getInfo +from module.plugins.internal.Crypter import Crypter class ShSt(Crypter): __name__ = "ShSt" __type__ = "crypter" - __version__ = "0.07" + __version__ = "0.08" __status__ = "testing" __pattern__ = r'http://sh\.st/\w+' @@ -31,6 +31,3 @@ class ShSt(Crypter): header = self.load(self.pyfile.url, just_header = True, decode = False) target_url = header.get('location') self.links.append(target_url) - - -getInfo = create_getInfo(ShSt) diff --git a/module/plugins/crypter/ShareLinksBiz.py b/module/plugins/crypter/ShareLinksBiz.py index e2ddfd926..2aa670a7e 100644 --- a/module/plugins/crypter/ShareLinksBiz.py +++ b/module/plugins/crypter/ShareLinksBiz.py @@ -3,9 +3,9 @@ import binascii import re -from Crypto.Cipher import AES +import Crypto.Cipher -from module.plugins.internal.Crypter import Crypter, create_getInfo +from module.plugins.internal.Crypter import Crypter class ShareLinksBiz(Crypter): @@ -15,10 +15,9 @@ class ShareLinksBiz(Crypter): __status__ = "testing" __pattern__ = r'http://(?:www\.)?(share-links|s2l)\.biz/(?P<ID>_?\w+)' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available", True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default")] __description__ = """Share-Links.biz decrypter plugin""" __license__ = "GPLv3" @@ -53,17 +52,17 @@ class ShareLinksBiz(Crypter): self.handle_errors() #: Extract package links - package_links = [] - package_links.extend(self.handle_web_links()) - package_links.extend(self.handle_containers()) - package_links.extend(self.handle_CNL2()) - package_links = set(package_links) + pack_links = [] + pack_links.extend(self.handle_web_links()) + pack_links.extend(self.handle_containers()) + pack_links.extend(self.handle_CNL2()) + pack_links = set(pack_links) #: Get package info - package_name, package_folder = self.get_package_info() + pack_name, pack_folder = self.get_package_info() #: Pack - self.packages = [(package_name, package_links, package_folder)] + self.packages = [(pack_name, pack_links, pack_folder)] def init_file(self, pyfile): @@ -71,7 +70,7 @@ class ShareLinksBiz(Crypter): if 's2l.biz' in url: header = self.load(url, just_header=True) - + if not 'location' in header: self.fail(_("Unable to initialize download")) else: @@ -200,7 +199,7 @@ class ShareLinksBiz(Crypter): def handle_web_links(self): - package_links = [] + pack_links = [] self.log_debug("Handling Web links") #@TODO: Gather paginated web links @@ -226,16 +225,16 @@ class ShareLinksBiz(Crypter): self.log_debug("JsEngine returns value [%s] for redirection link" % dlLink) - package_links.append(dlLink) + pack_links.append(dlLink) except Exception, detail: self.log_debug("Error decrypting Web link [%s], %s" % (ID, detail)) - return package_links + return pack_links def handle_containers(self): - package_links = [] + pack_links = [] self.log_debug("Handling Container links") pattern = r'javascript:_get\(\'(.*?)\', 0, \'(rsdf|ccf|dlc)\'\)' @@ -243,23 +242,23 @@ class ShareLinksBiz(Crypter): self.log_debug("Decrypting %d Container links" % len(containersLinks)) for containerLink in containersLinks: link = "%s/get/%s/%s" % (self.base_url, containerLink[1], containerLink[0]) - package_links.append(link) - return package_links + pack_links.append(link) + return pack_links def handle_CNL2(self): - package_links = [] + pack_links = [] self.log_debug("Handling CNL2 links") if '/lib/cnl2/ClicknLoad.swf' in self.data: try: (crypted, jk) = self._get_cipher_params() - package_links.extend(self._get_links(crypted, jk)) + pack_links.extend(self._get_links(crypted, jk)) except Exception: self.fail(_("Unable to decrypt CNL2 links")) - return package_links + return pack_links def _get_cipher_params(self): @@ -290,7 +289,7 @@ class ShareLinksBiz(Crypter): #: Decrypt Key = key IV = key - obj = AES.new(Key, AES.MODE_CBC, IV) + obj = Crypto.Cipher.AES.new(Key, Crypto.Cipher.AES.MODE_CBC, IV) text = obj.decrypt(crypted.decode('base64')) #: Extract links @@ -300,6 +299,3 @@ class ShareLinksBiz(Crypter): #: Log and return self.log_debug("Block has %d links" % len(links)) return links - - -getInfo = create_getInfo(ShareLinksBiz) diff --git a/module/plugins/crypter/SharingmatrixComFolder.py b/module/plugins/crypter/SharingmatrixComFolder.py index 2fb24bca3..1b76e32fd 100644 --- a/module/plugins/crypter/SharingmatrixComFolder.py +++ b/module/plugins/crypter/SharingmatrixComFolder.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from module.plugins.internal.DeadCrypter import DeadCrypter class SharingmatrixComFolder(DeadCrypter): __name__ = "SharingmatrixComFolder" __type__ = "crypter" - __version__ = "0.05" + __version__ = "0.06" __status__ = "stable" __pattern__ = r'http://(?:www\.)?sharingmatrix\.com/folder/\w+' @@ -15,6 +15,3 @@ class SharingmatrixComFolder(DeadCrypter): __description__ = """Sharingmatrix.com folder decrypter plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - -getInfo = create_getInfo(SharingmatrixComFolder) diff --git a/module/plugins/crypter/SpeedLoadOrgFolder.py b/module/plugins/crypter/SpeedLoadOrgFolder.py index bc01d50dd..bda010205 100644 --- a/module/plugins/crypter/SpeedLoadOrgFolder.py +++ b/module/plugins/crypter/SpeedLoadOrgFolder.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from module.plugins.internal.DeadCrypter import DeadCrypter class SpeedLoadOrgFolder(DeadCrypter): __name__ = "SpeedLoadOrgFolder" __type__ = "crypter" - __version__ = "0.34" + __version__ = "0.35" __status__ = "stable" __pattern__ = r'http://(?:www\.)?speedload\.org/(\d+~f$|folder/\d+/)' @@ -15,6 +15,3 @@ class SpeedLoadOrgFolder(DeadCrypter): __description__ = """Speedload decrypter plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] - - -getInfo = create_getInfo(SpeedLoadOrgFolder) diff --git a/module/plugins/crypter/StealthTo.py b/module/plugins/crypter/StealthTo.py index 7d52b34dc..2df6612c2 100644 --- a/module/plugins/crypter/StealthTo.py +++ b/module/plugins/crypter/StealthTo.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from module.plugins.internal.DeadCrypter import DeadCrypter class StealthTo(DeadCrypter): __name__ = "StealthTo" __type__ = "crypter" - __version__ = "0.23" + __version__ = "0.24" __status__ = "stable" __pattern__ = r'http://(?:www\.)?stealth\.to/folder/.+' @@ -15,6 +15,3 @@ class StealthTo(DeadCrypter): __description__ = """Stealth.to decrypter plugin""" __license__ = "GPLv3" __authors__ = [("spoob", "spoob@pyload.org")] - - -getInfo = create_getInfo(StealthTo) diff --git a/module/plugins/crypter/TNTVillageScambioeticoOrg.py b/module/plugins/crypter/TNTVillageScambioeticoOrg.py index 81e18e697..416b2091e 100644 --- a/module/plugins/crypter/TNTVillageScambioeticoOrg.py +++ b/module/plugins/crypter/TNTVillageScambioeticoOrg.py @@ -1,20 +1,19 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter class TNTVillageScambioeticoOrg(SimpleCrypter): __name__ = "TNTVillageScambioeticoOrg" __type__ = "crypter" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __pattern__ = r'http://(?:www\.)?forum\.tntvillage\.scambioetico\.org/index\.php\?.*showtopic=\d+' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """TNTVillage.scambioetico.org decrypter plugin""" __license__ = "GPLv3" @@ -30,6 +29,3 @@ class TNTVillageScambioeticoOrg(SimpleCrypter): links = super(TNTVillageScambioeticoOrg, self).getLinks() if links: return links - - -getInfo = create_getInfo(TNTVillageScambioeticoOrg) diff --git a/module/plugins/crypter/TinyurlCom.py b/module/plugins/crypter/TinyurlCom.py index e11fa5e8f..9cec99807 100644 --- a/module/plugins/crypter/TinyurlCom.py +++ b/module/plugins/crypter/TinyurlCom.py @@ -1,20 +1,19 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter class TinyurlCom(SimpleCrypter): __name__ = "TinyurlCom" __type__ = "crypter" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(preview\.)?tinyurl\.com/[\w\-]+' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Tinyurl.com decrypter plugin""" __license__ = "GPLv3" @@ -24,6 +23,3 @@ class TinyurlCom(SimpleCrypter): URL_REPLACEMENTS = [(r'preview\.', r'')] OFFLINE_PATTERN = r">Error: Unable to find site's URL to redirect to" - - -getInfo = create_getInfo(TinyurlCom) diff --git a/module/plugins/crypter/TnyCz.py b/module/plugins/crypter/TnyCz.py index cba2df0c9..c7680a272 100644 --- a/module/plugins/crypter/TnyCz.py +++ b/module/plugins/crypter/TnyCz.py @@ -2,21 +2,20 @@ import re -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter class TnyCz(SimpleCrypter): __name__ = "TnyCz" __type__ = "crypter" - __version__ = "0.07" + __version__ = "0.08" __status__ = "testing" __pattern__ = r'http://(?:www\.)?tny\.cz/\w+' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Tny.cz decrypter plugin""" __license__ = "GPLv3" @@ -29,6 +28,3 @@ class TnyCz(SimpleCrypter): def get_links(self): m = re.search(r'<a id=\'save_paste\' href="(.+save\.php\?hash=.+)">', self.data) return re.findall(".+", self.load(m.group(1))) if m else None - - -getInfo = create_getInfo(TnyCz) diff --git a/module/plugins/crypter/TrailerzoneInfo.py b/module/plugins/crypter/TrailerzoneInfo.py index 6c3485a14..66edd32df 100644 --- a/module/plugins/crypter/TrailerzoneInfo.py +++ b/module/plugins/crypter/TrailerzoneInfo.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from module.plugins.internal.DeadCrypter import DeadCrypter class TrailerzoneInfo(DeadCrypter): __name__ = "TrailerzoneInfo" __type__ = "crypter" - __version__ = "0.06" + __version__ = "0.07" __status__ = "stable" __pattern__ = r'http://(?:www\.)?trailerzone\.info/.+' @@ -15,6 +15,3 @@ class TrailerzoneInfo(DeadCrypter): __description__ = """TrailerZone.info decrypter plugin""" __license__ = "GPLv3" __authors__ = [("godofdream", "soilfiction@gmail.com")] - - -getInfo = create_getInfo(TrailerzoneInfo) diff --git a/module/plugins/crypter/TurbobitNetFolder.py b/module/plugins/crypter/TurbobitNetFolder.py index 20f664526..32320414b 100644 --- a/module/plugins/crypter/TurbobitNetFolder.py +++ b/module/plugins/crypter/TurbobitNetFolder.py @@ -2,22 +2,21 @@ import re -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo -from module.plugins.internal.utils import json +from module.plugins.internal.SimpleCrypter import SimpleCrypter +from module.plugins.internal.misc import json class TurbobitNetFolder(SimpleCrypter): __name__ = "TurbobitNetFolder" __type__ = "crypter" - __version__ = "0.09" + __version__ = "0.10" __status__ = "broken" __pattern__ = r'http://(?:www\.)?turbobit\.net/download/folder/(?P<ID>\w+)' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Turbobit.net folder decrypter plugin""" __license__ = "GPLv3" @@ -44,6 +43,3 @@ class TurbobitNetFolder(SimpleCrypter): def get_links(self): return ["http://turbobit.net/%s.html" % id for id in self._get_links(self.info['pattern']['ID'])] - - -getInfo = create_getInfo(TurbobitNetFolder) diff --git a/module/plugins/crypter/TusfilesNetFolder.py b/module/plugins/crypter/TusfilesNetFolder.py index 8a524306d..2138e0007 100644 --- a/module/plugins/crypter/TusfilesNetFolder.py +++ b/module/plugins/crypter/TusfilesNetFolder.py @@ -4,21 +4,20 @@ import math import re import urlparse -from module.plugins.internal.XFSCrypter import XFSCrypter, create_getInfo +from module.plugins.internal.XFSCrypter import XFSCrypter class TusfilesNetFolder(XFSCrypter): __name__ = "TusfilesNetFolder" __type__ = "crypter" - __version__ = "0.13" + __version__ = "0.14" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?tusfiles\.net/go/(?P<ID>\w+)' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Tusfiles.net folder decrypter plugin""" __license__ = "GPLv3" @@ -47,6 +46,3 @@ class TusfilesNetFolder(XFSCrypter): for p in xrange(2, pages + 1): self.data = self.load_page(p) self.links.append(self.get_links()) - - -getInfo = create_getInfo(TusfilesNetFolder) diff --git a/module/plugins/crypter/UlozToFolder.py b/module/plugins/crypter/UlozToFolder.py index a57544db6..22fcac7d9 100644 --- a/module/plugins/crypter/UlozToFolder.py +++ b/module/plugins/crypter/UlozToFolder.py @@ -2,20 +2,19 @@ import re -from module.plugins.internal.Crypter import Crypter, create_getInfo +from module.plugins.internal.Crypter import Crypter class UlozToFolder(Crypter): __name__ = "UlozToFolder" __type__ = "crypter" - __version__ = "0.25" + __version__ = "0.26" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj\.cz|zachowajto\.pl)/(m|soubory)/.+' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available", True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default")] __description__ = """Uloz.to folder decrypter plugin""" __license__ = "GPLv3" @@ -48,6 +47,3 @@ class UlozToFolder(Crypter): if new_links: self.links = [map(lambda s: "http://ulozto.net/%s" % s, new_links)] - - -getInfo = create_getInfo(UlozToFolder) diff --git a/module/plugins/crypter/UploadableChFolder.py b/module/plugins/crypter/UploadableChFolder.py index 320dbc0d9..f108f0a4a 100644 --- a/module/plugins/crypter/UploadableChFolder.py +++ b/module/plugins/crypter/UploadableChFolder.py @@ -1,20 +1,19 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter class UploadableChFolder(SimpleCrypter): __name__ = "UploadableChFolder" __type__ = "crypter" - __version__ = "0.07" + __version__ = "0.08" __status__ = "testing" __pattern__ = r'http://(?:www\.)?uploadable\.ch/list/\w+' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Uploadable.ch folder decrypter plugin""" __license__ = "GPLv3" @@ -26,6 +25,3 @@ class UploadableChFolder(SimpleCrypter): NAME_PATTERN = r'<div class="folder"><span> </span>(?P<N>.+?)</div>' OFFLINE_PATTERN = r'We are sorry... The URL you entered cannot be found on the server.' TEMP_OFFLINE_PATTERN = r'<div class="icon_err">' - - -getInfo = create_getInfo(UploadableChFolder) diff --git a/module/plugins/crypter/UploadedToFolder.py b/module/plugins/crypter/UploadedToFolder.py index 8c55beda9..5b1f7a688 100644 --- a/module/plugins/crypter/UploadedToFolder.py +++ b/module/plugins/crypter/UploadedToFolder.py @@ -2,21 +2,20 @@ import re -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter class UploadedToFolder(SimpleCrypter): __name__ = "UploadedToFolder" __type__ = "crypter" - __version__ = "0.47" + __version__ = "0.48" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(uploaded|ul)\.(to|net)/(f|folder|list)/\w+' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """UploadedTo decrypter plugin""" __license__ = "GPLv3" @@ -28,6 +27,3 @@ class UploadedToFolder(SimpleCrypter): TEMP_OFFLINE_PATTERN = r'<title>uploaded\.net - Maintenance' LINK_PATTERN = r'<h2><a href="(.+?)"' - - -getInfo = create_getInfo(UploadedToFolder) diff --git a/module/plugins/crypter/WiiReloadedOrg.py b/module/plugins/crypter/WiiReloadedOrg.py index ebacdd953..4c3c5f82d 100644 --- a/module/plugins/crypter/WiiReloadedOrg.py +++ b/module/plugins/crypter/WiiReloadedOrg.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from module.plugins.internal.DeadCrypter import DeadCrypter class WiiReloadedOrg(DeadCrypter): __name__ = "WiiReloadedOrg" __type__ = "crypter" - __version__ = "0.14" + __version__ = "0.15" __status__ = "stable" __pattern__ = r'http://(?:www\.)?wii-reloaded\.org/protect/get\.php\?i=.+' @@ -15,6 +15,3 @@ class WiiReloadedOrg(DeadCrypter): __description__ = """Wii-Reloaded.org decrypter plugin""" __license__ = "GPLv3" __authors__ = [("hzpz", None)] - - -getInfo = create_getInfo(WiiReloadedOrg) diff --git a/module/plugins/crypter/WuploadComFolder.py b/module/plugins/crypter/WuploadComFolder.py index 92cf7bae0..738ba0fe3 100644 --- a/module/plugins/crypter/WuploadComFolder.py +++ b/module/plugins/crypter/WuploadComFolder.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from module.plugins.internal.DeadCrypter import DeadCrypter class WuploadComFolder(DeadCrypter): __name__ = "WuploadComFolder" __type__ = "crypter" - __version__ = "0.05" + __version__ = "0.06" __status__ = "stable" __pattern__ = r'http://(?:www\.)?wupload\.com/folder/\w+' @@ -15,6 +15,3 @@ class WuploadComFolder(DeadCrypter): __description__ = """Wupload.com folder decrypter plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - -getInfo = create_getInfo(WuploadComFolder) diff --git a/module/plugins/crypter/XFileSharingFolder.py b/module/plugins/crypter/XFileSharingFolder.py index 927a0f6bc..26ba286c0 100644 --- a/module/plugins/crypter/XFileSharingFolder.py +++ b/module/plugins/crypter/XFileSharingFolder.py @@ -2,21 +2,20 @@ import re -from module.plugins.internal.XFSCrypter import XFSCrypter, create_getInfo +from module.plugins.internal.XFSCrypter import XFSCrypter class XFileSharingFolder(XFSCrypter): __name__ = "XFileSharingFolder" __type__ = "crypter" - __version__ = "0.23" + __version__ = "0.24" __status__ = "testing" __pattern__ = r'^unmatchable$' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """XFileSharing dummy folder decrypter plugin for hook""" __license__ = "GPLv3" @@ -39,7 +38,7 @@ class XFileSharingFolder(XFSCrypter): def setup_base(self): if self.account: self.req = self.pyload.requestFactory.getRequest(self.PLUGIN_NAME, self.account.user) - self.premium = self.account.info['data']['premium'] #@NOTE: Avoid one unnecessary get_info call by `self.account.premium` here + self.premium = self.account.info['data']['premium'] #@NOTE: Don't call get_info here to reduce overhead else: self.req = self.pyload.requestFactory.getRequest(self.classname) self.premium = False @@ -53,6 +52,3 @@ class XFileSharingFolder(XFSCrypter): self.__class__.__name__ = str(self.PLUGIN_NAME) super(XFileSharingFolder, self).load_account() self.__class__.__name__ = class_name - - -getInfo = create_getInfo(XFileSharingFolder) diff --git a/module/plugins/crypter/XupPl.py b/module/plugins/crypter/XupPl.py index 39d168379..c47be0645 100644 --- a/module/plugins/crypter/XupPl.py +++ b/module/plugins/crypter/XupPl.py @@ -1,19 +1,18 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.Crypter import Crypter, create_getInfo +from module.plugins.internal.Crypter import Crypter class XupPl(Crypter): __name__ = "XupPl" __type__ = "crypter" - __version__ = "0.14" + __version__ = "0.15" __status__ = "testing" __pattern__ = r'https?://(?:[^/]*\.)?xup\.pl/.+' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available", True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default")] __description__ = """Xup.pl decrypter plugin""" __license__ = "GPLv3" @@ -26,6 +25,3 @@ class XupPl(Crypter): self.links = [header.get('location')] else: self.fail(_("Unable to find link")) - - -getInfo = create_getInfo(XupPl) diff --git a/module/plugins/crypter/YoutubeComFolder.py b/module/plugins/crypter/YoutubeComFolder.py index b7b51aeef..dc605ffce 100644 --- a/module/plugins/crypter/YoutubeComFolder.py +++ b/module/plugins/crypter/YoutubeComFolder.py @@ -3,24 +3,23 @@ import re import urlparse -from module.plugins.internal.Crypter import Crypter, create_getInfo -from module.plugins.internal.utils import fs_join, json +from module.plugins.internal.Crypter import Crypter +from module.plugins.internal.misc import fsjoin, json class YoutubeComFolder(Crypter): __name__ = "YoutubeComFolder" __type__ = "crypter" - __version__ = "1.07" + __version__ = "1.08" __status__ = "testing" __pattern__ = r'https?://(?:www\.|m\.)?youtube\.com/(?P<TYPE>user|playlist|view_play_list)(/|.*?[?&](?:list|p)=)(?P<ID>[\w\-]+)' - __config__ = [("activated" , "bool", "Activated" , True ), - ("use_premium" , "bool", "Use premium account if available" , True ), - ("use_subfolder" , "bool", "Save package to subfolder" , True ), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True ), - ("likes" , "bool", "Grab user (channel) liked videos" , False), - ("favorites" , "bool", "Grab user (channel) favorite videos", False), - ("uploads" , "bool", "Grab channel unplaylisted videos" , True )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("likes" , "bool" , "Grab user (channel) liked videos" , False ), + ("favorites" , "bool" , "Grab user (channel) favorite videos", False ), + ("uploads" , "bool" , "Grab channel unplaylisted videos" , True )] __description__ = """Youtube.com channel & playlist decrypter plugin""" __license__ = "GPLv3" @@ -117,7 +116,7 @@ class YoutubeComFolder(Crypter): relatedplaylist['uploads']['checkDups'] = True #: checkDups flag for p_name, p_data in relatedplaylist.items(): - if self.get_config(p_name): + if self.config.get(p_name): p_data['title'] += " of " + user playlists.append(p_data) else: @@ -134,7 +133,7 @@ class YoutubeComFolder(Crypter): for p in playlists: p_name = p['title'] p_videos = self.get_videos_id(p['id']) - p_folder = fs_join(self.pyload.config.get("general", "download_folder"), p['channelTitle'], p_name) + p_folder = fsjoin(self.pyload.config.get("general", "download_folder"), p['channelTitle'], p_name) self.log_debug("%s video\s found on playlist \"%s\"" % (len(p_videos), p_name)) if not p_videos: @@ -148,6 +147,3 @@ class YoutubeComFolder(Crypter): self.packages.append((p_name, p_urls, p_folder)) #: Folder is NOT recognized by pyload 0.4.9! addedvideos.extend(p_videos) - - -getInfo = create_getInfo(YoutubeComFolder) diff --git a/module/plugins/hooks/AndroidPhoneNotify.py b/module/plugins/hooks/AndroidPhoneNotify.py index cc7fe8d6b..5a5188365 100644 --- a/module/plugins/hooks/AndroidPhoneNotify.py +++ b/module/plugins/hooks/AndroidPhoneNotify.py @@ -6,19 +6,22 @@ from module.plugins.internal.Notifier import Notifier class AndroidPhoneNotify(Notifier): __name__ = "AndroidPhoneNotify" __type__ = "hook" - __version__ = "0.13" + __version__ = "0.15" __status__ = "testing" - __config__ = [("activated" , "bool", "Activated" , False), - ("apikey" , "str" , "API key" , "" ), - ("notifycaptcha" , "bool", "Notify captcha request" , True ), - ("notifypackage" , "bool", "Notify package finished" , True ), - ("notifyprocessed", "bool", "Notify packages processed" , True ), - ("notifyupdate" , "bool", "Notify plugin updates" , True ), - ("notifyexit" , "bool", "Notify pyLoad shutdown" , True ), - ("sendtimewait" , "int" , "Timewait in seconds between notifications", 5 ), - ("sendpermin" , "int" , "Max notifications per minute" , 12 ), - ("ignoreclient" , "bool", "Send notifications if client is connected", False)] + __config__ = [("activated" , "bool", "Activated" , False), + ("apikey" , "str" , "API key" , "" ), + ("captcha" , "bool", "Notify captcha request" , True ), + ("reconnection" , "bool", "Notify reconnection request" , False), + ("downloadfinished", "bool", "Notify download finished" , True ), + ("downloadfailed" , "bool", "Notify download failed" , True ), + ("packagefinished" , "bool", "Notify package finished" , True ), + ("packagefailed" , "bool", "Notify package failed" , True ), + ("update" , "bool", "Notify pyLoad update" , False), + ("exit" , "bool", "Notify pyLoad shutdown/restart" , False), + ("sendinterval" , "int" , "Interval in seconds between notifications", 1 ), + ("sendpermin" , "int" , "Max notifications per minute" , 60 ), + ("ignoreclient" , "bool", "Send notifications if client is connected", True )] __description__ = """Send push notifications to your Android Phone using notifymyandroid.com""" __license__ = "GPLv3" @@ -27,7 +30,7 @@ class AndroidPhoneNotify(Notifier): def get_key(self): - return self.get_config('apikey') + return self.config.get('apikey') def send(self, event, msg, key): diff --git a/module/plugins/hooks/AntiStandby.py b/module/plugins/hooks/AntiStandby.py index 5ad95d6e8..2159e5937 100644 --- a/module/plugins/hooks/AntiStandby.py +++ b/module/plugins/hooks/AntiStandby.py @@ -13,7 +13,7 @@ except ImportError: pass from module.plugins.internal.Addon import Addon, Expose -from module.plugins.internal.utils import encode, fs_join +from module.plugins.internal.misc import encode, fsjoin class Kernel32(object): @@ -27,7 +27,7 @@ class Kernel32(object): class AntiStandby(Addon): __name__ = "AntiStandby" __type__ = "hook" - __version__ = "0.13" + __version__ = "0.14" __status__ = "testing" __config__ = [("activated", "bool", "Activated" , True ), @@ -50,12 +50,12 @@ class AntiStandby(Addon): def activate(self): - hdd = self.get_config('hdd') - system = not self.get_config('system') - display = not self.get_config('display') + hdd = self.config.get('hdd') + system = not self.config.get('system') + display = not self.config.get('display') if hdd: - self.start_periodical(self.get_config('interval'), threaded=True) + self.periodical.start(self.config.get('interval'), threaded=True) if os.name is "nt": self.win_standby(system, display) @@ -68,11 +68,7 @@ class AntiStandby(Addon): def deactivate(self): - try: - os.remove(self.TMP_FILE) - - except OSError: - pass + self.remove(self.TMP_FILE, trash=False) if os.name is "nt": self.win_standby(True) @@ -152,22 +148,22 @@ class AntiStandby(Addon): @Expose def max_mtime(self, path): return max(0, 0, - *(os.path.getmtime(fs_join(root, file)) + *(os.path.getmtime(fsjoin(root, file)) for root, dirs, files in os.walk(encode(path), topdown=False) for file in files)) - def periodical(self): - if self.get_config('hdd') is False: + def periodical_task(self): + if self.config.get('hdd') is False: return if (self.pyload.threadManager.pause or - not self.pyload.api.isTimeDownload() or - not self.pyload.threadManager.getActiveFiles()): + not self.pyload.api.isTimeDownload() or + not self.pyload.threadManager.getActiveFiles()): return dl_folder = self.pyload.config.get("general", "download_folder") - if (self.max_mtime(dl_folder) - self.mtime) < self.interval: + if (self.max_mtime(dl_folder) - self.mtime) < self.periodical.interval: return self.touch(self.TMP_FILE) diff --git a/module/plugins/hooks/AntiVirus.py b/module/plugins/hooks/AntiVirus.py index 049e92ab8..1a0f3f8bd 100644 --- a/module/plugins/hooks/AntiVirus.py +++ b/module/plugins/hooks/AntiVirus.py @@ -10,14 +10,14 @@ except ImportError: pass from module.plugins.internal.Addon import Addon, Expose, threaded -from module.plugins.internal.utils import encode, exists, fs_join +from module.plugins.internal.misc import encode, exists, fsjoin class AntiVirus(Addon): __name__ = "AntiVirus" __type__ = "hook" - __version__ = "0.15" - __status__ = "testing" + __version__ = "0.16" + __status__ = "broken" #@TODO: add trash option (use Send2Trash lib) __config__ = [("activated" , "bool" , "Activated" , False ), @@ -38,18 +38,18 @@ class AntiVirus(Addon): @Expose @threaded def scan(self, pyfile, thread): - avfile = encode(self.get_config('avfile')) - avargs = encode(self.get_config('avargs').strip()) + avfile = encode(self.config.get('avfile')) + avargs = encode(self.config.get('avargs').strip()) if not os.path.isfile(avfile): self.fail(_("Antivirus executable not found")) - scanfolder = self.get_config('avtarget') is "folder" + scanfolder = self.config.get('avtarget') is "folder" if scanfolder: dl_folder = self.pyload.config.get("general", "download_folder") package_folder = pyfile.package().folder if self.pyload.config.get("general", "folder_per_package") else "" - target = fs_join(dl_folder, package_folder, pyfile.name) + target = fsjoin(dl_folder, package_folder, pyfile.name) target_repr = "Folder: " + package_folder or dl_folder else: target = encode(pyfile.plugin.last_download) @@ -75,12 +75,12 @@ class AntiVirus(Addon): if err: self.log_warning(target_repr, err) - if not self.get_config('ignore-err'): + if not self.config.get('ignore-err'): self.log_debug("Delete/Quarantine task aborted due scan error") return if p.returncode: - action = self.get_config('action') + action = self.config.get('action') if scanfolder: if action is "Antivirus default": @@ -91,7 +91,7 @@ class AntiVirus(Addon): try: if action is "Delete": - if not self.get_config('deltotrash'): + if not self.config.get('deltotrash'): os.remove(file) else: @@ -101,19 +101,19 @@ class AntiVirus(Addon): except NameError: self.log_warning(_("Send2Trash lib not found, moving to quarantine instead")) pyfile.setCustomStatus(_("file moving")) - shutil.move(file, self.get_config('quardir')) + shutil.move(file, self.config.get('quardir')) except Exception, e: self.log_warning(_("Unable to move file to trash: %s, moving to quarantine instead") % e.message) pyfile.setCustomStatus(_("file moving")) - shutil.move(file, self.get_config('quardir')) + shutil.move(file, self.config.get('quardir')) else: self.log_debug("Successfully moved file to trash") elif action is "Quarantine": pyfile.setCustomStatus(_("file moving")) - shutil.move(file, self.get_config('quardir')) + shutil.move(file, self.config.get('quardir')) except (IOError, shutil.Error), e: self.log_error(target_repr, action + " action failed!", e) @@ -132,5 +132,5 @@ class AntiVirus(Addon): def download_failed(self, pyfile): #: Check if pyfile is still "failed", maybe might has been restarted in meantime - if pyfile.status is 8 and self.get_config('scanfailed'): + if pyfile.status is 8 and self.config.get('scanfailed'): return self.scan(pyfile) diff --git a/module/plugins/hooks/BypassCaptcha.py b/module/plugins/hooks/BypassCaptcha.py index 581d2f6dd..bc28b1469 100644 --- a/module/plugins/hooks/BypassCaptcha.py +++ b/module/plugins/hooks/BypassCaptcha.py @@ -28,7 +28,7 @@ class BypassCaptchaException(Exception): class BypassCaptcha(Addon): __name__ = "BypassCaptcha" __type__ = "hook" - __version__ = "0.09" + __version__ = "0.10" __status__ = "testing" __config__ = [("activated" , "bool" , "Activated" , False), @@ -50,7 +50,7 @@ class BypassCaptcha(Addon): def get_credits(self): - res = self.load(self.GETCREDITS_URL, post={'key': self.get_config('passkey')}) + res = self.load(self.GETCREDITS_URL, post={'key': self.config.get('passkey')}) data = dict(x.split(' ', 1) for x in res.splitlines()) return int(data['Left']) @@ -65,7 +65,7 @@ class BypassCaptcha(Addon): try: res = self.load(self.SUBMIT_URL, post={'vendor_key': self.PYLOAD_KEY, - 'key': self.get_config('passkey'), + 'key': self.config.get('passkey'), 'gen_task_id': "1", 'file': (pycurl.FORM_FILE, captcha)}, req=req) @@ -85,7 +85,7 @@ class BypassCaptcha(Addon): def respond(self, ticket, success): try: - res = self.load(self.RESPOND_URL, post={'task_id': ticket, 'key': self.get_config('passkey'), + res = self.load(self.RESPOND_URL, post={'task_id': ticket, 'key': self.config.get('passkey'), 'cv': 1 if success else 0}) except BadHeader, e: self.log_error(_("Could not send response"), e) @@ -98,10 +98,10 @@ class BypassCaptcha(Addon): if not task.isTextual(): return False - if not self.get_config('passkey'): + if not self.config.get('passkey'): return False - if self.pyload.isClientConnected() and self.get_config('check_client'): + if self.pyload.isClientConnected() and self.config.get('check_client'): return False if self.get_credits() > 0: diff --git a/module/plugins/hooks/Captcha9Kw.py b/module/plugins/hooks/Captcha9Kw.py index c81882f67..714be8bc4 100644 --- a/module/plugins/hooks/Captcha9Kw.py +++ b/module/plugins/hooks/Captcha9Kw.py @@ -2,11 +2,10 @@ from __future__ import with_statement +import base64 import re import time -from base64 import b64encode - from module.network.HTTPRequest import BadHeader from module.plugins.internal.Addon import Addon, threaded @@ -14,7 +13,7 @@ from module.plugins.internal.Addon import Addon, threaded class Captcha9Kw(Addon): __name__ = "Captcha9Kw" __type__ = "hook" - __version__ = "0.31" + __version__ = "0.32" __status__ = "testing" __config__ = [("activated" , "bool" , "Activated" , False ), @@ -40,7 +39,7 @@ class Captcha9Kw(Addon): def get_credits(self): res = self.load(self.API_URL, - get={'apikey': self.get_config('passkey'), + get={'apikey': self.config.get('passkey'), 'pyload': "1", 'source': "pyload", 'action': "usercaptchaguthaben"}) @@ -71,14 +70,14 @@ class Captcha9Kw(Addon): 'numeric' : 0, 'case_sensitive': 0, 'math' : 0, - 'prio' : min(max(self.get_config('prio'), 0), 10), - 'confirm' : self.get_config('confirm'), - 'timeout' : min(max(self.get_config('timeout'), 300), 3999), - 'selfsolve' : self.get_config('selfsolve'), - 'cph' : self.get_config('captchaperhour'), - 'cpm' : self.get_config('captchapermin')} - - for opt in str(self.get_config('hoster_options').split('|')): + 'prio' : min(max(self.config.get('prio'), 0), 10), + 'confirm' : self.config.get('confirm'), + 'timeout' : min(max(self.config.get('timeout'), 300), 3999), + 'selfsolve' : self.config.get('selfsolve'), + 'cph' : self.config.get('captchaperhour'), + 'cpm' : self.config.get('captchapermin')} + + for opt in str(self.config.get('hoster_options').split('|')): details = map(str.strip, opt.split(':')) if not details or details[0].lower() is not pluginname.lower(): @@ -96,7 +95,7 @@ class Captcha9Kw(Addon): break - post_data = {'apikey' : self.get_config('passkey'), + post_data = {'apikey' : self.config.get('passkey'), 'prio' : option['prio'], 'confirm' : option['confirm'], 'maxtimeout' : option['timeout'], @@ -114,7 +113,7 @@ class Captcha9Kw(Addon): 'source' : "pyload", 'base64' : 1, 'mouse' : 1 if task.isPositional() else 0, - 'file-upload-01': b64encode(data), + 'file-upload-01': base64.b64encode(data), 'action' : "usercaptchaupload"} for _i in xrange(5): @@ -136,9 +135,9 @@ class Captcha9Kw(Addon): task.data['ticket'] = res - for _i in xrange(int(self.get_config('timeout') / 5)): + for _i in xrange(int(self.config.get('timeout') / 5)): result = self.load(self.API_URL, - get={'apikey': self.get_config('passkey'), + get={'apikey': self.config.get('passkey'), 'id' : res, 'pyload': "1", 'info' : "1", @@ -163,10 +162,10 @@ class Captcha9Kw(Addon): if not task.isTextual() and not task.isPositional(): return - if not self.get_config('passkey'): + if not self.config.get('passkey'): return - if self.pyload.isClientConnected() and self.get_config('check_client'): + if self.pyload.isClientConnected() and self.config.get('check_client'): return credits = self.get_credits() @@ -175,8 +174,8 @@ class Captcha9Kw(Addon): self.log_error(_("Your captcha 9kw.eu account has not enough credits")) return - queue = min(self.get_config('queue'), 999) - timeout = min(max(self.get_config('timeout'), 300), 3999) + queue = min(self.config.get('queue'), 999) + timeout = min(max(self.config.get('timeout'), 300), 3999) pluginname = re.search(r'_(.+?)_\d+.\w+', task.captchaFile).group(1) for _i in xrange(5): @@ -189,7 +188,7 @@ class Captcha9Kw(Addon): else: self.fail(_("Too many captchas in queue")) - for opt in str(self.get_config('hoster_options').split('|')): + for opt in str(self.config.get('hoster_options').split('|')): details = map(str.strip, opt.split(':')) if not details or details[0].lower() is not pluginname.lower(): @@ -219,7 +218,7 @@ class Captcha9Kw(Addon): self.log_debug("No CaptchaID for %s request (task: %s)" % (type, task)) return - passkey = self.get_config('passkey') + passkey = self.config.get('passkey') for _i in xrange(3): res = self.load(self.API_URL, diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index 5334c1c5b..15546c63f 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -3,10 +3,11 @@ from __future__ import with_statement import StringIO -import pycurl import time import urllib +import pycurl + try: from PIL import Image @@ -38,7 +39,7 @@ class CaptchaBrotherhoodException(Exception): class CaptchaBrotherhood(Addon): __name__ = "CaptchaBrotherhood" __type__ = "hook" - __version__ = "0.11" + __version__ = "0.12" __status__ = "testing" __config__ = [("activated" , "bool" , "Activated" , False), @@ -57,7 +58,7 @@ class CaptchaBrotherhood(Addon): def get_credits(self): res = self.load(self.API_URL + "askCredits.aspx", - get={'username': self.get_config('username'), 'password': self.get_config('password')}) + get={'username': self.config.get('username'), 'password': self.config.get('password')}) if not res.startswith("OK"): raise CaptchaBrotherhoodException(res) else: @@ -87,8 +88,8 @@ class CaptchaBrotherhood(Addon): req = get_request() url = "%ssendNewCaptcha.aspx?%s" % (self.API_URL, - urllib.urlencode({'username' : self.get_config('username'), - 'password' : self.get_config('password'), + urllib.urlencode({'username' : self.config.get('username'), + 'password' : self.config.get('password'), 'captchaSource': "pyLoad", 'timeout' : "80"})) @@ -122,8 +123,8 @@ class CaptchaBrotherhood(Addon): def api_response(self, api, ticket): res = self.load("%s%s.aspx" % (self.API_URL, api), - get={'username': self.get_config('username'), - 'password': self.get_config('password'), + get={'username': self.config.get('username'), + 'password': self.config.get('password'), 'captchaID': ticket}) if not res.startswith("OK"): raise CaptchaBrotherhoodException("Unknown response: %s" % res) @@ -138,10 +139,10 @@ class CaptchaBrotherhood(Addon): if not task.isTextual(): return False - if not self.get_config('username') or not self.get_config('password'): + if not self.config.get('username') or not self.config.get('password'): return False - if self.pyload.isClientConnected() and self.get_config('check_client'): + if self.pyload.isClientConnected() and self.config.get('check_client'): return False if self.get_credits() > 10: diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index cf5ed2147..af6f2f406 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -8,7 +8,7 @@ import re import zlib from module.plugins.internal.Addon import Addon -from module.plugins.internal.utils import encode, fs_join +from module.plugins.internal.misc import encode, fsjoin def compute_checksum(local_file, algorithm): @@ -38,8 +38,8 @@ def compute_checksum(local_file, algorithm): class Checksum(Addon): __name__ = "Checksum" __type__ = "hook" - __version__ = "0.23" - __status__ = "testing" + __version__ = "0.24" + __status__ = "broken" __config__ = [("activated" , "bool" , "Activated" , False ), ("check_checksum", "bool" , "Check checksum? (If False only size will be verified)", True ), @@ -65,7 +65,7 @@ class Checksum(Addon): def activate(self): - if not self.get_config('check_checksum'): + if not self.config.get('check_checksum'): self.log_info(_("Checksum validation is disabled in plugin configuration")) @@ -105,7 +105,7 @@ class Checksum(Addon): local_file = encode(pyfile.plugin.last_download) # dl_folder = self.pyload.config.get("general", "download_folder") - # local_file = encode(fs_join(dl_folder, pyfile.package().folder, pyfile.name)) + # local_file = encode(fsjoin(dl_folder, pyfile.package().folder, pyfile.name)) if not os.path.isfile(local_file): self.check_failed(pyfile, None, "File does not exist") @@ -122,7 +122,7 @@ class Checksum(Addon): data.pop('size', None) #: Validate checksum - if data and self.get_config('check_checksum'): + if data and self.config.get('check_checksum'): if not 'md5' in data: for type in ("checksum", "hashsum", "hash"): @@ -149,14 +149,14 @@ class Checksum(Addon): def check_failed(self, pyfile, local_file, msg): - check_action = self.get_config('check_action') + check_action = self.config.get('check_action') if check_action == "retry": - max_tries = self.get_config('max_tries') - retry_action = self.get_config('retry_action') + max_tries = self.config.get('max_tries') + retry_action = self.config.get('retry_action') if pyfile.plugin.retries < max_tries: if local_file: os.remove(local_file) - pyfile.plugin.retry(max_tries, self.get_config('wait_time'), msg) + pyfile.plugin.retry(max_tries, self.config.get('wait_time'), msg) elif retry_action == "nothing": return elif check_action == "nothing": @@ -166,17 +166,17 @@ class Checksum(Addon): def package_finished(self, pypack): - dl_folder = fs_join(self.pyload.config.get("general", "download_folder"), pypack.folder, "") + dl_folder = fsjoin(self.pyload.config.get("general", "download_folder"), pypack.folder, "") - for link in pypack.getChildren().values(): - file_type = os.path.splitext(link['name'])[1][1:].lower() + for fid, fdata in pypack.getChildren().items(): + file_type = os.path.splitext(fdata['name'])[1][1:].lower() if file_type not in self.formats: continue - hash_file = encode(fs_join(dl_folder, link['name'])) + hash_file = encode(fsjoin(dl_folder, fdata['name'])) if not os.path.isfile(hash_file): - self.log_warning(_("File not found"), link['name']) + self.log_warning(_("File not found"), fdata['name']) continue with open(hash_file) as f: @@ -184,9 +184,9 @@ class Checksum(Addon): for m in re.finditer(self.regexps.get(file_type, self.regexps['default']), text): data = m.groupdict() - self.log_debug(link['name'], data) + self.log_debug(fdata['name'], data) - local_file = encode(fs_join(dl_folder, data['NAME'])) + local_file = encode(fsjoin(dl_folder, data['NAME'])) algorithm = self.methods.get(file_type, file_type) checksum = compute_checksum(local_file, algorithm) diff --git a/module/plugins/hooks/ClickNLoad.py b/module/plugins/hooks/ClickNLoad.py index 79bf66c09..08b16d221 100644 --- a/module/plugins/hooks/ClickNLoad.py +++ b/module/plugins/hooks/ClickNLoad.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- import socket -import threading import time try: @@ -10,17 +9,7 @@ except ImportError: pass from module.plugins.internal.Addon import Addon, threaded - - -def forward(source, destination): - try: - bufsize = 1024 - bufdata = source.recv(bufsize) - while bufdata: - destination.sendall(bufdata) - bufdata = source.recv(bufsize) - finally: - destination.shutdown(socket.SHUT_WR) +from module.plugins.internal.misc import forward, lock #@TODO: IPv6 support @@ -46,8 +35,8 @@ class ClickNLoad(Addon): if not self.pyload.config.get("webinterface", "activated"): return - cnlip = "" if self.get_config('extern') else "127.0.0.1" - cnlport = self.get_config('port') + cnlip = "" if self.config.get('extern') else "127.0.0.1" + cnlport = self.config.get('port') webip = "127.0.0.1" if any(_ip == self.pyload.config.get("webinterface", "host") for _ip in ("0.0.0.0", "")) \ else self.pyload.config.get("webinterface", "host") webport = self.pyload.config.get("webinterface", "port") @@ -55,6 +44,7 @@ class ClickNLoad(Addon): self.pyload.scheduler.addJob(5, self.proxy, [cnlip, cnlport, webip, webport], threaded=False) + @lock @threaded def forward(self, source, destination, queue=False): if queue: @@ -71,13 +61,8 @@ class ClickNLoad(Addon): @threaded def proxy(self, cnlip, cnlport, webip, webport): self.log_info(_("Proxy listening on %s:%s") % (cnlip or "0.0.0.0", cnlport)) - self._server(cnlip, cnlport, webip, webport) - lock = threading.Lock() - lock.acquire() - lock.acquire() - @threaded def _server(self, cnlip, cnlport, webip, webport): @@ -108,7 +93,7 @@ class ClickNLoad(Addon): server_socket.connect((webip, webport)) - self.forward(client_socket, server_socket, self.get_config('dest') is "queue") + self.forward(client_socket, server_socket, self.config.get('dest') is "queue") self.forward(server_socket, client_socket) except socket.timeout: diff --git a/module/plugins/hooks/DeathByCaptcha.py b/module/plugins/hooks/DeathByCaptcha.py index 5c1c89c88..62cfe7d16 100644 --- a/module/plugins/hooks/DeathByCaptcha.py +++ b/module/plugins/hooks/DeathByCaptcha.py @@ -2,16 +2,16 @@ from __future__ import with_statement -import pycurl +import base64 import re import time -from base64 import b64encode +import pycurl -from module.plugins.internal.utils import json from module.network.HTTPRequest import BadHeader from module.network.RequestFactory import getRequest as get_request from module.plugins.internal.Addon import Addon, threaded +from module.plugins.internal.misc import json class DeathByCaptchaException(Exception): @@ -51,7 +51,7 @@ class DeathByCaptchaException(Exception): class DeathByCaptcha(Addon): __name__ = "DeathByCaptcha" __type__ = "hook" - __version__ = "0.10" + __version__ = "0.11" __status__ = "testing" __config__ = [("activated" , "bool" , "Activated" , False), @@ -75,8 +75,8 @@ class DeathByCaptcha(Addon): if post: if not isinstance(post, dict): post = {} - post.update({'username': self.get_config('username'), - 'password': self.get_config('password')}) + post.update({'username': self.config.get('username'), + 'password': self.config.get('password')}) res = None try: @@ -94,13 +94,13 @@ class DeathByCaptcha(Addon): raise DeathByCaptchaException(str(res)) except BadHeader, e: - if e.code == 403: + if e.code is 403: raise DeathByCaptchaException('not-logged-in') - elif e.code == 413: + elif e.code is 413: raise DeathByCaptchaException('invalid-captcha') - elif e.code == 503: + elif e.code is 503: raise DeathByCaptchaException('service-overload') elif e.code in (400, 405): @@ -135,14 +135,14 @@ class DeathByCaptcha(Addon): def submit(self, captcha, captchaType="file", match=None): #@NOTE: Workaround multipart-post bug in HTTPRequest.py - if re.match("^\w*$", self.get_config('password')): + if re.match("^\w*$", self.config.get('password')): multipart = True data = (pycurl.FORM_FILE, captcha) else: multipart = False with open(captcha, 'rb') as f: data = f.read() - data = "base64:" + b64encode(data) + data = "base64:" + base64.b64encode(data) res = self.api_response("captcha", {'captchafile': data}, multipart) @@ -171,10 +171,10 @@ class DeathByCaptcha(Addon): if not task.isTextual(): return False - if not self.get_config('username') or not self.get_config('password'): + if not self.config.get('username') or not self.config.get('password'): return False - if self.pyload.isClientConnected() and self.get_config('check_client'): + if self.pyload.isClientConnected() and self.config.get('check_client'): return False try: diff --git a/module/plugins/hooks/DeleteFinished.py b/module/plugins/hooks/DeleteFinished.py index 17b85959a..67e1a1056 100644 --- a/module/plugins/hooks/DeleteFinished.py +++ b/module/plugins/hooks/DeleteFinished.py @@ -7,7 +7,7 @@ from module.plugins.internal.Addon import Addon class DeleteFinished(Addon): __name__ = "DeleteFinished" __type__ = "hook" - __version__ = "1.17" + __version__ = "1.18" __status__ = "testing" __config__ = [("activated" , "bool", "Activated" , False), @@ -19,12 +19,9 @@ class DeleteFinished(Addon): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - PERIODICAL_INTERVAL = 1 * 60 * 60 #: 1 hour - - - def periodical(self): + def periodical_task(self): if not self.info['sleep']: - deloffline = self.get_config('deloffline') + deloffline = self.config.get('deloffline') mode = "0,1,4" if deloffline else "0,4" msg = _('delete all finished packages in queue list (%s packages with offline links)') self.log_info(msg % (_('including') if deloffline else _('excluding'))) @@ -39,8 +36,8 @@ class DeleteFinished(Addon): def activate(self): self.info['sleep'] = True - self.set_interval(self.get_config('interval') * 60 * 60) self.add_event('package_finished', self.wakeup) + self.periodical.start(self.config.get('interval') * 60 * 60) ## own methods ## diff --git a/module/plugins/hooks/DownloadScheduler.py b/module/plugins/hooks/DownloadScheduler.py index 9c644ab20..d4c0356fd 100644 --- a/module/plugins/hooks/DownloadScheduler.py +++ b/module/plugins/hooks/DownloadScheduler.py @@ -9,7 +9,7 @@ from module.plugins.internal.Addon import Addon class DownloadScheduler(Addon): __name__ = "DownloadScheduler" __type__ = "hook" - __version__ = "0.25" + __version__ = "0.26" __status__ = "testing" __config__ = [("activated", "bool", "Activated" , False ), @@ -28,7 +28,7 @@ class DownloadScheduler(Addon): def update_schedule(self, schedule=None): if schedule is None: - schedule = self.get_config('timetable') + schedule = self.config.get('timetable') schedule = re.findall("(\d{1,2}):(\d{2})[\s]*(-?\d+)", schedule.lower().replace("full", "-1").replace("none", "0")) @@ -56,7 +56,7 @@ class DownloadScheduler(Addon): def set_download_speed(self, speed): if speed == 0: - abort = self.get_config('abort') + abort = self.config.get('abort') self.log_info(_("Stopping download server. (Running downloads will %sbe aborted.)") % '' if abort else _('not ')) self.pyload.api.pauseServer() if abort: diff --git a/module/plugins/hooks/EventMapper.py b/module/plugins/hooks/EventMapper.py new file mode 100644 index 000000000..ca1be2bdd --- /dev/null +++ b/module/plugins/hooks/EventMapper.py @@ -0,0 +1,80 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.Addon import Addon + + +class EventMapper(Addon): + __name__ = "EventMapper" + __type__ = "hook" + __version__ = "0.01" + __status__ = "testing" + + __config__ = [("activated", "bool", "Activated", True)] + + __description__ = """Map old events to new events""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + def activate(self, *args): + self.manager.dispatchEvent("activate", *args) + + + def exit(self, *args): + self.manager.dispatchEvent("exit", *args) + + + def config_changed(self, *args): + self.manager.dispatchEvent("config_changed", *args) + + + def all_downloads_finished(self, *args): + self.manager.dispatchEvent("all_downloads_finished", *args) + + + def all_downloads_processed(self, *args): + self.manager.dispatchEvent("all_downloads_processed", *args) + + + def links_added(self, *args): + self.manager.dispatchEvent("links_added", *args) + + + def download_preparing(self, *args): + self.manager.dispatchEvent("download_preparing", *args) + + + def download_finished(self, *args): + self.manager.dispatchEvent("download_finished", *args) + + + def download_failed(self, *args): + self.manager.dispatchEvent("download_failed", *args) + + + def package_deleted(self, *args): + self.manager.dispatchEvent("package_deleted", *args) + + + def package_finished(self, *args): + self.manager.dispatchEvent("package_finished", *args) + + + def before_reconnect(self, *args): + self.manager.dispatchEvent("before_reconnect", *args) + + + def after_reconnect(self, *args): + self.manager.dispatchEvent("after_reconnect", *args) + + + def captcha_task(self, *args): + self.manager.dispatchEvent("captcha_task", *args) + + + def captcha_correct(self, *args): + self.manager.dispatchEvent("captcha_correct", *args) + + + def captcha_invalid(self, *args): + self.manager.dispatchEvent("captcha_invalid", *args) diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py index 55c07d4b9..9b29aa8c5 100644 --- a/module/plugins/hooks/ExpertDecoders.py +++ b/module/plugins/hooks/ExpertDecoders.py @@ -2,10 +2,10 @@ from __future__ import with_statement -import pycurl +import base64 import uuid -from base64 import b64encode +import pycurl from module.network.HTTPRequest import BadHeader from module.network.RequestFactory import getRequest as get_request @@ -15,7 +15,7 @@ from module.plugins.internal.Addon import Addon, threaded class ExpertDecoders(Addon): __name__ = "ExpertDecoders" __type__ = "hook" - __version__ = "0.07" + __version__ = "0.08" __status__ = "testing" __config__ = [("activated" , "bool" , "Activated" , False), @@ -32,7 +32,7 @@ class ExpertDecoders(Addon): def get_credits(self): - res = self.load(self.API_URL, post={'key': self.get_config('passkey'), 'action': "balance"}) + res = self.load(self.API_URL, post={'key': self.config.get('passkey'), 'action': "balance"}) if res.isdigit(): self.log_info(_("%s credits left") % res) @@ -58,8 +58,8 @@ class ExpertDecoders(Addon): try: result = self.load(self.API_URL, post={'action' : "upload", - 'key' : self.get_config('passkey'), - 'file' : b64encode(data), + 'key' : self.config.get('passkey'), + 'file' : base64.b64encode(data), 'gen_task_id': ticket}, req=req) finally: @@ -73,10 +73,10 @@ class ExpertDecoders(Addon): if not task.isTextual(): return False - if not self.get_config('passkey'): + if not self.config.get('passkey'): return False - if self.pyload.isClientConnected() and self.get_config('check_client'): + if self.pyload.isClientConnected() and self.config.get('check_client'): return False if self.get_credits() > 0: @@ -93,7 +93,7 @@ class ExpertDecoders(Addon): try: res = self.load(self.API_URL, - post={'action': "refund", 'key': self.get_config('passkey'), 'gen_task_id': task.data['ticket']}) + post={'action': "refund", 'key': self.config.get('passkey'), 'gen_task_id': task.data['ticket']}) self.log_info(_("Request refund"), res) except BadHeader, e: diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py index 99427dfab..3f4fa74db 100644 --- a/module/plugins/hooks/ExternalScripts.py +++ b/module/plugins/hooks/ExternalScripts.py @@ -4,17 +4,17 @@ import os import subprocess from module.plugins.internal.Addon import Addon, Expose -from module.plugins.internal.utils import encode, fs_join +from module.plugins.internal.misc import encode class ExternalScripts(Addon): __name__ = "ExternalScripts" __type__ = "hook" - __version__ = "0.55" + __version__ = "0.60" __status__ = "testing" - __config__ = [("activated", "bool", "Activated" , True ), - ("lock" , "bool", "Wait for script to terminate", False)] + __config__ = [("activated", "bool", "Activated" , True ), + ("unlock" , "bool", "Execute script concurrently", False)] __description__ = """Run external scripts""" __license__ = "GPLv3" @@ -32,8 +32,14 @@ class ExternalScripts(Addon): 'package_extract_failed': "package_extract_failed" , 'package_extracted' : "package_extracted" , 'all_archives_extracted': "all_archives_extracted" , - 'all_archives_processed': "all_archives_processed" } + 'all_archives_processed': "all_archives_processed" , + 'pyload_updated' : "pyload_updated" } + self.periodical.start(60) + self.pyload_start() + + + def make_folders(self): folders = ["pyload_start", "pyload_restart", "pyload_stop", "before_reconnect", "after_reconnect", "download_preparing", "download_failed", "download_finished", @@ -43,176 +49,187 @@ class ExternalScripts(Addon): "all_archives_extracted", "all_archives_processed"] for folder in folders: - path = os.path.join("scripts", folder) - self.init_folder(folder, path) + dir = os.path.join("scripts", folder) - for folder, scripts in self.scripts.items(): - if scripts: - self.log_info(_("Installed scripts in folder `%s`: %s") - % (folder, ", ".join(scripts))) + if os.path.isdir(dir): + continue - self.pyload_start() + try: + os.makedirs(dir) + except OSError, e: + self.log_debug(e, trace=True) - def init_folder(self, name, path): - self.scripts[name] = [] - if not os.path.isdir(path): - try: - os.makedirs(path) + def periodical_task(self): + self.make_folders() - except OSError, e: - self.log_debug(e) - return + folders = [entry for entry in os.listdir("scripts") \ + if os.path.isdir(os.path.join("scripts", entry))] - for filename in os.listdir(path): - file = fs_join(path, filename) - if not os.path.isfile(file): - continue + for folder in folders: + self.scripts[folder] = [] - if file[0] in ("#", "_") or file.endswith("~") or file.endswith(".swp"): - continue + dirname = os.path.join("scripts", folder) + + for entry in os.listdir(dirname): + file = os.path.join(dirname, entry) + + if not os.path.isfile(file): + continue + + if file[0] in ("#", "_") or file.endswith("~") or file.endswith(".swp"): + continue + + if not os.access(file, os.X_OK): + self.log_warning(_("Script `%s` is not executable") % entry) - if not os.access(file, os.X_OK): - self.log_warning(_("Script not executable: [%s] %s") % (name, file)) + self.scripts[folder].append(file) - self.scripts[name].append(file) - self.log_info(_("Registered script: [%s] %s") % (name, file)) + script_names = map(os.path.basename, self.scripts[folder]) + self.log_info(_("Activated %s scripts: %s") + % (folder, ", ".join(script_names) or None)) + + + def call_cmd(self, command, *args, **kwargs): + call = [command] + args + self.log_debug("EXECUTE " + " ".join(call)) + + call = map(encode, call) + p = subprocess.Popen(call, bufsize=-1) #@NOTE: output goes to pyload + + return p @Expose - def call(self, script, args=[], lock=None): - if lock is None: - lock = self.get_config('lock') + def call_script(self, folder, *args, **kwargs): + scripts = self.scripts.get(folder) + + if folder not in scripts: + self.log_debug("Folder `%s` not found" % folder) + return + + scripts = self.scripts.get(folder) + + if not scripts: + self.log_debug("No script found under folder `%s`" % folder) + return + + self.log_info(_("Executing %s scripts...") % folder) - try: - script = os.path.abspath(script) - args = [script] + map(lambda arg: encode(arg) if isinstance(arg, basestring) else encode(str(arg)), args) + for file in scripts: + try: + p = self.call_cmd(file, args) - self.log_info(_("EXECUTE [%s] %s") % (os.path.dirname(script), args)) - p = subprocess.Popen(args, bufsize=-1) #@NOTE: output goes to pyload - if lock: - p.communicate() + except Exception, e: + self.log_error(_("Runtime error: %s") % file, + e or _("Unknown error")) - except Exception, e: - self.log_error(_("Runtime error: %s") % script, - e or _("Unknown error")) + else: + if kwargs.get('lock') or not self.config.get('unlock'): + p.communicate() - def _call(self, folder, args=[], lock=None): - for script in self.scripts[folder]: - self.call(script, args, lock) + def pyload_updated(self, etag): + self.call_script("pyload_updated", etag) def pyload_start(self): - self._call('pyload_start') + self.call_script('pyload_start') def exit(self): - folder = "pyload_restart" if self.pyload.do_restart else "pyload_stop" - self._call(folder, lock=True) + event = "restart" if self.pyload.do_restart else "stop" + self.call_script("pyload_" + event, lock=True) def before_reconnect(self, ip): - args = [ip] - self._call("before_reconnect", args) + self.call_script("before_reconnect", ip) def after_reconnect(self, ip, oldip): - args = [ip, oldip] - self._call("after_reconnect", args) + self.call_script("after_reconnect", ip, oldip) def download_preparing(self, pyfile): args = [pyfile.id, pyfile.name, None, pyfile.pluginname, pyfile.url] - self._call("download_preparing", args) + self.call_script("download_preparing", *args) def download_failed(self, pyfile): - if self.pyload.config.get("general", "folder_per_package"): - dl_folder = fs_join(self.pyload.config.get("general", "download_folder"), pyfile.package().folder) - else: - dl_folder = self.pyload.config.get("general", "download_folder") - - file = fs_join(dl_folder, pyfile.name) + file = pyfile.plugin.last_download args = [pyfile.id, pyfile.name, file, pyfile.pluginname, pyfile.url] - self._call("download_failed", args) + self.call_script("download_failed", *args) def download_finished(self, pyfile): - if self.pyload.config.get("general", "folder_per_package"): - dl_folder = fs_join(self.pyload.config.get("general", "download_folder"), pyfile.package().folder) - else: - dl_folder = self.pyload.config.get("general", "download_folder") - - file = fs_join(dl_folder, pyfile.name) + file = pyfile.plugin.last_download args = [pyfile.id, pyfile.name, file, pyfile.pluginname, pyfile.url] - self._call("download_finished", args) + self.call_script("download_finished", *args) def archive_extract_failed(self, pyfile, archive): args = [pyfile.id, pyfile.name, archive.filename, archive.out, archive.files] - self._call("archive_extract_failed", args) + self.call_script("archive_extract_failed", *args) def archive_extracted(self, pyfile, archive): args = [pyfile.id, pyfile.name, archive.filename, archive.out, archive.files] - self._call("archive_extracted", args) + self.call_script("archive_extracted", *args) def package_finished(self, pypack): + dl_folder = self.pyload.config.get("general", "download_folder") + if self.pyload.config.get("general", "folder_per_package"): - dl_folder = fs_join(self.pyload.config.get("general", "download_folder"), pypack.folder) - else: - dl_folder = self.pyload.config.get("general", "download_folder") + dl_folder = os.path.join(dl_folder, pypack.folder) args = [pypack.id, pypack.name, dl_folder, pypack.password] - self._call("package_finished", args) + self.call_script("package_finished", *args) def package_deleted(self, pid): + dl_folder = self.pyload.config.get("general", "download_folder") pdata = self.pyload.api.getPackageInfo(pid) if self.pyload.config.get("general", "folder_per_package"): - dl_folder = fs_join(self.pyload.config.get("general", "download_folder"), pdata.folder) - else: - dl_folder = self.pyload.config.get("general", "download_folder") + dl_folder = os.path.join(dl_folder, pdata.folder) args = [pdata.pid, pdata.name, dl_folder, pdata.password] - self._call("package_deleted", args) + self.call_script("package_deleted", *args) def package_extract_failed(self, pypack): + dl_folder = self.pyload.config.get("general", "download_folder") + if self.pyload.config.get("general", "folder_per_package"): - dl_folder = fs_join(self.pyload.config.get("general", "download_folder"), pypack.folder) - else: - dl_folder = self.pyload.config.get("general", "download_folder") + dl_folder = os.path.join(dl_folder, pypack.folder) args = [pypack.id, pypack.name, dl_folder, pypack.password] - self._call("package_extract_failed", args) + self.call_script("package_extract_failed", *args) def package_extracted(self, pypack): + dl_folder = self.pyload.config.get("general", "download_folder") + if self.pyload.config.get("general", "folder_per_package"): - dl_folder = fs_join(self.pyload.config.get("general", "download_folder"), pypack.folder) - else: - dl_folder = self.pyload.config.get("general", "download_folder") + dl_folder = os.path.join(dl_folder, pypack.folder) args = [pypack.id, pypack.name, dl_folder] - self._call("package_extracted", args) + self.call_script("package_extracted", *args) def all_downloads_finished(self): - self._call("all_downloads_finished") + self.call_script("all_downloads_finished") def all_downloads_processed(self): - self._call("all_downloads_processed") + self.call_script("all_downloads_processed") def all_archives_extracted(self): - self._call("all_archives_extracted") + self.call_script("all_archives_extracted") def all_archives_processed(self): - self._call("all_archives_processed") + self.call_script("all_archives_processed") diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index c001000c8..a60205f20 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -51,7 +51,7 @@ except ImportError: from module.plugins.internal.Addon import Addon, Expose, threaded from module.plugins.internal.Extractor import ArchiveError, CRCError, PasswordError -from module.plugins.internal.utils import encode, exists, fs_join, replace_patterns, uniqify +from module.plugins.internal.misc import encode, exists, fsjoin, replace_patterns, uniqify class ArchiveQueue(object): @@ -98,8 +98,8 @@ class ArchiveQueue(object): class ExtractArchive(Addon): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.53" - __status__ = "testing" + __version__ = "1.54" + __status__ = "broken" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract with full paths" , True ), @@ -142,14 +142,14 @@ class ExtractArchive(Addon): def activate(self): - for p in ("UnRar", "SevenZip", "UnZip"): + for p in ("UnRar", "SevenZip", "UnZip", "UnTar"): try: module = self.pyload.pluginManager.loadModule("internal", p) klass = getattr(module, p) if klass.find(): self.extractors.append(klass) if klass.REPAIR: - self.repair = self.get_config('repair') + self.repair = self.config.get('repair') except OSError, e: if e.errno == 2: @@ -206,7 +206,7 @@ class ExtractArchive(Addon): """ for id in ids: self.queue.add(id) - if not self.get_config('waitall') and not self.extracting: + if not self.config.get('waitall') and not self.extracting: self.extract_queued() @@ -216,13 +216,13 @@ class ExtractArchive(Addon): def package_finished(self, pypack): self.queue.add(pypack.id) - if not self.get_config('waitall') and not self.extracting: + if not self.config.get('waitall') and not self.extracting: self.extract_queued() def all_downloads_processed(self): self.last_package = True - if self.get_config('waitall') and not self.extracting: + if self.config.get('waitall') and not self.extracting: self.extract_queued() @@ -237,16 +237,16 @@ class ExtractArchive(Addon): toList = lambda string: string.replace(' ', '').replace(',', '|').replace(';', '|').split('|') - destination = self.get_config('destination') - subfolder = self.get_config('subfolder') - fullpath = self.get_config('fullpath') - overwrite = self.get_config('overwrite') - priority = self.get_config('priority') - recursive = self.get_config('recursive') - keepbroken = self.get_config('keepbroken') + destination = self.config.get('destination') + subfolder = self.config.get('subfolder') + fullpath = self.config.get('fullpath') + overwrite = self.config.get('overwrite') + priority = self.config.get('priority') + recursive = self.config.get('recursive') + keepbroken = self.config.get('keepbroken') - extensions = [x.lstrip('.').lower() for x in toList(self.get_config('extensions'))] - excludefiles = toList(self.get_config('excludefiles')) + extensions = [x.lstrip('.').lower() for x in toList(self.config.get('extensions'))] + excludefiles = toList(self.config.get('excludefiles')) if extensions: self.log_debug("Use for extensions: %s" % "|.".join(extensions)) @@ -267,18 +267,18 @@ class ExtractArchive(Addon): self.log_info(_("Check package: %s") % pypack.name) #: Determine output folder - out = fs_join(dl_folder, pypack.folder, destination, "") #: Force trailing slash + out = fsjoin(dl_folder, pypack.folder, destination, "") #: Force trailing slash if subfolder: - out = fs_join(out, pypack.folder) + out = fsjoin(out, pypack.folder) if not exists(out): os.makedirs(out) matched = False success = True - files_ids = dict((pylink['name'], ((fs_join(dl_folder, pypack.folder, pylink['name'])), pylink['id'], out)) for pylink \ - in sorted(pypack.getChildren().values(), key=lambda k: k['name'])).values() #: Remove duplicates + files_ids = dict((fdata['name'], ((fsjoin(dl_folder, pypack.folder, fdata['name'])), fid, out)) for fid, fdata \ + in sorted(pypack.getChildren().values(), key=lambda k: k['name'])).items() #: Remove duplicates #: Check as long there are unseen files while files_ids: @@ -338,7 +338,7 @@ class ExtractArchive(Addon): self.set_permissions(file) for filename in new_files: - file = encode(fs_join(os.path.dirname(archive.filename), filename)) + file = encode(fsjoin(os.path.dirname(archive.filename), filename)) if not exists(file): self.log_debug("New file %s does not exists" % filename) continue @@ -383,7 +383,7 @@ class ExtractArchive(Addon): encrypted = False try: self.log_debug("Password: %s" % (password or "None provided")) - passwords = uniqify([password] + self.get_passwords(False)) if self.get_config('usepasswordfile') else [password] + passwords = uniqify([password] + self.get_passwords(False)) if self.config.get('usepasswordfile') else [password] for pw in passwords: try: pyfile.setCustomStatus(_("archive testing")) @@ -410,7 +410,7 @@ class ExtractArchive(Addon): repaired = archive.repair() pyfile.setProgress(100) - if not repaired and not self.get_config('keepbroken'): + if not repaired and not self.config.get('keepbroken'): raise CRCError("Archive damaged") else: @@ -427,7 +427,7 @@ class ExtractArchive(Addon): pyfile.setCustomStatus(_("archive extracting")) pyfile.setProgress(0) - if not encrypted or not self.get_config('usepasswordfile'): + if not encrypted or not self.config.get('usepasswordfile'): self.log_debug("Extracting using password: %s" % (password or "None")) archive.extract(password) else: @@ -450,10 +450,10 @@ class ExtractArchive(Addon): delfiles = archive.items() self.log_debug("Would delete: " + ", ".join(delfiles)) - if self.get_config('delete'): + if self.config.get('delete'): self.log_info(_("Deleting %s files") % len(delfiles)) - deltotrash = self.get_config('deltotrash') + deltotrash = self.config.get('deltotrash') for f in delfiles: file = encode(f) if not exists(file): @@ -523,7 +523,7 @@ class ExtractArchive(Addon): try: passwords = [] - file = encode(self.get_config('passwordfile')) + file = encode(self.config.get('passwordfile')) with open(file) as f: for pw in f.read().splitlines(): passwords.append(pw) @@ -552,7 +552,7 @@ class ExtractArchive(Addon): try: self.passwords = uniqify([password] + self.passwords) - file = encode(self.get_config('passwordfile')) + file = encode(self.config.get('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 c89083fb1..26217c0f8 100644 --- a/module/plugins/hooks/HotFolder.py +++ b/module/plugins/hooks/HotFolder.py @@ -3,17 +3,16 @@ from __future__ import with_statement import os -import shutil import time from module.plugins.internal.Addon import Addon -from module.plugins.internal.utils import encode, fs_join +from module.plugins.internal.misc import encode, fsjoin, move_tree class HotFolder(Addon): __name__ = "HotFolder" __type__ = "hook" - __version__ = "0.20" + __version__ = "0.21" __status__ = "testing" __config__ = [("activated", "bool", "Activated" , False ), @@ -28,18 +27,18 @@ class HotFolder(Addon): def activate(self): - self.start_periodical(30, threaded=True) + self.periodical.start(30, threaded=True) - def periodical(self): - folder = encode(self.get_config('folder')) - file = encode(self.get_config('file')) + def periodical_task(self): + folder = encode(self.config.get('folder')) + file = encode(self.config.get('file')) try: if not os.path.isdir(os.path.join(folder, "finished")): os.makedirs(os.path.join(folder, "finished")) - if self.get_config('watchfile'): + if self.config.get('watchfile'): with open(file, "a+") as f: f.seek(0) content = f.read().strip() @@ -50,7 +49,7 @@ class HotFolder(Addon): name = "%s_%s.txt" % (file, time.strftime("%H-%M-%S_%d%b%Y")) - with open(fs_join(folder, "finished", name), "wb") as f: + with open(fsjoin(folder, "finished", name), "wb") as f: f.write(content) self.pyload.api.addPackage(f.name, [f.name], 1) @@ -61,8 +60,8 @@ class HotFolder(Addon): if not os.path.isfile(path) or f.endswith("~") or f.startswith("#") or f.startswith("."): continue - newpath = os.path.join(folder, "finished", "tmp_" + f if self.get_config('delete') else f) - shutil.move(path, newpath) + newpath = os.path.join(folder, "finished", "tmp_" + f if self.config.get('delete') else f) + move_tree(path, newpath) self.log_info(_("Added %s from HotFolder") % f) self.pyload.api.addPackage(f, [newpath], 1) diff --git a/module/plugins/hooks/IRCInterface.py b/module/plugins/hooks/IRC.py index 1f337d686..7dec4b798 100644 --- a/module/plugins/hooks/IRCInterface.py +++ b/module/plugins/hooks/IRC.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- -import pycurl import re import select import socket @@ -8,17 +7,19 @@ import ssl import time import traceback +import pycurl + from threading import Thread from module.Api import PackageDoesNotExists, FileDoesNotExists -from module.plugins.internal.Addon import Addon -from module.utils import formatSize +from module.plugins.internal.Notifier import Notifier +from module.internal.misc import formatSize -class IRCInterface(Thread, Addon): - __name__ = "IRCInterface" +class IRC(Thread, Notifier): + __name__ = "IRC" __type__ = "hook" - __version__ = "0.18" + __version__ = "0.19" __status__ = "testing" __config__ = [("activated", "bool", "Activated" , False ), @@ -54,7 +55,7 @@ class IRCInterface(Thread, Addon): def package_finished(self, pypack): try: - if self.get_config('info_pack'): + if self.config.get('info_pack'): self.response(_("Package finished: %s") % pypack.name) except Exception: @@ -63,7 +64,7 @@ class IRCInterface(Thread, Addon): def download_finished(self, pyfile): try: - if self.get_config('info_file'): + if self.config.get('info_file'): self.response( _("Download finished: %(name)s @ %(plugin)s ") % {'name': pyfile.name, 'plugin': pyfile.pluginname}) @@ -72,7 +73,7 @@ class IRCInterface(Thread, Addon): def captcha_task(self, task): - if self.get_config('captcha') and task.isTextual(): + if self.config.get('captcha') and task.isTextual(): task.handler.append(self) task.setWaiting(60) @@ -87,16 +88,16 @@ class IRCInterface(Thread, Addon): def run(self): #: Connect to IRC etc. self.sock = socket.socket() - host = self.get_config('host') - self.sock.connect((host, self.get_config('port'))) + host = self.config.get('host') + self.sock.connect((host, self.config.get('port'))) - if self.get_config('ssl'): + if self.config.get('ssl'): self.sock = ssl.wrap_socket(self.sock, cert_reqs=ssl.CERT_NONE) #@TODO: support certificate - nick = self.get_config('nick') + nick = self.config.get('nick') self.sock.send("NICK %s\r\n" % nick) self.sock.send("USER %s %s bla :%s\r\n" % (nick, host, nick)) - for t in self.get_config('owner').split(): + for t in self.config.get('owner').split(): if t.strip().startswith("#"): self.sock.send("JOIN %s\r\n" % t.strip()) self.log_info(_("Connected to"), host) @@ -151,10 +152,10 @@ class IRCInterface(Thread, Addon): def handle_events(self, msg): - if not msg['origin'].split("!", 1)[0] in self.get_config('owner').split(): + if not msg['origin'].split("!", 1)[0] in self.config.get('owner').split(): return - if msg['target'].split("!", 1)[0] is not self.get_config('nick'): + if msg['target'].split("!", 1)[0] is not self.config.get('nick'): return if msg['action'] != "PRIVMSG": @@ -197,7 +198,7 @@ class IRCInterface(Thread, Addon): def response(self, msg, origin=""): if origin == "": - for t in self.get_config('owner').split(): + for t in self.config.get('owner').split(): self.sock.send("PRIVMSG %s :%s\r\n" % (t.strip(), msg)) else: self.sock.send("PRIVMSG %s :%s\r\n" % (origin.split("!", 1)[0], msg)) @@ -218,7 +219,7 @@ class IRCInterface(Thread, Addon): lines = ["ID - Name - Status - Speed - ETA - Progress"] for data in downloads: - if data.status == 5: + if data.status is 5: temp_progress = data.format_wait else: temp_progress = "%d%% (%s)" % (data.percent, data.format_size) @@ -236,25 +237,25 @@ class IRCInterface(Thread, Addon): def event_queue(self, args): - ps = self.pyload.api.getQueueData() + pdata = self.pyload.api.getQueueData() - if not ps: + if not pdata: return ["INFO: There are no packages in queue."] lines = [] - for pack in ps: + for pack in pdata: lines.append('PACKAGE #%s: "%s" with %d links.' % (pack.pid, pack.name, len(pack.links))) return lines def event_collector(self, args): - ps = self.pyload.api.getCollectorData() - if not ps: + pdata = self.pyload.api.getCollectorData() + if not pdata: return ["INFO: No packages in collector!"] lines = [] - for pack in ps: + for pack in pdata: lines.append('PACKAGE #%s: "%s" with %d links.' % (pack.pid, pack.name, len(pack.links))) return lines diff --git a/module/plugins/hooks/ImageTyperz.py b/module/plugins/hooks/ImageTyperz.py index 656ad0c25..5afeb4a78 100644 --- a/module/plugins/hooks/ImageTyperz.py +++ b/module/plugins/hooks/ImageTyperz.py @@ -2,10 +2,10 @@ from __future__ import with_statement -import pycurl +import base64 import re -from base64 import b64encode +import pycurl from module.network.RequestFactory import getRequest as get_request from module.plugins.internal.Addon import Addon, threaded @@ -32,7 +32,7 @@ class ImageTyperzException(Exception): class ImageTyperz(Addon): __name__ = "ImageTyperz" __type__ = "hook" - __version__ = "0.09" + __version__ = "0.10" __status__ = "testing" __config__ = [("activated" , "bool" , "Activated" , False), @@ -54,8 +54,8 @@ class ImageTyperz(Addon): def get_credits(self): res = self.load(self.GETCREDITS_URL, post={'action': "REQUESTBALANCE", - 'username': self.get_config('username'), - 'password': self.get_config('password')}) + 'username': self.config.get('username'), + 'password': self.config.get('password')}) if res.startswith('ERROR'): raise ImageTyperzException(res) @@ -77,19 +77,19 @@ class ImageTyperz(Addon): try: #@NOTE: Workaround multipart-post bug in HTTPRequest.py - if re.match("^\w*$", self.get_config('password')): + if re.match("^\w*$", self.config.get('password')): multipart = True data = (pycurl.FORM_FILE, captcha) else: multipart = False with open(captcha, 'rb') as f: data = f.read() - data = b64encode(data) + data = base64.b64encode(data) res = self.load(self.SUBMIT_URL, post={'action': "UPLOADCAPTCHA", - 'username': self.get_config('username'), - 'password': self.get_config('password'), 'file': data}, + 'username': self.config.get('username'), + 'password': self.config.get('password'), 'file': data}, multipart=multipart, req=req) finally: @@ -99,7 +99,7 @@ class ImageTyperz(Addon): raise ImageTyperzException(res) else: data = res.split('|') - if len(data) == 2: + if len(data) is 2: ticket, result = data else: raise ImageTyperzException("Unknown response: %s" % res) @@ -114,10 +114,10 @@ class ImageTyperz(Addon): if not task.isTextual(): return False - if not self.get_config('username') or not self.get_config('password'): + if not self.config.get('username') or not self.config.get('password'): return False - if self.pyload.isClientConnected() and self.get_config('check_client'): + if self.pyload.isClientConnected() and self.config.get('check_client'): return False if self.get_credits() > 0: @@ -134,8 +134,8 @@ class ImageTyperz(Addon): if task.data['service'] is self.classname and "ticket" in task.data: res = self.load(self.RESPOND_URL, post={'action': "SETBADIMAGE", - 'username': self.get_config('username'), - 'password': self.get_config('password'), + 'username': self.config.get('username'), + 'password': self.config.get('password'), 'imageid': task.data['ticket']}) if res == "SUCCESS": diff --git a/module/plugins/hooks/JustPremium.py b/module/plugins/hooks/JustPremium.py index 3f7388020..2492498cb 100644 --- a/module/plugins/hooks/JustPremium.py +++ b/module/plugins/hooks/JustPremium.py @@ -8,7 +8,7 @@ from module.plugins.internal.Addon import Addon class JustPremium(Addon): __name__ = "JustPremium" __type__ = "hook" - __version__ = "0.25" + __version__ = "0.26" __status__ = "testing" __config__ = [("activated", "bool", "Activated" , False), @@ -37,9 +37,9 @@ class JustPremium(Addon): and hosterdict[hoster]['new_name'] in premiumplugins) excluded = map(lambda domain: "".join(part.capitalize() for part in re.split(r'(\.|\d+)', domain) if part != '.'), - self.get_config('excluded').replace(' ', '').replace(',', '|').replace(';', '|').split('|')) + self.config.get('excluded').replace(' ', '').replace(',', '|').replace(';', '|').split('|')) included = map(lambda domain: "".join(part.capitalize() for part in re.split(r'(\.|\d+)', domain) if part != '.'), - self.get_config('included').replace(' ', '').replace(',', '|').replace(';', '|').split('|')) + self.config.get('included').replace(' ', '').replace(',', '|').replace(';', '|').split('|')) hosterlist = (premiumplugins | multihosters).union(excluded).difference(included) diff --git a/module/plugins/hooks/LogMarker.py b/module/plugins/hooks/LogMarker.py index 829db4d41..80f7b17fb 100644 --- a/module/plugins/hooks/LogMarker.py +++ b/module/plugins/hooks/LogMarker.py @@ -3,13 +3,13 @@ import datetime from module.plugins.internal.Addon import Addon, Expose -from module.plugins.internal.utils import seconds_to_nexthour +from module.plugins.internal.misc import seconds_to_nexthour class LogMarker(Addon): __name__ = "LogMarker" __type__ = "hook" - __version__ = "0.04" + __version__ = "0.05" __status__ = "testing" __config__ = [("activated", "bool", "Activated" , False), @@ -22,16 +22,16 @@ class LogMarker(Addon): def activated(self): - self.start_periodical(1 * 60 * 60 - 1, delay=seconds_to_nexthour(strict=True) - 1) + self.periodical.start(1 * 60 * 60 - 1, delay=seconds_to_nexthour(strict=True) - 1) - def periodical(self): - if self.get_config('mark_day') and datetime.datetime.today().hour is 0: + def periodical_task(self): + if self.config.get('mark_day') and datetime.datetime.today().hour is 0: self.log_info("------------------------------------------------") self.log_info(_("------------------- DAY MARK -------------------")) self.log_info("------------------------------------------------") - elif self.get_config('mark_hour'): + elif self.config.get('mark_hour'): self.log_info("------------------------------------------------") self.log_info(_("------------------- HOUR MARK ------------------")) self.log_info("------------------------------------------------") diff --git a/module/plugins/hooks/MergeFiles.py b/module/plugins/hooks/MergeFiles.py index dbe7b1f5f..963f8c15b 100644 --- a/module/plugins/hooks/MergeFiles.py +++ b/module/plugins/hooks/MergeFiles.py @@ -6,13 +6,13 @@ import os import re from module.plugins.internal.Addon import Addon, threaded -from module.plugins.internal.utils import fs_join +from module.plugins.internal.misc import fsjoin class MergeFiles(Addon): __name__ = "MergeFiles" __type__ = "hook" - __version__ = "0.18" + __version__ = "0.19" __status__ = "testing" __config__ = [("activated", "bool", "Activated", True)] @@ -40,12 +40,12 @@ class MergeFiles(Addon): dl_folder = self.pyload.config.get("general", "download_folder") if self.pyload.config.get("general", "folder_per_package"): - dl_folder = fs_join(dl_folder, pack.folder) + dl_folder = fsjoin(dl_folder, pack.folder) for name, file_list in files.items(): self.log_info(_("Starting merging of"), name) - with open(fs_join(dl_folder, name), "wb") as final_file: + with open(fsjoin(dl_folder, name), "wb") as final_file: for splitted_file in file_list: self.log_debug("Merging part", splitted_file) @@ -54,7 +54,7 @@ class MergeFiles(Addon): pyfile.setStatus("processing") try: - with open(fs_join(dl_folder, splitted_file), "rb") as s_file: + with open(fsjoin(dl_folder, splitted_file), "rb") as s_file: size_written = 0 s_file_size = int(os.path.getsize(os.path.join(dl_folder, splitted_file))) while True: diff --git a/module/plugins/hooks/MultiHome.py b/module/plugins/hooks/MultiHome.py index 353753c1a..c8c5f4fa7 100644 --- a/module/plugins/hooks/MultiHome.py +++ b/module/plugins/hooks/MultiHome.py @@ -44,7 +44,7 @@ class Interface(object): class MultiHome(Addon): __name__ = "MultiHome" __type__ = "hook" - __version__ = "0.15" + __version__ = "0.16" __status__ = "testing" __config__ = [("activated" , "bool", "Activated" , False ), @@ -59,11 +59,11 @@ class MultiHome(Addon): self.register = {} self.interfaces = [] - self.parse_interfaces(self.get_config('interfaces').split(";")) + self.parse_interfaces(self.config.get('interfaces').split(";")) if not self.interfaces: self.parse_interfaces([self.pyload.config.get("download", "interface")]) - self.set_config("interfaces", self.to_config()) + self.config.set("interfaces", self.to_config()) def to_config(self): diff --git a/module/plugins/hooks/PushBullet.py b/module/plugins/hooks/PushBullet.py index 6cf7dc173..47a0f594e 100644 --- a/module/plugins/hooks/PushBullet.py +++ b/module/plugins/hooks/PushBullet.py @@ -9,19 +9,22 @@ from module.plugins.internal.Notifier import Notifier class PushBullet(Notifier): __name__ = "PushBullet" __type__ = "hook" - __version__ = "0.02" + __version__ = "0.04" __status__ = "testing" - __config__ = [("activated" , "bool", "Activated" , False), - ("tokenkey" , "str" , "Access Token" , "" ), - ("notifycaptcha" , "bool", "Notify captcha request" , True ), - ("notifypackage" , "bool", "Notify package finished" , True ), - ("notifyprocessed", "bool", "Notify packages processed" , True ), - ("notifyupdate" , "bool", "Notify plugin updates" , True ), - ("notifyexit" , "bool", "Notify pyLoad shutdown" , True ), - ("sendtimewait" , "int" , "Timewait in seconds between notifications", 5 ), - ("sendpermin" , "int" , "Max notifications per minute" , 12 ), - ("ignoreclient" , "bool", "Send notifications if client is connected", False)] + __config__ = [("activated" , "bool", "Activated" , False), + ("tokenkey" , "str" , "Access Token" , "" ), + ("captcha" , "bool", "Notify captcha request" , True ), + ("reconnection" , "bool", "Notify reconnection request" , False), + ("downloadfinished", "bool", "Notify download finished" , True ), + ("downloadfailed" , "bool", "Notify download failed" , True ), + ("packagefinished" , "bool", "Notify package finished" , True ), + ("packagefailed" , "bool", "Notify package failed" , True ), + ("update" , "bool", "Notify pyLoad update" , False), + ("exit" , "bool", "Notify pyLoad shutdown/restart" , False), + ("sendinterval" , "int" , "Interval in seconds between notifications", 1 ), + ("sendpermin" , "int" , "Max notifications per minute" , 60 ), + ("ignoreclient" , "bool", "Send notifications if client is connected", True )] __description__ = """Send push notifications to your phone using pushbullet.com""" __license__ = "GPLv3" @@ -29,7 +32,7 @@ class PushBullet(Notifier): def get_key(self): - return self.get_config('tokenkey') + return self.config.get('tokenkey') def send(self, event, msg, key): diff --git a/module/plugins/hooks/PushOver.py b/module/plugins/hooks/PushOver.py index 5d5e927ac..418f7a133 100644 --- a/module/plugins/hooks/PushOver.py +++ b/module/plugins/hooks/PushOver.py @@ -8,20 +8,23 @@ from module.plugins.internal.Notifier import Notifier class PushOver(Notifier): __name__ = "PushOver" __type__ = "hook" - __version__ = "0.04" + __version__ = "0.06" __status__ = "testing" - __config__ = [("activated" , "bool", "Activated" , False), - ("tokenkey" , "str" , "Token key" , "" ), - ("userkey" , "str" , "User key" , "" ), - ("notifycaptcha" , "bool", "Notify captcha request" , True ), - ("notifypackage" , "bool", "Notify package finished" , True ), - ("notifyprocessed", "bool", "Notify packages processed" , True ), - ("notifyupdate" , "bool", "Notify plugin updates" , True ), - ("notifyexit" , "bool", "Notify pyLoad shutdown" , True ), - ("sendtimewait" , "int" , "Timewait in seconds between notifications", 5 ), - ("sendpermin" , "int" , "Max notifications per minute" , 12 ), - ("ignoreclient" , "bool", "Send notifications if client is connected", False)] + __config__ = [("activated" , "bool", "Activated" , False), + ("tokenkey" , "str" , "Token key" , "" ), + ("userkey" , "str" , "User key" , "" ), + ("captcha" , "bool", "Notify captcha request" , True ), + ("reconnection" , "bool", "Notify reconnection request" , False), + ("downloadfinished", "bool", "Notify download finished" , True ), + ("downloadfailed" , "bool", "Notify download failed" , True ), + ("packagefinished" , "bool", "Notify package finished" , True ), + ("packagefailed" , "bool", "Notify package failed" , True ), + ("update" , "bool", "Notify pyLoad update" , False), + ("exit" , "bool", "Notify pyLoad shutdown/restart" , False), + ("sendinterval" , "int" , "Interval in seconds between notifications", 1 ), + ("sendpermin" , "int" , "Max notifications per minute" , 60 ), + ("ignoreclient" , "bool", "Send notifications if client is connected", True )] __description__ = """Send push notifications to your phone using pushover.net""" __license__ = "GPLv3" @@ -29,7 +32,7 @@ class PushOver(Notifier): def get_key(self): - return self.get_config('tokenkey'), self.get_config('userkey') + return self.config.get('tokenkey'), self.config.get('userkey') def send(self, event, msg, key): diff --git a/module/plugins/hooks/RestartFailed.py b/module/plugins/hooks/RestartFailed.py index 0e35c4629..62298ea14 100644 --- a/module/plugins/hooks/RestartFailed.py +++ b/module/plugins/hooks/RestartFailed.py @@ -6,7 +6,7 @@ from module.plugins.internal.Addon import Addon class RestartFailed(Addon): __name__ = "RestartFailed" __type__ = "hook" - __version__ = "1.63" + __version__ = "1.64" __status__ = "testing" __config__ = [("activated", "bool", "Activated" , False), @@ -17,13 +17,10 @@ class RestartFailed(Addon): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - PERIODICAL_INTERVAL = 15 * 60 #: 15 minutes - - - def periodical(self): + def periodical_task(self): self.log_info(_("Restarting all failed downloads...")) self.pyload.api.restartFailed() def activate(self): - self.set_interval(self.get_config('interval') * 60) + self.periodical.start(self.config.get('interval') * 60) diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index 6ce1750d3..429737e94 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -1,9 +1,6 @@ # -*- coding: utf-8 -*- import re -import urllib - -from types import MethodType from module.PyFile import PyFile from module.plugins.internal.Addon import Addon @@ -12,7 +9,7 @@ from module.plugins.internal.Addon import Addon class SkipRev(Addon): __name__ = "SkipRev" __type__ = "hook" - __version__ = "0.35" + __version__ = "0.36" __status__ = "testing" __config__ = [("activated", "bool" , "Activated" , False ), @@ -28,17 +25,18 @@ class SkipRev(Addon): return pyfile.pluginclass.get_info(pyfile.url)['name'] - def _pyfile(self, link): + def _create_pyFile(self, data): + pylink = self.pyload.api._convertPyFile(data) return PyFile(self.pyload.files, - link.fid, - link.url, - link.name, - link.size, - link.status, - link.error, - link.plugin, - link.packageID, - link.order) + pylink.fid, + pylink.url, + pylink.name, + pylink.size, + pylink.status, + pylink.error, + pylink.plugin, + pylink.packageID, + pylink.order) def download_preparing(self, pyfile): @@ -47,14 +45,14 @@ class SkipRev(Addon): if pyfile.statusname is _("unskipped") or not name.endswith(".rev") or not ".part" in name: return - revtokeep = -1 if self.get_config('mode') == "Auto" else self.get_config('revtokeep') + revtokeep = -1 if self.config.get('mode') == "Auto" else self.config.get('revtokeep') if revtokeep: status_list = (1, 4, 8, 9, 14) if revtokeep < 0 else (1, 3, 4, 8, 9, 14) pyname = re.compile(r'%s\.part\d+\.rev$' % name.rsplit('.', 2)[0].replace('.', '\.')) - queued = [True for link in self.pyload.api.getPackageData(pyfile.package().id).links \ - if link.status not in status_list and pyname.match(link.name)].count(True) + queued = [True for fid, fdata in pyfile.package().getChildren().items() \ + if fdata['status'] not in status_list and pyname.match(fdata['name'])].count(True) if not queued or queued < revtokeep: #: Keep one rev at least in auto mode return @@ -63,26 +61,25 @@ class SkipRev(Addon): def download_failed(self, pyfile): - #: Check if pyfile is still "failed", maybe might has been restarted in meantime - if pyfile.status != 8 or pyfile.name.rsplit('.', 1)[-1].strip() not in ("rar", "rev"): + if pyfile.name.rsplit('.', 1)[-1].strip() not in ("rar", "rev"): return - revtokeep = -1 if self.get_config('mode') == "Auto" else self.get_config('revtokeep') + revtokeep = -1 if self.config.get('mode') == "Auto" else self.config.get('revtokeep') if not revtokeep: return pyname = re.compile(r'%s\.part\d+\.rev$' % pyfile.name.rsplit('.', 2)[0].replace('.', '\.')) - for link in self.pyload.api.getPackageData(pyfile.package().id).links: - if link.status is 4 and pyname.match(link.name): - pylink = self._pyfile(link) + for fid, fdata in pyfile.package().getChildren().items(): + if fdata['status'] is 4 and pyname.match(fdata['name']): + pyfile_new = self._create_pyFile(fdata) if revtokeep > -1 or pyfile.name.endswith(".rev"): - pylink.setStatus("queued") + pyfile_new.setStatus("queued") else: - pylink.setCustomStatus(_("unskipped"), "queued") + pyfile_new.setCustomStatus(_("unskipped"), "queued") self.pyload.files.save() - pylink.release() + pyfile_new.release() return diff --git a/module/plugins/hooks/TransmissionRPC.py b/module/plugins/hooks/TransmissionRPC.py index 7914d5c44..f0ef2e9b1 100644 --- a/module/plugins/hooks/TransmissionRPC.py +++ b/module/plugins/hooks/TransmissionRPC.py @@ -5,19 +5,19 @@ import re import pycurl -from module.plugins.internal.utils import json from module.network.HTTPRequest import BadHeader from module.network.RequestFactory import getRequest as get_request from module.plugins.internal.Addon import Addon +from module.plugins.internal.misc import json class TransmissionRPC(Addon): __name__ = "TransmissionRPC" __type__ = "hook" - __version__ = "0.16" + __version__ = "0.17" __status__ = "testing" - __pattern__ = r"https?://.+\.torrent|magnet:\?.+" + __pattern__ = r'https?://.+\.torrent|magnet:\?.+' __config__ = [("activated", "bool", "Activated" , False ), ("rpc_url" , "str" , "Transmission RPC URL", "http://127.0.0.1:9091/transmission/rpc")] @@ -41,7 +41,7 @@ class TransmissionRPC(Addon): def send_to_transmission(self, url): - transmission_rpc_url = self.get_config('rpc_url') + transmission_rpc_url = self.config.get('rpc_url') client_request_id = self.classname + "".join(random.choice('0123456789ABCDEF') for _i in xrange(4)) req = get_request() @@ -53,7 +53,7 @@ class TransmissionRPC(Addon): req=req) except Exception, e: - if isinstance(e, BadHeader) and e.code == 409: + if isinstance(e, BadHeader) and e.code is 409: headers = dict(re.findall(r"(?P<name>.+?): (?P<value>.+?)\r?\n", req.header)) session_id = headers['X-Transmission-Session-Id'] req.c.setopt(pycurl.HTTPHEADER, ["X-Transmission-Session-Id: %s" % session_id]) diff --git a/module/plugins/hooks/UnSkipOnFail.py b/module/plugins/hooks/UnSkipOnFail.py index 6842cbc51..db43bca2b 100644 --- a/module/plugins/hooks/UnSkipOnFail.py +++ b/module/plugins/hooks/UnSkipOnFail.py @@ -7,7 +7,7 @@ from module.plugins.internal.Addon import Addon class UnSkipOnFail(Addon): __name__ = "UnSkipOnFail" __type__ = "hook" - __version__ = "0.10" + __version__ = "0.11" __status__ = "testing" __config__ = [("activated", "bool", "Activated", True)] @@ -18,10 +18,6 @@ class UnSkipOnFail(Addon): def download_failed(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.log_info(msg % (pyfile.name, pyfile.package().id)) @@ -36,12 +32,12 @@ class UnSkipOnFail(Addon): #: It creates a temporary PyFile object using #: "link" data, changes its status, and tells #: The pyload.files-manager to save its data. - pylink = self._pyfile(link) + pyfile_new = self._create_pyFile(link) - pylink.setCustomStatus(_("unskipped"), "queued") + pyfile_new.setCustomStatus(_("unskipped"), "queued") self.pyload.files.save() - pylink.release() + pyfile_new.release() else: self.log_info(_("No duplicates found")) @@ -57,18 +53,16 @@ class UnSkipOnFail(Addon): the data for "pyfile" iotselöf. It does MOT check the link's status. """ - queue = self.pyload.api.getQueue() #: Get packages (w/o files, as most file data is useless here) - - for package in queue: + for pinfo in self.pyload.api.getQueue(): #: Check if package-folder equals pyfile's package folder - if package.folder is not pyfile.package().folder: + if pinfo.folder is not pyfile.package().folder: continue #: Now get packaged data w/ files/links - pdata = self.pyload.api.getPackageData(package.pid) + pdata = self.pyload.api.getPackageData(pinfo.pid) for link in pdata.links: #: Check if link == "skipped" - if link.status != 4: + if link.status is not 4: continue #: Check if link name collides with pdata's name @@ -77,14 +71,14 @@ class UnSkipOnFail(Addon): return link - def _pyfile(self, link): + def _create_pyFile(self, pylink): return PyFile(self.pyload.files, - link.fid, - link.url, - link.name, - link.size, - link.status, - link.error, - link.plugin, - link.packageID, - link.order) + pylink.fid, + pylink.url, + pylink.name, + pylink.size, + pylink.status, + pylink.error, + pylink.plugin, + pylink.packageID, + pylink.order) diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py index e235b0e47..cf36a6d40 100644 --- a/module/plugins/hooks/UpdateManager.py +++ b/module/plugins/hooks/UpdateManager.py @@ -9,13 +9,13 @@ import sys import time from module.plugins.internal.Addon import Expose, Addon, threaded -from module.plugins.internal.utils import encode, exists, fs_join +from module.plugins.internal.misc import encode, exists, fsjoin class UpdateManager(Addon): __name__ = "UpdateManager" __type__ = "hook" - __version__ = "1.04" + __version__ = "1.05" __status__ = "testing" __config__ = [("activated" , "bool", "Activated" , True ), @@ -45,7 +45,7 @@ class UpdateManager(Addon): if self.do_restart is False: self.pyload.api.unpauseServer() - self.start_periodical(10) + self.periodical.start(10) def init(self): @@ -53,7 +53,7 @@ class UpdateManager(Addon): self.mtimes = {} #: Store modification time for each plugin self.event_map = {'allDownloadsProcessed': "all_downloads_processed"} - if self.get_config('checkonstart'): + if self.config.get('checkonstart'): self.pyload.api.pauseServer() self.checkonstart = True else: @@ -67,16 +67,16 @@ class UpdateManager(Addon): self.pyload.api.restart() - def periodical(self): + def periodical_task(self): if self.pyload.debug: - if self.get_config('reloadplugins'): + if self.config.get('reloadplugins'): self.autoreload_plugins() - if self.get_config('nodebugupdate'): + if self.config.get('nodebugupdate'): return - if self.get_config('checkperiod') and \ - time.time() - max(self.CHECK_INTERVAL, self.get_config('checkinterval') * 60 * 60) > self.info['last_check']: + if self.config.get('checkperiod') and \ + time.time() - max(self.CHECK_INTERVAL, self.config.get('checkinterval') * 60 * 60) > self.info['last_check']: self.update() @@ -146,7 +146,7 @@ class UpdateManager(Addon): """ Check for updates """ - if self._update() is not 2 or not self.get_config('autorestart'): + if self._update() is not 2 or not self.config.get('autorestart'): return if not self.pyload.api.statusDownloads(): @@ -304,7 +304,7 @@ class UpdateManager(Addon): m = self._VERSION.search(content) if m and m.group(2) == plugin_version: - with open(fs_join("userplugins", plugin_type, plugin_name + ".py"), "wb") as f: + with open(fsjoin("userplugins", plugin_type, plugin_name + ".py"), "wb") as f: f.write(encode(content)) updated.append((plugin_type, plugin_name)) @@ -342,7 +342,7 @@ class UpdateManager(Addon): rootplugins = os.path.join(pypath, "module", "plugins") for basedir in ("userplugins", rootplugins): - py_filename = fs_join(basedir, plugin_type, plugin_name + ".py") + py_filename = fsjoin(basedir, plugin_type, plugin_name + ".py") pyc_filename = py_filename + "c" if plugin_type is "hook": diff --git a/module/plugins/hooks/UserAgentSwitcher.py b/module/plugins/hooks/UserAgentSwitcher.py index 402dd001d..4b0b13c93 100644 --- a/module/plugins/hooks/UserAgentSwitcher.py +++ b/module/plugins/hooks/UserAgentSwitcher.py @@ -3,13 +3,13 @@ import pycurl from module.plugins.internal.Addon import Addon -from module.plugins.internal.utils import encode +from module.plugins.internal.misc import encode class UserAgentSwitcher(Addon): __name__ = "UserAgentSwitcher" __type__ = "hook" - __version__ = "0.12" + __version__ = "0.13" __status__ = "testing" __config__ = [("activated" , "bool", "Activated" , True ), @@ -23,9 +23,9 @@ class UserAgentSwitcher(Addon): def download_preparing(self, pyfile): - connecttimeout = self.get_config('connecttimeout') - maxredirs = self.get_config('maxredirs') - useragent = self.get_config('useragent') + connecttimeout = self.config.get('connecttimeout') + maxredirs = self.config.get('maxredirs') + useragent = self.config.get('useragent') if connecttimeout: pyfile.plugin.req.http.c.setopt(pycurl.CONNECTTIMEOUT, connecttimeout) diff --git a/module/plugins/hooks/WarezWorld.py b/module/plugins/hooks/WarezWorld.py deleted file mode 100644 index b097af8b2..000000000 --- a/module/plugins/hooks/WarezWorld.py +++ /dev/null @@ -1,277 +0,0 @@ -import httplib -import re -import StringIO -import sys -import traceback -import urllib -import urllib2 -from bs4 import BeautifulSoup as Soup -from datetime import datetime -from module.plugins.internal.Addon import Addon -from pytz import timezone - - -UNIX_EPOCH = timezone('UTC').localize(datetime(1970, 1, 1)) - - -def notifyPushover(**kwargs): - Data = kwargs - Connection = httplib.HTTPSConnection('api.pushover.net:443') - Connection.request('POST', '/1/messages.json', urllib.urlencode(Data), - {'Content-type': 'application/x-www-form-urlencoded'}) - Response = Connection.getresponse() - -def replaceUmlauts(title): - title = title.replace(unichr(228), 'ae').replace(unichr(196), 'Ae') - title = title.replace(unichr(252), 'ue').replace(unichr(220), 'Ue') - title = title.replace(unichr(246), 'oe').replace(unichr(214), 'Oe') - title = title.replace(unichr(223), 'ss') - title = title.replace('&', '&') - return title - -def getUnixTimestamp(String): - String = re.search(r'^.*(\d{2}.\d{2}.\d{4})(\d{1,2}):(\d{2}).*$', String) - if String: - String = String.group(1) + \ - ('0' + String.group(2) if String.group(2) < '10' else String.group(2)) + \ - String.group(3) - String = String.replace('.', '') - - UnixTimestamp = ( - timezone('Europe/Berlin').localize(datetime.strptime(String, '%d%m%Y%H%M')).astimezone(timezone('UTC')) - - UNIX_EPOCH - ).total_seconds() - return UnixTimestamp - - -class WarezWorld(Addon): - __name__ = 'WarezWorld' - __type__ = 'hook' - __status__ = 'testing' - __author_name__ = ('Arno-Nymous') - __author_mail__ = ('Arno-Nymous@users.noreply.github.com') - __version__ = '1.2' - __description__ = 'Get new movies from Warez-World.org' - __config__ = [ - ('activated', 'bool', 'Active', 'False'), - ('interval', 'int', 'Waiting time until next run in minutes', '60'), - ('minYear', 'long', 'No movies older than year', '1970'), - ('pushoverAppToken', 'str', 'Pushover app token', ''), - ('pushoverUserToken', 'str', 'Pushover user token', ''), - ('preferredHosters', 'str', 'Preferred hosters (seperated by;)','Share-online.biz'), - ('quality', '720p;1080p', 'Video quality', '720p'), - ('ratingCollector', 'float', 'Send releases to link collector with an IMDb rating of (or higher)', '6.5'), - ('ratingQueue', 'float', 'Send releases to queue with an IMDb rating of (or higher)', '8.0'), - ('rejectGenres', 'str', 'Reject movies of an of the following genres (seperated by ;)', 'Anime;Documentary;Family'), - ('rejectReleaseTokens', 'str', 'Reject releases containing any of the following tokens (seperated by ;)', '.ts.;.hdts.'), - ('soundError', ';none;alien;bike;bugle;cashregister;classical;climb;cosmic;echo;falling;gamelan;incoming;intermission;magic;mechanical;persistent;pianobar;pushover;siren;spacealarm;tugboat;updown', 'Use this sound for errors pushed via Pushover (empty for default)', ''), - ('soundNotification', ';none;alien;bike;bugle;cashregister;classical;climb;cosmic;echo;falling;gamelan;incoming;intermission;magic;mechanical;persistent;pianobar;pushover;siren;spacealarm;tugboat;updown', 'Use this sound for notifications pushed via Pushover (empty for default)', '') - ] - - UrlOpener = urllib2.build_opener() - RejectGenres = [] - RejectReleaseTokens = [] - LastReleaseTimestamp = None - # Initialize dictionary keys here to enable quick access on keys via augmented operators - # in later code without further code magic - Statistics = {'Total': 0, 'Added': 0, 'Skipped': 0, 'AlreadyProcessed': 0} - - def __init__(self, *args, **kwargs): - super(WarezWorld, self).__init__(*args, **kwargs) - self.start_periodical(self.get_config('interval')) - - def periodical(self): - self.log_info(u'Start periodical run...') - - self.interval = self.get_config('interval') * 60 - self.RejectGenres = self.get_config('rejectGenres').split(';') - self.PreferredHosters = self.get_config('preferredHosters').lower().split(';') - self.RejectReleaseTokens = self.get_config('rejectReleaseTokens').lower().split(';') - self.LastReleaseTimestamp = float(self.retrieve('LastReleaseTimestamp', 0)) - # Setting statistics to 0 by iterating over dictionary items - # instead of recreating dictionary over and over - for Key in self.Statistics: - self.Statistics[Key] = 0 - - try: - Request = urllib2.Request('http://warez-world.org/kategorie/filme', 'html5lib') - Request.add_header('User-Agent', 'Mozilla/5.0') - Page = Soup(self.UrlOpener.open(Request).read()) - Items = Page.findAll('li', class_='main-single') - Releases = [] - - for Item in Items: - Releases.append({ - 'MovieName': Item.find('span', class_='main-rls').text, - 'ReleaseName': re.search(r'<br/>(.*)</span>', unicode(Item.find('span', class_='main-rls'))).group(1), - 'ReleaseLink': unicode(Item.find('span', class_='main-rls').a['href']), - 'ReleaseDate': getUnixTimestamp(unicode(Item.find(class_='main-date').text)) - }) - self.log_info(u'{0} releases found'.format(len(Releases))) - - for Release in Releases[::-1]: - if (Release['ReleaseDate'] < self.LastReleaseTimestamp): - self.log_debug(u'Release already processed \"{0}\"'.format (Release['ReleaseName'])) - self.Statistics['AlreadyProcessed'] += 1 - continue - self.log_debug(u'Processing release \"{0}\"'.format(Release['ReleaseName'])) - Release['MovieYear'] = 1900 - Release['MovieRating'] = 0 - Release['MovieGenres'] = [] - if self.parseRelease(Release): - self.downloadRelease(Release) - - self.store('LastReleaseTimestamp', Releases[0]['ReleaseDate']) - self.log_debug(u'Last parsed release timestamp is {0}'.format(Releases[0]['ReleaseDate'])) - - self.Statistics['Total'] = sum(self.Statistics.itervalues()) - self.log_info(u'Periodical run finished. Statistics: {0} total, {1} added, {2} skipped, {3} already processed'.format( - self.Statistics['Total'], - self.Statistics['Added'], - self.Statistics['Skipped'], - self.Statistics['AlreadyProcessed'] - )) - except: - exc_type, exc_value, exc_traceback = sys.exc_info() - output = StringIO.StringIO() - traceback.print_exception(exc_type, exc_value, exc_traceback, file=output) - if 'Release' in locals(): - msg = '<b>Stacktrace</b>\n{0}\n<b>Release</b>\n{1}\n\n<b>Date</b>\n{2}'.format( - output.getvalue(), Release['ReleaseName'].encode('utf-8'), Release['ReleaseDate'] - ) - else: - msg = '<b>Stacktrace</b>\n{0}'.format(output.getvalue()) - notifyPushover( - token=self.get_config('pushoverAppToken'), - user=self.get_config('pushoverUserToken'), - title='Error in script \"WarezWorld.py\"', - message=msg, - sound=self.get_config('soundError'), - html=1 - ) - raise - - def parseRelease(self, Release): - if any([ - set(re.split(r'[\. ]', Release['ReleaseName'].lower())) & set(self.RejectReleaseTokens), - not(self.get_config('quality').lower() in Release['ReleaseName'].lower()) - ]): - self.log_debug(u'...Skip release ({0})'.format("Release name contains unwanted tokens or quality mismatch")) - self.Statistics['Skipped'] += 1 - return False - - Request = urllib2.Request(Release['ReleaseLink'], 'html5lib') - Request.add_header('User-Agent', 'Mozilla/5.0') - ReleasePage = Soup(self.UrlOpener.open(Request).read()) - - DownloadLinks = ReleasePage.findAll('div', id='download-links') - if DownloadLinks: - for DownloadLink in DownloadLinks: - if DownloadLink.a.string and DownloadLink.a.string.lower() in self.PreferredHosters: - Release['DownloadLink'] = DownloadLink.a['href'] - break - if 'DownloadLink' not in Release: - self.log_debug('...No download link of preferred hoster found') - return False - - ReleaseNfo = ReleasePage.find('div', class_='spoiler') - ImdbUrl = re.search(r'(http://)?.*(imdb\.com/title/tt\d+)\D', unicode(ReleaseNfo)) - if ImdbUrl: - Release['ImdbUrl'] = 'http://www.' + ImdbUrl.group(2) - self.addImdbData(Release) - else: - for Div in ReleasePage.findAll('div', class_='ui2'): - if Div.a and Div.a.string == 'IMDb-Seite': - Request = urllib2.Request(urllib.quote_plus(Div.a['href'].encode('utf-8'), '/:?=')) - ImdbPage = Soup(self.UrlOpener.open(Request).read()) - if ImdbPage.find('table', class_='findList'): - Release['ImdbUrl'] = 'http://www.imdb.com' + \ - ImdbPage.find('td', class_='result_text').a['href'] - self.addImdbData(Release) - else: - self.log_debug(u'...Could not obtain IMDb data for release...Send to link collector') - self.Statistics['Added'] += 1 - break - - if all([Release['MovieYear'] >= self.get_config('minYear'), - Release['MovieRating'] >= self.get_config('ratingCollector'), - not(set(Release['MovieGenres']) & set(self.RejectGenres))]): - return True - else: - self.log_debug(u'...Skip release ({0})'.format('Movie too old, poor IMDb rating or unwanted genres')) - self.Statistics['Skipped'] += 1 - return False - - def addImdbData(self, Release): - self.log_debug(u'...Fetching IMDb data for release ({0})'.format(Release['ImdbUrl'])) - - Request = urllib2.Request(Release['ImdbUrl']) - Request.add_header('User-Agent', 'Mozilla/5.0') - ImdbPage = Soup(self.UrlOpener.open(Request).read()) - - MovieName = ImdbPage.find('span', {'itemprop': 'name'}).string - # For the year it has to be done a tiny bit of BeautifulSoup magic as it sometimes can - # be formatted as a link on IMDb and sometimes not - try: - MovieYear = ImdbPage.find('h1', class_='header').find('span', class_='nobr').find( - text=re.compile(r'\d{4}') - ).strip(u' ()\u2013') - except: - MovieYear = 0 - self.log_debug('...Could not parse movie year ({0})'.format(Release['ImdbUrl'])) - try: - MovieRating = ImdbPage.find('span', {'itemprop': 'ratingValue'}).string.replace(',', '.') - except: - MovieRating = 0 - self.log_debug(u'...Could not parse movie rating ({0})'.format(MovieName, Release['ImdbUrl'])) - MovieGenres = [] - try: - for Genre in ImdbPage.find('div', {'itemprop': 'genre'}).findAll('a'): - MovieGenres.append(Genre.string.strip()) - except: - self.log_debug(u'...Could not parse movie genres ({0})'.format(Release['ImdbUrl'])) - - Release['MovieName'] = MovieName - Release['MovieYear'] = MovieYear - Release['MovieRating'] = MovieRating - Release['MovieGenres'] = MovieGenres - - def downloadRelease(self, Release): - Storage = self.retrieve(u'{0} ({1})'.format(Release['MovieName'], Release['MovieYear'])) - - if Storage == '1': - self.log_debug(u'Skip release ({0})'.format('already downloaded')) - self.Statistics['Skipped'] += 1 - else: - Storage = u'{0} ({1})'.format(Release['MovieName'], Release['MovieYear']) - if Release['MovieRating'] >= self.get_config('ratingQueue'): - self.pyload.api.addPackage(Storage + ' IMDb: ' + Release['MovieRating'], - [Release['DownloadLink']], 1) - PushoverTitle = 'New movie added to queue' - self.log_info(u'New movie added to queue ({0})'.format(Storage)) - else: - self.pyload.api.addPackage(Storage + ' IMDb: ' + Release['MovieRating'], - [Release['DownloadLink']], 0) - PushoverTitle = 'New movie added to link collector' - self.log_info(u'New movie added to link collector ({0})'.format(Storage)) - - self.Statistics['Added'] += 1 - - notifyPushover( - token=self.get_config('pushoverAppToken'), - user=self.get_config('pushoverUserToken'), - title=PushoverTitle, - message='<b>{0} ({1})</b>\n<i>Rating:</i> {2}\n<i>Genres:</i> {3}\n\n<i>{4}</i>'.format( - Release['MovieName'].encode('utf-8'), - Release['MovieYear'].encode('utf-8'), - Release['MovieRating'].encode('utf-8'), - ', '.join(Release['MovieGenres']).encode('utf-8'), - Release['ReleaseName'].encode('utf-8') - ), - sound=self.get_config('soundNotification'), - url=(Release['ImdbUrl'].encode('utf-8') if 'ImdbUrl' in Release else ''), - url_title='View on IMDb', - html=1 - ) - - self.store(Storage, '1') diff --git a/module/plugins/hooks/WindowsPhoneNotify.py b/module/plugins/hooks/WindowsPhoneNotify.py index cd5f5dea4..84d122811 100644 --- a/module/plugins/hooks/WindowsPhoneNotify.py +++ b/module/plugins/hooks/WindowsPhoneNotify.py @@ -9,20 +9,23 @@ from module.plugins.internal.Notifier import Notifier class WindowsPhoneNotify(Notifier): __name__ = "WindowsPhoneNotify" __type__ = "hook" - __version__ = "0.15" + __version__ = "0.17" __status__ = "testing" - __config__ = [("activated" , "bool", "Activated" , False), - ("push-id" , "str" , "Push ID" , "" ), - ("push-url" , "str" , "Push url" , "" ), - ("notifycaptcha" , "bool", "Notify captcha request" , True ), - ("notifypackage" , "bool", "Notify package finished" , True ), - ("notifyprocessed", "bool", "Notify packages processed" , True ), - ("notifyupdate" , "bool", "Notify plugin updates" , True ), - ("notifyexit" , "bool", "Notify pyLoad shutdown" , True ), - ("sendtimewait" , "int" , "Timewait in seconds between notifications", 5 ), - ("sendpermin" , "int" , "Max notifications per minute" , 12 ), - ("ignoreclient" , "bool", "Send notifications if client is connected", False)] + __config__ = [("activated" , "bool", "Activated" , False), + ("pushid" , "str" , "Push ID" , "" ), + ("pushurl" , "str" , "Push url" , "" ), + ("captcha" , "bool", "Notify captcha request" , True ), + ("reconnection" , "bool", "Notify reconnection request" , False), + ("downloadfinished", "bool", "Notify download finished" , True ), + ("downloadfailed" , "bool", "Notify download failed" , True ), + ("packagefinished" , "bool", "Notify package finished" , True ), + ("packagefailed" , "bool", "Notify package failed" , True ), + ("update" , "bool", "Notify pyLoad update" , False), + ("exit" , "bool", "Notify pyLoad shutdown/restart" , False), + ("sendinterval" , "int" , "Interval in seconds between notifications", 1 ), + ("sendpermin" , "int" , "Max notifications per minute" , 60 ), + ("ignoreclient" , "bool", "Send notifications if client is connected", True )] __description__ = """Send push notifications to Windows Phone""" __license__ = "GPLv3" @@ -31,7 +34,7 @@ class WindowsPhoneNotify(Notifier): def get_key(self): - return self.get_config('push-id'), self.get_config('push-url') + return self.config.get('pushid'), self.config.get('pushurl') def format_request(self, msg): diff --git a/module/plugins/hooks/XFileSharing.py b/module/plugins/hooks/XFileSharing.py index 26dea3ec6..4af246da8 100644 --- a/module/plugins/hooks/XFileSharing.py +++ b/module/plugins/hooks/XFileSharing.py @@ -9,10 +9,10 @@ from module.plugins.internal.Addon import Addon class XFileSharing(Addon): __name__ = "XFileSharing" __type__ = "hook" - __version__ = "0.52" + __version__ = "0.55" __status__ = "testing" - __config__ = [("activated" , "bool", "Activated" , True ), + __config__ = [("activated" , "bool", "Activated" , False), ("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 ), @@ -24,9 +24,9 @@ class XFileSharing(Addon): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - regexp = {'hoster' : (r'(?:https?://(?:www\.)?)(?!%s)(?:\w+\.)*?(?P<DOMAIN>(?:[\d.]+|[\w\-^_]{3,63}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/(?:embed-)?\w{12}(?:\W|$)', + regexp = {'hoster' : (r'(?:https?://(?:www\.)?)(?!(?:www\.)?(?:%s))(?P<DOMAIN>(?:[\d.]+|[\w\-^_]{3,63}(?:\.[a-zA-Z]{2,})+)(?:\:\d+)?)/(?:embed-)?\w{12}(?:\W|$)', r'https?://(?:[^/]+\.)?(?P<DOMAIN>%s)/(?:embed-)?\w+'), - 'crypter': (r'(?:https?://(?:www\.)?)(?!%s)(?:\w+\.)*?(?P<DOMAIN>(?:[\d.]+|[\w\-^_]{3,63}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/(?:user|folder)s?/\w+', + 'crypter': (r'(?:https?://(?:www\.)?)(?!(?:www\.)?(?:%s))(?P<DOMAIN>(?:[\d.]+|[\w\-^_]{3,63}(?:\.[a-zA-Z]{2,})+)(?:\:\d+)?)/(?:user|folder)s?/\w+', r'https?://(?:[^/]+\.)?(?P<DOMAIN>%s)/(?:user|folder)s?/\w+')} BUILTIN_HOSTERS = [# WORKING HOSTERS: @@ -60,15 +60,15 @@ class XFileSharing(Addon): def get_pattern(self, type, plugin): - if self.get_config("use_%s_list" % type): - plugin_list = self.get_config('%s_list' % type) + if self.config.get("use_%s_list" % type): + plugin_list = self.config.get('%s_list' % type) plugin_list = plugin_list.replace(' ', '').replace('\\', '') plugin_list = plugin_list.replace('|', ',').replace(';', ',') plugin_list = plugin_list.lower().split(',') plugin_set = set(plugin_list) - if self.get_config('use_builtin_list'): + if self.config.get('use_builtin_list'): builtin_list = getattr(self, "BUILTIN_%sS" % type.upper()) plugin_set.update(builtin_list) @@ -91,7 +91,13 @@ class XFileSharing(Addon): isXFS = lambda klass: any(k.__name__.startswith("XFS") for k in inspect.getmro(klass)) for p in self.pyload.pluginManager.plugins[type].values(): - klass = self.pyload.pluginManager.loadClass(type, p['name']) + try: + klass = self.pyload.pluginManager.loadClass(type, p['name']) + + except AttributeError, e: + self.log_debug(e, trace=True) + continue + if hasattr(klass, "PLUGIN_DOMAIN") and klass.PLUGIN_DOMAIN and isXFS(klass): plugin_list.append(klass.PLUGIN_DOMAIN) @@ -101,7 +107,7 @@ class XFileSharing(Addon): else: pattern = self.regexp[type][0] - self.log_info(_("Handle any %s site on the web!") % type) + self.log_info(_("Auto-discover new %ss") % type) return pattern @@ -116,13 +122,10 @@ class XFileSharing(Addon): dict['pattern'] = pattern dict['re'] = re.compile(pattern) - self.log_debug("Loaded %s pattern: %s" % (type, pattern)) + self.log_debug("Pattern for %ss: %s" % (type, pattern)) def _unload(self, type, plugin): dict = self.pyload.pluginManager.plugins[type][plugin] dict['pattern'] = r'^unmatchable$' dict['re'] = re.compile(dict['pattern']) - - - diff --git a/module/plugins/hooks/XMPPInterface.py b/module/plugins/hooks/XMPP.py index b8fe14239..1e0eda59b 100644 --- a/module/plugins/hooks/XMPPInterface.py +++ b/module/plugins/hooks/XMPP.py @@ -1,18 +1,16 @@ # -*- coding: utf-8 -*- -from pyxmpp import streamtls -from pyxmpp.all import JID, Message -from pyxmpp.interface import implements -from pyxmpp.interfaces import * +import pyxmpp + from pyxmpp.jabber.client import JabberClient -from module.plugins.hooks.IRCInterface import IRCInterface +from module.plugins.hooks.IRC import IRC -class XMPPInterface(IRCInterface, JabberClient): - __name__ = "XMPPInterface" +class XMPP(IRC, JabberClient): + __name__ = "XMPP" __type__ = "hook" - __version__ = "0.14" + __version__ = "0.15" __status__ = "testing" __config__ = [("activated", "bool", "Activated" , False ), @@ -29,21 +27,21 @@ class XMPPInterface(IRCInterface, JabberClient): __authors__ = [("RaNaN", "RaNaN@pyload.org")] - implements(IMessageHandlersProvider) + pyxmpp.interface.implements(IMessageHandlersProvider) def __init__(self, *args, **kwargs): - IRCInterface.__init__(self, *args, **kwargs) + IRC.__init__(self, *args, **kwargs) - self.jid = JID(self.get_config('jid')) - password = self.get_config('pw') + self.jid = pyxmpp.all.JID(self.config.get('jid')) + password = self.config.get('pw') #: If bare JID is provided add a resource -- it is required if not self.jid.resource: - self.jid = JID(self.jid.node, self.jid.domain, "pyLoad") + self.jid = pyxmpp.all.JID(self.jid.node, self.jid.domain, "pyLoad") - if self.get_config('tls'): - tls_settings = streamtls.TLSSettings(require=True, verify_peer=False) + if self.config.get('tls'): + tls_settings = pyxmpp.streamtls.TLSSettings(require=True, verify_peer=False) auth = ("sasl:PLAIN", "sasl:DIGEST-MD5") else: tls_settings = None @@ -69,7 +67,7 @@ class XMPPInterface(IRCInterface, JabberClient): def package_finished(self, pypack): try: - if self.get_config('info_pack'): + if self.config.get('info_pack'): self.announce(_("Package finished: %s") % pypack.name) except Exception: @@ -78,7 +76,7 @@ class XMPPInterface(IRCInterface, JabberClient): def download_finished(self, pyfile): try: - if self.get_config('info_file'): + if self.config.get('info_file'): self.announce( _("Download finished: %(name)s @ %(plugin)s") % {'name': pyfile.name, 'plugin': pyfile.pluginname}) @@ -146,11 +144,11 @@ class XMPPInterface(IRCInterface, JabberClient): to_jid = stanza.get_from() from_jid = stanza.get_to() - # j = JID() + # j = pyxmpp.all.JID() to_name = to_jid.as_utf8() from_name = from_jid.as_utf8() - names = self.get_config('owners').split(";") + names = self.config.get('owners').split(";") if to_name in names or to_jid.node + "@" + to_jid.domain in names: messages = [] @@ -171,7 +169,7 @@ class XMPPInterface(IRCInterface, JabberClient): try: res = handler(args) for line in res: - m = Message( + m = pyxmpp.all.Message( to_jid=to_jid, from_jid=from_jid, stanza_type=stanza.get_type(), @@ -197,15 +195,15 @@ class XMPPInterface(IRCInterface, JabberClient): """ Send message to all owners """ - for user in self.get_config('owners').split(";"): + for user in self.config.get('owners').split(";"): self.log_debug("Send message to", user) - to_jid = JID(user) + to_jid = pyxmpp.all.JID(user) - m = Message(from_jid=self.jid, - to_jid=to_jid, - stanza_type="chat", - body=message) + m = pyxmpp.all.Message(from_jid=self.jid, + to_jid=to_jid, + stanza_type="chat", + body=message) stream = self.get_stream() if not stream: @@ -230,7 +228,7 @@ class VersionHandler(object): This class will answer version query and announce 'jabber:iq:version' namespace in the client's disco#info results. """ - implements(IIqHandlersProvider, IFeaturesProvider) + pyxmpp.interface.implements(IIqHandlersProvider, IFeaturesProvider) def __init__(self, client): diff --git a/module/plugins/hoster/AlldebridCom.py b/module/plugins/hoster/AlldebridCom.py index 6cc5a8824..e8a587532 100644 --- a/module/plugins/hoster/AlldebridCom.py +++ b/module/plugins/hoster/AlldebridCom.py @@ -3,14 +3,14 @@ import re import urllib -from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -from module.plugins.internal.utils import json, parse_size +from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.misc import json, parse_size class AlldebridCom(MultiHoster): __name__ = "AlldebridCom" __type__ = "hoster" - __version__ = "0.50" + __version__ = "0.51" __status__ = "testing" __pattern__ = r'https?://(?:www\.|s\d+\.)?alldebrid\.com/dl/[\w^_]+' @@ -33,8 +33,9 @@ class AlldebridCom(MultiHoster): def handle_premium(self, pyfile): password = self.get_password() - data = json.loads(self.load("http://www.alldebrid.com/service.php", - get={'link': pyfile.url, 'json': "true", 'pw': password})) + html = self.load("http://www.alldebrid.com/service.php", + get={'link': pyfile.url, 'json': "true", 'pw': password}) + data = json.loads(html) self.log_debug("Json data", data) @@ -49,6 +50,3 @@ class AlldebridCom(MultiHoster): pyfile.name = data['filename'] pyfile.size = parse_size(data['filesize']) self.link = data['link'] - - -getInfo = create_getInfo(AlldebridCom) diff --git a/module/plugins/hoster/AndroidfilehostCom.py b/module/plugins/hoster/AndroidfilehostCom.py index be10e122a..c54d03efc 100644 --- a/module/plugins/hoster/AndroidfilehostCom.py +++ b/module/plugins/hoster/AndroidfilehostCom.py @@ -5,13 +5,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class AndroidfilehostCom(SimpleHoster): __name__ = "AndroidfilehostCom" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?androidfilehost\.com/\?fid=\d+' @@ -28,7 +28,7 @@ class AndroidfilehostCom(SimpleHoster): NAME_PATTERN = r'<br />(?P<N>.*?)</h1>' SIZE_PATTERN = r'<h4>size</h4>\s*<p>(?P<S>[\d.,]+)(?P<U>[\w^_]+)</p>' - HASHSUM_PATTERN = r'<h4>(?P<T>.*?)</h4>\s*<p><code>(?P<H>.*?)</code></p>' + HASHSUM_PATTERN = r'<h4>(?P<H>.*?)</h4>\s*<p><code>(?P<D>.*?)</code></p>' OFFLINE_PATTERN = r'404 not found' @@ -62,6 +62,3 @@ class AndroidfilehostCom(SimpleHoster): get={'fid' : fid, 'w' : 'download', 'mirror': mirror_host}) - - -getInfo = create_getInfo(AndroidfilehostCom) diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index 9c71c70a9..606c4ec0b 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.hoster.Http import Http, create_getInfo +from module.plugins.hoster.Http import Http class BasePlugin(Http): __name__ = "BasePlugin" __type__ = "hoster" - __version__ = "0.50" + __version__ = "0.51" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -23,6 +23,3 @@ class BasePlugin(Http): if not self.pyfile.url.startswith("http"): self.fail(_("No plugin matched")) - - -getInfo = create_getInfo(BasePlugin) diff --git a/module/plugins/hoster/BasketbuildCom.py b/module/plugins/hoster/BasketbuildCom.py index 329a4715a..9ef40baf6 100644 --- a/module/plugins/hoster/BasketbuildCom.py +++ b/module/plugins/hoster/BasketbuildCom.py @@ -6,13 +6,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class BasketbuildCom(SimpleHoster): __name__ = "BasketbuildCom" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.07" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(?:\w\.)?basketbuild\.com/filedl/.+' @@ -62,6 +62,3 @@ class BasketbuildCom(SimpleHoster): except AttributeError: self.error(_("DL-Link not found")) - - -getInfo = create_getInfo(BasketbuildCom) diff --git a/module/plugins/hoster/BayfilesCom.py b/module/plugins/hoster/BayfilesCom.py index 63ca0de96..75b348917 100644 --- a/module/plugins/hoster/BayfilesCom.py +++ b/module/plugins/hoster/BayfilesCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class BayfilesCom(DeadHoster): __name__ = "BayfilesCom" __type__ = "hoster" - __version__ = "0.12" + __version__ = "0.13" __status__ = "stable" __pattern__ = r'https?://(?:www\.)?bayfiles\.(com|net)/file/(?P<ID>\w+/\w+/[^/]+)' @@ -15,6 +15,3 @@ class BayfilesCom(DeadHoster): __description__ = """Bayfiles.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - -getInfo = create_getInfo(BayfilesCom) diff --git a/module/plugins/hoster/BezvadataCz.py b/module/plugins/hoster/BezvadataCz.py index 8e75d2510..51082a8a1 100644 --- a/module/plugins/hoster/BezvadataCz.py +++ b/module/plugins/hoster/BezvadataCz.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class BezvadataCz(SimpleHoster): __name__ = "BezvadataCz" __type__ = "hoster" - __version__ = "0.32" + __version__ = "0.33" __status__ = "testing" __pattern__ = r'http://(?:www\.)?bezvadata\.cz/stahnout/.+' @@ -78,6 +78,3 @@ class BezvadataCz(SimpleHoster): self.temp_offline() else: return super(BezvadataCz, self).check_errors() - - -getInfo = create_getInfo(BezvadataCz) diff --git a/module/plugins/hoster/BillionuploadsCom.py b/module/plugins/hoster/BillionuploadsCom.py index 23b27f06e..54984676a 100644 --- a/module/plugins/hoster/BillionuploadsCom.py +++ b/module/plugins/hoster/BillionuploadsCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class BillionuploadsCom(DeadHoster): __name__ = "BillionuploadsCom" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.10" __status__ = "stable" __pattern__ = r'http://(?:www\.)?billionuploads\.com/\w{12}' @@ -15,6 +15,3 @@ class BillionuploadsCom(DeadHoster): __description__ = """Billionuploads.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - -getInfo = create_getInfo(BillionuploadsCom) diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index b90f69759..951920444 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -5,13 +5,13 @@ from __future__ import with_statement import re from module.plugins.captcha.ReCaptcha import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class BitshareCom(SimpleHoster): __name__ = "BitshareCom" __type__ = "hoster" - __version__ = "0.58" + __version__ = "0.59" __status__ = "testing" __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/)?(?(1)|\?f=)(?P<ID>\w+)(?(1)/(?P<NAME>.+?)\.html)' @@ -79,7 +79,7 @@ class BitshareCom(SimpleHoster): #: This may either download our file or forward us to an error page self.link = self.get_download_url() - if self.check_file({'error': ">Error occured<"}): + if self.scan_download({'error': ">Error occured<"}): self.retry(5, 5 * 60, "Bitshare host : Error occured") @@ -114,11 +114,11 @@ class BitshareCom(SimpleHoster): self.retry() #: Resolve captcha - if captcha == 1: + if captcha is 1: self.log_debug("File is captcha protected") - recaptcha = ReCaptcha(self) + self.captcha = ReCaptcha(self.pyfile) - response, challenge = recaptcha.challenge() + response, challenge = self.captcha.challenge() res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", post={'request' : "validateCaptcha", 'ajaxid' : self.ajaxid, @@ -159,6 +159,3 @@ class BitshareCom(SimpleHoster): else: self.retry_captcha() - - -getInfo = create_getInfo(BitshareCom) diff --git a/module/plugins/hoster/BoltsharingCom.py b/module/plugins/hoster/BoltsharingCom.py index 41e20d3be..520ef5e20 100644 --- a/module/plugins/hoster/BoltsharingCom.py +++ b/module/plugins/hoster/BoltsharingCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class BoltsharingCom(DeadHoster): __name__ = "BoltsharingCom" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __status__ = "stable" __pattern__ = r'http://(?:www\.)?boltsharing\.com/\w{12}' @@ -15,6 +15,3 @@ class BoltsharingCom(DeadHoster): __description__ = """Boltsharing.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - -getInfo = create_getInfo(BoltsharingCom) diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py index 794a3b60e..0efe0717c 100644 --- a/module/plugins/hoster/CatShareNet.py +++ b/module/plugins/hoster/CatShareNet.py @@ -2,14 +2,14 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster from module.plugins.captcha.ReCaptcha import ReCaptcha class CatShareNet(SimpleHoster): __name__ = "CatShareNet" __type__ = "hoster" - __version__ = "0.19" + __version__ = "0.20" __status__ = "testing" __pattern__ = r'http://(?:www\.)?catshare\.net/\w{15,16}' @@ -42,9 +42,9 @@ class CatShareNet(SimpleHoster): def handle_free(self, pyfile): - recaptcha = ReCaptcha(self) + self.captcha = ReCaptcha(pyfile) - response, challenge = recaptcha.challenge() + response, challenge = self.captcha.challenge() self.data = self.load(pyfile.url, post={'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) @@ -52,6 +52,3 @@ class CatShareNet(SimpleHoster): m = re.search(self.LINK_FREE_PATTERN, self.data) if m is not None: self.link = m.group(1) - - -getInfo = create_getInfo(CatShareNet) diff --git a/module/plugins/hoster/CloudzerNet.py b/module/plugins/hoster/CloudzerNet.py index ab6b0f14d..6cfb9e250 100644 --- a/module/plugins/hoster/CloudzerNet.py +++ b/module/plugins/hoster/CloudzerNet.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class CloudzerNet(DeadHoster): __name__ = "CloudzerNet" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.09" __status__ = "stable" __pattern__ = r'https?://(?:www\.)?(cloudzer\.net/file/|clz\.to/(file/)?)\w+' @@ -17,6 +17,3 @@ class CloudzerNet(DeadHoster): __authors__ = [("gs", "I-_-I-_-I@web.de"), ("z00nx", "z00nx0@gmail.com"), ("stickell", "l.stickell@yahoo.it")] - - -getInfo = create_getInfo(CloudzerNet) diff --git a/module/plugins/hoster/CloudzillaTo.py b/module/plugins/hoster/CloudzillaTo.py index 3c613c9e3..5fd0b3247 100644 --- a/module/plugins/hoster/CloudzillaTo.py +++ b/module/plugins/hoster/CloudzillaTo.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class CloudzillaTo(SimpleHoster): __name__ = "CloudzillaTo" __type__ = "hoster" - __version__ = "0.11" + __version__ = "0.12" __status__ = "testing" __pattern__ = r'http://(?:www\.)?cloudzilla\.to/share/file/(?P<ID>[\w^_]+)' @@ -67,6 +67,3 @@ class CloudzillaTo(SimpleHoster): def handle_premium(self, pyfile): return self.handle_free(pyfile) - - -getInfo = create_getInfo(CloudzillaTo) diff --git a/module/plugins/hoster/CramitIn.py b/module/plugins/hoster/CramitIn.py index 3b6044adf..bf94bb299 100644 --- a/module/plugins/hoster/CramitIn.py +++ b/module/plugins/hoster/CramitIn.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster class CramitIn(XFSHoster): __name__ = "CramitIn" __type__ = "hoster" - __version__ = "0.11" + __version__ = "0.12" __status__ = "testing" __pattern__ = r'http://(?:www\.)?cramit\.in/\w{12}' @@ -25,6 +25,3 @@ class CramitIn(XFSHoster): INFO_PATTERN = r'<span class=t2>\s*(?P<N>.*?)</span>.*?<small>\s*\((?P<S>.*?)\)' LINK_PATTERN = r'href="(http://cramit\.in/file_download/.*?)"' - - -getInfo = create_getInfo(CramitIn) diff --git a/module/plugins/hoster/CrockoCom.py b/module/plugins/hoster/CrockoCom.py index 30934cffc..2205759e8 100644 --- a/module/plugins/hoster/CrockoCom.py +++ b/module/plugins/hoster/CrockoCom.py @@ -4,13 +4,13 @@ import re import urlparse from module.plugins.captcha.ReCaptcha import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class CrockoCom(SimpleHoster): __name__ = "CrockoCom" __type__ = "hoster" - __version__ = "0.24" + __version__ = "0.25" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(crocko|easy-share)\.com/\w+' @@ -56,13 +56,10 @@ class CrockoCom(SimpleHoster): action, form = m.groups() inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) - recaptcha = ReCaptcha(self) + self.captcha = ReCaptcha(pyfile) - inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge() + inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = self.captcha.challenge() self.download(action, post=inputs) - if self.check_file({'captcha': recaptcha.KEY_AJAX_PATTERN}): + if self.scan_download({'captcha': self.captcha.KEY_AJAX_PATTERN}): self.retry_captcha() - - -getInfo = create_getInfo(CrockoCom) diff --git a/module/plugins/hoster/CyberlockerCh.py b/module/plugins/hoster/CyberlockerCh.py index 6415b45c4..8c16106e1 100644 --- a/module/plugins/hoster/CyberlockerCh.py +++ b/module/plugins/hoster/CyberlockerCh.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class CyberlockerCh(DeadHoster): __name__ = "CyberlockerCh" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __status__ = "stable" __pattern__ = r'http://(?:www\.)?cyberlocker\.ch/\w+' @@ -15,6 +15,3 @@ class CyberlockerCh(DeadHoster): __description__ = """Cyberlocker.ch hoster plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] - - -getInfo = create_getInfo(CyberlockerCh) diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 2341f80e9..c2a7d3409 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -5,14 +5,14 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -from module.plugins.internal.utils import parse_size +from module.plugins.internal.SimpleHoster import SimpleHoster +from module.plugins.internal.misc import parse_size class CzshareCom(SimpleHoster): __name__ = "CzshareCom" __type__ = "hoster" - __version__ = "1.07" + __version__ = "1.08" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/(\d+/|download\.php\?).+' @@ -44,7 +44,7 @@ class CzshareCom(SimpleHoster): USER_CREDIT_PATTERN = r'<div class="credit">\s*kredit: <strong>([\d .,]+)(\w+)</strong>\s*</div><!-- .credit -->' - def check_traffic(self): + def out_of_traffic(self): #: Check if user logged in m = re.search(self.USER_CREDIT_PATTERN, self.data) if m is None: @@ -52,7 +52,7 @@ class CzshareCom(SimpleHoster): self.data = self.load(self.pyfile.url) m = re.search(self.USER_CREDIT_PATTERN, self.data) if m is None: - return False + return True #: Check user credit try: @@ -61,13 +61,13 @@ class CzshareCom(SimpleHoster): self.log_info(_("User %s has %i KiB left") % (self.account.user, credit / 1024)) if credit < self.pyfile.size: self.log_info(_("Not enough credit to download file: %s") % self.pyfile.name) - return False + return True except Exception, e: #: let's continue and see what happens... self.log_error(e, trace=True) - return True + return False def handle_premium(self, pyfile): @@ -138,7 +138,7 @@ class CzshareCom(SimpleHoster): def check_download(self): #: Check download - check = self.check_file({ + check = self.scan_download({ "temp offline" : re.compile(r"^Soubor je do.*asn.* nedostupn.*$"), 'credit' : re.compile(r"^Nem.*te dostate.*n.* kredit.$"), "multi-dl" : re.compile(self.MULTIDL_PATTERN), @@ -158,6 +158,3 @@ class CzshareCom(SimpleHoster): self.retry_captcha() return super(CzshareCom, self).check_download() - - -getInfo = create_getInfo(CzshareCom) diff --git a/module/plugins/hoster/DailymotionCom.py b/module/plugins/hoster/DailymotionCom.py index bf1655fe9..6c8f21766 100644 --- a/module/plugins/hoster/DailymotionCom.py +++ b/module/plugins/hoster/DailymotionCom.py @@ -3,7 +3,7 @@ import re from module.PyFile import statusMap -from module.plugins.internal.utils import json +from module.plugins.internal.misc import json from module.network.RequestFactory import getURL as get_url from module.plugins.internal.Hoster import Hoster @@ -44,7 +44,7 @@ def get_info(urls): class DailymotionCom(Hoster): __name__ = "DailymotionCom" __type__ = "hoster" - __version__ = "0.24" + __version__ = "0.25" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?dailymotion\.com/.*video/(?P<ID>[\w^_]+)' @@ -78,7 +78,7 @@ class DailymotionCom(Hoster): def get_quality(self): - q = self.get_config('quality') + q = self.config.get('quality') if q == "Lowest": quality = 0 @@ -112,10 +112,10 @@ class DailymotionCom(Hoster): def check_info(self, pyfile): pyfile.name, pyfile.size, pyfile.status, pyfile.url = get_info([pyfile.url])[0] - if pyfile.status == 1: + if pyfile.status is 1: self.offline() - elif pyfile.status == 6: + elif pyfile.status is 6: self.temp_offline() diff --git a/module/plugins/hoster/DataHu.py b/module/plugins/hoster/DataHu.py index 24bb1e8a5..2b85e1483 100644 --- a/module/plugins/hoster/DataHu.py +++ b/module/plugins/hoster/DataHu.py @@ -5,13 +5,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class DataHu(SimpleHoster): __name__ = "DataHu" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.07" __status__ = "testing" __pattern__ = r'http://(?:www\.)?data\.hu/get/\w+' @@ -35,6 +35,3 @@ class DataHu(SimpleHoster): def setup(self): self.resume_download = True self.multiDL = self.premium - - -getInfo = create_getInfo(DataHu) diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py index 27e8a566b..5c9756b51 100644 --- a/module/plugins/hoster/DataportCz.py +++ b/module/plugins/hoster/DataportCz.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class DataportCz(SimpleHoster): __name__ = "DataportCz" __type__ = "hoster" - __version__ = "0.45" + __version__ = "0.46" __status__ = "testing" __pattern__ = r'http://(?:www\.)?dataport\.cz/file/(.+)' @@ -44,7 +44,7 @@ class DataportCz(SimpleHoster): self.download("http://www.dataport.cz%s" % action, post=inputs) - check = self.check_file({'captcha': 'alert("\u0160patn\u011b opsan\u00fd k\u00f3d z obr\u00e1zu");', + check = self.scan_download({'captcha': 'alert("\u0160patn\u011b opsan\u00fd k\u00f3d z obr\u00e1zu");', 'slot' : 'alert("Je n\u00e1m l\u00edto, ale moment\u00e1ln\u011b nejsou'}) if check == "captcha": self.retry_captcha() @@ -52,6 +52,3 @@ class DataportCz(SimpleHoster): elif check == "slot": self.log_debug("No free slots - wait 60s and retry") self.retry(wait=60) - - -getInfo = create_getInfo(DataportCz) diff --git a/module/plugins/hoster/DateiTo.py b/module/plugins/hoster/DateiTo.py index f63541a10..a7ffb6548 100644 --- a/module/plugins/hoster/DateiTo.py +++ b/module/plugins/hoster/DateiTo.py @@ -3,13 +3,13 @@ import re from module.plugins.captcha.ReCaptcha import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class DateiTo(SimpleHoster): __name__ = "DateiTo" __type__ = "hoster" - __version__ = "0.12" + __version__ = "0.13" __status__ = "testing" __pattern__ = r'http://(?:www\.)?datei\.to/datei/(?P<ID>\w+)\.html' @@ -37,7 +37,7 @@ class DateiTo(SimpleHoster): def handle_free(self, pyfile): url = 'http://datei.to/ajax/download.php' data = {'P': 'I', 'ID': self.info['pattern']['ID']} - recaptcha = ReCaptcha(self) + self.captcha = ReCaptcha(pyfile) for _i in xrange(3): self.log_debug("URL", url, "POST", data) @@ -58,8 +58,8 @@ class DateiTo(SimpleHoster): url = 'http://datei.to/' + m.group(1) data = dict(x.split('=') for x in m.group(2).split('&')) - if url.endswith('recaptcha.php'): - data['recaptcha_response_field'], data['recaptcha_challenge_field'] = recaptcha.challenge() + if url.endswith('self.captcha.php'): + data['recaptcha_response_field'], data['recaptcha_challenge_field'] = self.captcha.challenge() else: return @@ -72,6 +72,3 @@ class DateiTo(SimpleHoster): self.load('http://datei.to/ajax/download.php', post={'P': 'Ads'}) self.wait(wait_time, False) - - -getInfo = create_getInfo(DateiTo) diff --git a/module/plugins/hoster/DdlstorageCom.py b/module/plugins/hoster/DdlstorageCom.py index 504cb3988..97a621676 100644 --- a/module/plugins/hoster/DdlstorageCom.py +++ b/module/plugins/hoster/DdlstorageCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class DdlstorageCom(DeadHoster): __name__ = "DdlstorageCom" __type__ = "hoster" - __version__ = "1.05" + __version__ = "1.06" __status__ = "stable" __pattern__ = r'https?://(?:www\.)?ddlstorage\.com/\w+' @@ -16,6 +16,3 @@ class DdlstorageCom(DeadHoster): __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), ("stickell", "l.stickell@yahoo.it")] - - -getInfo = create_getInfo(DdlstorageCom) diff --git a/module/plugins/hoster/DebridItaliaCom.py b/module/plugins/hoster/DebridItaliaCom.py index 654fd7902..8742534a9 100644 --- a/module/plugins/hoster/DebridItaliaCom.py +++ b/module/plugins/hoster/DebridItaliaCom.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo +from module.plugins.internal.MultiHoster import MultiHoster class DebridItaliaCom(MultiHoster): __name__ = "DebridItaliaCom" __type__ = "hoster" - __version__ = "0.21" + __version__ = "0.22" __status__ = "testing" __pattern__ = r'https?://(?:www\.|s\d+\.)?debriditalia\.com/dl/\d+' @@ -45,6 +45,3 @@ class DebridItaliaCom(MultiHoster): self.link = re.search(r'<a href="(.+?)"', self.data).group(1) except AttributeError: pass - - -getInfo = create_getInfo(DebridItaliaCom) diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py index 0f6e7346c..06630d763 100644 --- a/module/plugins/hoster/DepositfilesCom.py +++ b/module/plugins/hoster/DepositfilesCom.py @@ -4,13 +4,13 @@ import re import urllib from module.plugins.captcha.ReCaptcha import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class DepositfilesCom(SimpleHoster): __name__ = "DepositfilesCom" __type__ = "hoster" - __version__ = "0.60" + __version__ = "0.61" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(depositfiles\.com|dfiles\.(eu|ru))(/\w{1,3})?/files/(?P<ID>\w+)' @@ -58,15 +58,15 @@ class DepositfilesCom(SimpleHoster): self.check_errors() - recaptcha = ReCaptcha(self) - captcha_key = recaptcha.detect_key() + self.captcha = ReCaptcha(pyfile) + captcha_key = self.captcha.detect_key() if captcha_key is None: return self.data = self.load("https://dfiles.eu/get_file.php", get=params) if '<input type=button value="Continue" onclick="check_recaptcha' in self.data: - params['response'], params['challenge'] = recaptcha.challenge(captcha_key) + params['response'], params['challenge'] = self.captcha.challenge(captcha_key) self.data = self.load("https://dfiles.eu/get_file.php", get=params) m = re.search(self.LINK_FREE_PATTERN, self.data) @@ -92,6 +92,3 @@ class DepositfilesCom(SimpleHoster): elif mirror: self.link = mirror.group(1) - - -getInfo = create_getInfo(DepositfilesCom) diff --git a/module/plugins/hoster/DevhostSt.py b/module/plugins/hoster/DevhostSt.py index 2b75ea2d8..37f9a3958 100644 --- a/module/plugins/hoster/DevhostSt.py +++ b/module/plugins/hoster/DevhostSt.py @@ -5,13 +5,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class DevhostSt(SimpleHoster): __name__ = "DevhostSt" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __pattern__ = r'http://(?:www\.)?d-h\.st/(?!users/)\w{3}' @@ -28,7 +28,7 @@ class DevhostSt(SimpleHoster): NAME_PATTERN = r'<span title="(?P<N>.*?)"' SIZE_PATTERN = r'</span> \((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)<br' - HASHSUM_PATTERN = r'>(?P<T>.*?) Sum</span>: (?P<H>.*?)<br' + HASHSUM_PATTERN = r'>(?P<H>.*?) Sum</span>: (?P<D>.*?)<br' OFFLINE_PATTERN = r'>File Not Found' LINK_FREE_PATTERN = r'var product_download_url= \'(.+?)\'' @@ -37,6 +37,3 @@ class DevhostSt(SimpleHoster): def setup(self): self.multiDL = True self.chunk_limit = 1 - - -getInfo = create_getInfo(DevhostSt) diff --git a/module/plugins/hoster/DlFreeFr.py b/module/plugins/hoster/DlFreeFr.py index a11bfab61..b25c69c56 100644 --- a/module/plugins/hoster/DlFreeFr.py +++ b/module/plugins/hoster/DlFreeFr.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class DlFreeFr(SimpleHoster): __name__ = "DlFreeFr" __type__ = "hoster" - __version__ = "0.35" + __version__ = "0.36" __status__ = "testing" __pattern__ = r'http://(?:www\.)?dl\.free\.fr/(getfile\.pl\?file=/|[a-z])(?P<ID>\w+)' @@ -37,6 +37,3 @@ class DlFreeFr(SimpleHoster): self.download("http://dl.free.fr/getfile.pl", post={'file': '/' + self.info['pattern']['ID'], 'send': "Valider+et+télécharger+le+fichier"}) - - -getInfo = create_getInfo(DlFreeFr) diff --git a/module/plugins/hoster/DodanePl.py b/module/plugins/hoster/DodanePl.py index 1b4fc0a56..8ff69af72 100644 --- a/module/plugins/hoster/DodanePl.py +++ b/module/plugins/hoster/DodanePl.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class DodanePl(DeadHoster): __name__ = "DodanePl" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.07" __status__ = "stable" __pattern__ = r'http://(?:www\.)?dodane\.pl/file/\d+' @@ -15,6 +15,3 @@ class DodanePl(DeadHoster): __description__ = """Dodane.pl hoster plugin""" __license__ = "GPLv3" __authors__ = [("z00nx", "z00nx0@gmail.com")] - - -getInfo = create_getInfo(DodanePl) diff --git a/module/plugins/hoster/DropboxCom.py b/module/plugins/hoster/DropboxCom.py index 7cd7fc64d..b4a00fbd7 100644 --- a/module/plugins/hoster/DropboxCom.py +++ b/module/plugins/hoster/DropboxCom.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class DropboxCom(SimpleHoster): __name__ = "DropboxCom" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?dropbox\.com/.+' @@ -41,6 +41,3 @@ class DropboxCom(SimpleHoster): def handle_free(self, pyfile): self.download(pyfile.url, get={'dl': "1"}) - - -getInfo = create_getInfo(DropboxCom) diff --git a/module/plugins/hoster/DuploadOrg.py b/module/plugins/hoster/DuploadOrg.py index 369b5b79d..b9333413d 100644 --- a/module/plugins/hoster/DuploadOrg.py +++ b/module/plugins/hoster/DuploadOrg.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class DuploadOrg(DeadHoster): __name__ = "DuploadOrg" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __status__ = "stable" __pattern__ = r'http://(?:www\.)?dupload\.org/\w{12}' @@ -15,6 +15,3 @@ class DuploadOrg(DeadHoster): __description__ = """Dupload.grg hoster plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] - - -getInfo = create_getInfo(DuploadOrg) diff --git a/module/plugins/hoster/EasybytezCom.py b/module/plugins/hoster/EasybytezCom.py index aa34ce929..f58477a40 100644 --- a/module/plugins/hoster/EasybytezCom.py +++ b/module/plugins/hoster/EasybytezCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster class EasybytezCom(XFSHoster): __name__ = "EasybytezCom" __type__ = "hoster" - __version__ = "0.27" + __version__ = "0.28" __status__ = "testing" __pattern__ = r'http://(?:www\.)?easybytez\.com/\w{12}' @@ -27,6 +27,3 @@ class EasybytezCom(XFSHoster): OFFLINE_PATTERN = r'>File not available' LINK_PATTERN = r'(http://(\w+\.(easybytez|easyload|ezbytez|zingload)\.(com|to)|\d+\.\d+\.\d+\.\d+)/files/\d+/\w+/.+?)["\'<]' - - -getInfo = create_getInfo(EasybytezCom) diff --git a/module/plugins/hoster/EdiskCz.py b/module/plugins/hoster/EdiskCz.py index b501ccd5b..58dc0da89 100644 --- a/module/plugins/hoster/EdiskCz.py +++ b/module/plugins/hoster/EdiskCz.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class EdiskCz(SimpleHoster): __name__ = "EdiskCz" __type__ = "hoster" - __version__ = "0.26" + __version__ = "0.27" __status__ = "testing" __pattern__ = r'http://(?:www\.)?edisk\.(cz|sk|eu)/(stahni|sk/stahni|en/download)/.+' @@ -57,6 +57,3 @@ class EdiskCz(SimpleHoster): self.fail(_("Unexpected server response")) self.link = url - - -getInfo = create_getInfo(EdiskCz) diff --git a/module/plugins/hoster/EgoFilesCom.py b/module/plugins/hoster/EgoFilesCom.py index eef421ba6..79e3f00a1 100644 --- a/module/plugins/hoster/EgoFilesCom.py +++ b/module/plugins/hoster/EgoFilesCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class EgoFilesCom(DeadHoster): __name__ = "EgoFilesCom" __type__ = "hoster" - __version__ = "0.19" + __version__ = "0.20" __status__ = "stable" __pattern__ = r'https?://(?:www\.)?egofiles\.com/\w+' @@ -15,6 +15,3 @@ class EgoFilesCom(DeadHoster): __description__ = """Egofiles.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] - - -getInfo = create_getInfo(EgoFilesCom) diff --git a/module/plugins/hoster/EnteruploadCom.py b/module/plugins/hoster/EnteruploadCom.py index 7854128f2..657cd1198 100644 --- a/module/plugins/hoster/EnteruploadCom.py +++ b/module/plugins/hoster/EnteruploadCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class EnteruploadCom(DeadHoster): __name__ = "EnteruploadCom" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __status__ = "stable" __pattern__ = r'http://(?:www\.)?enterupload\.com/\w+' @@ -15,6 +15,3 @@ class EnteruploadCom(DeadHoster): __description__ = """EnterUpload.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - -getInfo = create_getInfo(EnteruploadCom) diff --git a/module/plugins/hoster/EpicShareNet.py b/module/plugins/hoster/EpicShareNet.py index a5148d877..269421468 100644 --- a/module/plugins/hoster/EpicShareNet.py +++ b/module/plugins/hoster/EpicShareNet.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class EpicShareNet(DeadHoster): __name__ = "EpicShareNet" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __status__ = "stable" __pattern__ = r'https?://(?:www\.)?epicshare\.net/\w{12}' @@ -15,6 +15,3 @@ class EpicShareNet(DeadHoster): __description__ = """EpicShare.net hoster plugin""" __license__ = "GPLv3" __authors__ = [("t4skforce", "t4skforce1337[AT]gmail[DOT]com")] - - -getInfo = create_getInfo(EpicShareNet) diff --git a/module/plugins/hoster/EuroshareEu.py b/module/plugins/hoster/EuroshareEu.py index dac20bd2d..2df748cd2 100644 --- a/module/plugins/hoster/EuroshareEu.py +++ b/module/plugins/hoster/EuroshareEu.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class EuroshareEu(SimpleHoster): __name__ = "EuroshareEu" __type__ = "hoster" - __version__ = "0.36" + __version__ = "0.37" __status__ = "testing" __pattern__ = r'http://(?:www\.)?euroshare\.(eu|sk|cz|hu|pl)/file/.+' @@ -43,7 +43,7 @@ class EuroshareEu(SimpleHoster): self.link = pyfile.url.rstrip('/') + "/download/" - check = self.check_file({ + check = self.scan_download({ 'login': re.compile(self.ERROR_PATTERN), 'json' : re.compile(r'\{"status":"error".*?"message":"(.*?)"') }) @@ -65,6 +65,3 @@ class EuroshareEu(SimpleHoster): self.error(_("LINK_FREE_PATTERN not found")) self.link = m.group(1) - - -getInfo = create_getInfo(EuroshareEu) diff --git a/module/plugins/hoster/ExashareCom.py b/module/plugins/hoster/ExashareCom.py index 2314cc160..02a017b2e 100644 --- a/module/plugins/hoster/ExashareCom.py +++ b/module/plugins/hoster/ExashareCom.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster class ExashareCom(XFSHoster): __name__ = "ExashareCom" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.07" __status__ = "testing" __pattern__ = r'http://(?:www\.)?exashare\.com/\w{12}' @@ -36,6 +36,3 @@ class ExashareCom(XFSHoster): def handle_free(self, pyfile): return super(ExashareCom, self).handle_free(pyfile) - - -getInfo = create_getInfo(ExashareCom) diff --git a/module/plugins/hoster/ExtabitCom.py b/module/plugins/hoster/ExtabitCom.py index c573cca1a..436d31041 100644 --- a/module/plugins/hoster/ExtabitCom.py +++ b/module/plugins/hoster/ExtabitCom.py @@ -2,11 +2,11 @@ import re -from module.plugins.internal.utils import json +from module.plugins.internal.misc import json from module.plugins.captcha.ReCaptcha import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -from module.plugins.internal.utils import seconds_to_midnight +from module.plugins.internal.SimpleHoster import SimpleHoster +from module.plugins.internal.misc import seconds_to_midnight class ExtabitCom(SimpleHoster): @@ -52,13 +52,14 @@ class ExtabitCom(SimpleHoster): m = re.search(r'recaptcha/api/challenge\?k=(\w+)', self.data) if m is not None: - recaptcha = ReCaptcha(self) + self.captcha = ReCaptcha(pyfile) captcha_key = m.group(1) get_data = {'type': "recaptcha"} - get_data['capture'], get_data['challenge'] = recaptcha.challenge(captcha_key) + get_data['capture'], get_data['challenge'] = self.captcha.challenge(captcha_key) - res = json.loads(self.load("http://extabit.com/file/%s/" % fileID, get=get_data)) + html = self.load("http://extabit.com/file/%s/" % fileID, get=get_data) + res = json.loads(html) if "ok" in res: self.captcha.correct() @@ -77,6 +78,3 @@ class ExtabitCom(SimpleHoster): self.error(_("LINK_FREE_PATTERN not found")) self.link = m.group(1) - - -getInfo = create_getInfo(ExtabitCom) diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index f364bd441..0f0ff0ed4 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -3,14 +3,14 @@ import re import urllib -from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -from module.plugins.internal.utils import json +from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.misc import json class FastixRu(MultiHoster): __name__ = "FastixRu" __type__ = "hoster" - __version__ = "0.18" + __version__ = "0.19" __status__ = "testing" __pattern__ = r'http://(?:www\.)?fastix\.(ru|it)/file/\w{24}' @@ -43,6 +43,3 @@ class FastixRu(MultiHoster): self.offline() else: self.link = data['downloadlink'] - - -getInfo = create_getInfo(FastixRu) diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py index 493678e9b..b45e0ac23 100644 --- a/module/plugins/hoster/FastshareCz.py +++ b/module/plugins/hoster/FastshareCz.py @@ -3,13 +3,13 @@ import re import urlparse -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class FastshareCz(SimpleHoster): __name__ = "FastshareCz" __type__ = "hoster" - __version__ = "0.38" + __version__ = "0.39" __status__ = "testing" __pattern__ = r'http://(?:www\.)?fastshare\.cz/\d+/.+' @@ -64,7 +64,7 @@ class FastshareCz(SimpleHoster): def check_download(self): - check = self.check_file({ + check = self.scan_download({ 'paralell-dl' : re.compile(r"<title>FastShare.cz</title>|<script>alert\('Pres FREE muzete stahovat jen jeden soubor najednou.'\)"), 'wrong captcha': re.compile(r'Download for FREE'), 'credit' : re.compile(self.CREDIT_ERROR) @@ -80,6 +80,3 @@ class FastshareCz(SimpleHoster): self.restart(premium=False) return super(FastshareCz, self).check_download() - - -getInfo = create_getInfo(FastshareCz) diff --git a/module/plugins/hoster/FileApeCom.py b/module/plugins/hoster/FileApeCom.py index 0f436c151..5ae0c42d9 100644 --- a/module/plugins/hoster/FileApeCom.py +++ b/module/plugins/hoster/FileApeCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class FileApeCom(DeadHoster): __name__ = "FileApeCom" __type__ = "hoster" - __version__ = "0.15" + __version__ = "0.16" __status__ = "stable" __pattern__ = r'http://(?:www\.)?fileape\.com/(index\.php\?act=download\&id=|dl/)\w+' @@ -15,6 +15,3 @@ class FileApeCom(DeadHoster): __description__ = """FileApe.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("espes", None)] - - -getInfo = create_getInfo(FileApeCom) diff --git a/module/plugins/hoster/FileSharkPl.py b/module/plugins/hoster/FileSharkPl.py index 837d1fe4a..118ab8596 100644 --- a/module/plugins/hoster/FileSharkPl.py +++ b/module/plugins/hoster/FileSharkPl.py @@ -3,13 +3,13 @@ import re import urlparse -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class FileSharkPl(SimpleHoster): __name__ = "FileSharkPl" __type__ = "hoster" - __version__ = "0.17" + __version__ = "0.18" __status__ = "testing" __pattern__ = r'http://(?:www\.)?fileshark\.pl/pobierz/\d+/\w+' @@ -108,6 +108,3 @@ class FileSharkPl(SimpleHoster): inputs['form[start]'] = "" self.download(link, post=inputs, disposition=True) - - -getInfo = create_getInfo(FileSharkPl) diff --git a/module/plugins/hoster/FileStoreTo.py b/module/plugins/hoster/FileStoreTo.py index a148d6153..80c7008c6 100644 --- a/module/plugins/hoster/FileStoreTo.py +++ b/module/plugins/hoster/FileStoreTo.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class FileStoreTo(SimpleHoster): __name__ = "FileStoreTo" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __pattern__ = r'http://(?:www\.)?filestore\.to/\?d=(?P<ID>\w+)' @@ -38,6 +38,3 @@ class FileStoreTo(SimpleHoster): self.wait(10) self.link = self.load("http://filestore.to/ajax/download.php", get={'D': re.search(r'"D=(\w+)', self.data).group(1)}) - - -getInfo = create_getInfo(FileStoreTo) diff --git a/module/plugins/hoster/FilebeerInfo.py b/module/plugins/hoster/FilebeerInfo.py index 083dfe2c7..76e63c019 100644 --- a/module/plugins/hoster/FilebeerInfo.py +++ b/module/plugins/hoster/FilebeerInfo.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class FilebeerInfo(DeadHoster): __name__ = "FilebeerInfo" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.07" __status__ = "stable" __pattern__ = r'http://(?:www\.)?filebeer\.info/(?!\d*~f)(?P<ID>\w+)' @@ -15,6 +15,3 @@ class FilebeerInfo(DeadHoster): __description__ = """Filebeer.info plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - -getInfo = create_getInfo(FilebeerInfo) diff --git a/module/plugins/hoster/FileboomMe.py b/module/plugins/hoster/FileboomMe.py index 076fce1ae..87748ccab 100644 --- a/module/plugins/hoster/FileboomMe.py +++ b/module/plugins/hoster/FileboomMe.py @@ -3,13 +3,13 @@ import re import urlparse -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class FileboomMe(SimpleHoster): __name__ = "FileboomMe" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __pattern__ = r'https?://f(?:ile)?boom\.me/file/(?P<ID>\w+)' @@ -88,6 +88,3 @@ class FileboomMe(SimpleHoster): m = re.search(self.LINK_PATTERN, self.data) if m is not None: self.link = urlparse.urljoin(pyfile.url, m.group(0)) - - -getInfo = create_getInfo(FileboomMe) diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index 7b7ffd6ea..b245e449d 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -2,15 +2,15 @@ import re -from module.plugins.internal.utils import json +from module.plugins.internal.misc import json from module.plugins.captcha.ReCaptcha import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class FilecloudIo(SimpleHoster): __name__ = "FilecloudIo" __type__ = "hoster" - __version__ = "0.13" + __version__ = "0.14" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(?:filecloud\.io|ifile\.it|mihd\.net)/(?P<ID>\w+)' @@ -57,15 +57,15 @@ class FilecloudIo(SimpleHoster): self.error(_("__AB1")) data['__ab1'] = m.group(1) - recaptcha = ReCaptcha(self) + self.captcha = ReCaptcha(pyfile) m = re.search(self.RECAPTCHA_PATTERN, self.data) - captcha_key = m.group(1) if m else recaptcha.detect_key() + captcha_key = m.group(1) if m else self.captcha.detect_key() if captcha_key is None: self.error(_("ReCaptcha key not found")) - response, challenge = recaptcha.challenge(captcha_key) + response, challenge = self.captcha.challenge(captcha_key) self.account.form_data = {'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response} self.account.relogin() @@ -82,7 +82,7 @@ class FilecloudIo(SimpleHoster): self.log_debug(res) if res['captcha']: data['ctype'] = "recaptcha" - data['recaptcha_response'], data['recaptcha_challenge'] = recaptcha.challenge(captcha_key) + data['recaptcha_response'], data['recaptcha_challenge'] = self.captcha.challenge(captcha_key) json_url = "http://filecloud.io/download-request.json" res = self.load(json_url, post=data) @@ -122,6 +122,3 @@ class FilecloudIo(SimpleHoster): self.link = rep['download_url'] else: self.fail(rep['message']) - - -getInfo = create_getInfo(FilecloudIo) diff --git a/module/plugins/hoster/FiledropperCom.py b/module/plugins/hoster/FiledropperCom.py index c5b70fe20..a17b8ea32 100644 --- a/module/plugins/hoster/FiledropperCom.py +++ b/module/plugins/hoster/FiledropperCom.py @@ -3,13 +3,13 @@ import re import urlparse -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class FiledropperCom(SimpleHoster): __name__ = "FiledropperCom" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?filedropper\.com/\w+' @@ -45,6 +45,3 @@ class FiledropperCom(SimpleHoster): if m is not None: self.download(urlparse.urljoin("http://www.filedropper.com/", m.group(1)), post={'code': captcha_code}) - - -getInfo = create_getInfo(FiledropperCom) diff --git a/module/plugins/hoster/FilefactoryCom.py b/module/plugins/hoster/FilefactoryCom.py index 0cd8904e1..e8f4204af 100644 --- a/module/plugins/hoster/FilefactoryCom.py +++ b/module/plugins/hoster/FilefactoryCom.py @@ -3,7 +3,8 @@ import re from module.network.RequestFactory import getURL as get_url -from module.plugins.internal.SimpleHoster import SimpleHoster, parse_fileInfo +from module.plugins.internal.Base import parse_fileInfo +from module.plugins.internal.SimpleHoster import SimpleHoster def get_info(urls): @@ -21,7 +22,7 @@ def get_info(urls): class FilefactoryCom(SimpleHoster): __name__ = "FilefactoryCom" __type__ = "hoster" - __version__ = "0.61" + __version__ = "0.62" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?filefactory\.com/(file|trafficshare/\w+)/\w+' @@ -66,7 +67,7 @@ class FilefactoryCom(SimpleHoster): def check_download(self): - check = self.check_file({ + check = self.scan_download({ 'multiple': "You are currently downloading too many files at once.", 'error' : '<div id="errorMessage">' }) diff --git a/module/plugins/hoster/FilejungleCom.py b/module/plugins/hoster/FilejungleCom.py index 4cf444eac..af00ef9a4 100644 --- a/module/plugins/hoster/FilejungleCom.py +++ b/module/plugins/hoster/FilejungleCom.py @@ -1,13 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.hoster.FileserveCom import FileserveCom, check_file -from module.plugins.internal.utils import chunks +from module.plugins.hoster.FileserveCom import FileserveCom class FilejungleCom(FileserveCom): __name__ = "FilejungleCom" __type__ = "hoster" - __version__ = "0.55" + __version__ = "0.56" __status__ = "testing" __pattern__ = r'http://(?:www\.)?filejungle\.com/f/(?P<ID>[^/]+)' @@ -24,8 +23,3 @@ class FilejungleCom(FileserveCom): LINKCHECK_TD = r'<div class="(?:col )?col\d">(?:<.*?>| )*([^<]*)' LONG_WAIT_PATTERN = r'<h1>Please wait for (\d+) (\w+)\s*to download the next file\.</h1>' - - -def get_info(urls): - for chunk in chunks(urls, 100): - yield check_file(FilejungleCom, chunk) diff --git a/module/plugins/hoster/FileomCom.py b/module/plugins/hoster/FileomCom.py index 0e189aac4..7419e2671 100644 --- a/module/plugins/hoster/FileomCom.py +++ b/module/plugins/hoster/FileomCom.py @@ -3,13 +3,13 @@ # Test links: # http://fileom.com/gycaytyzdw3g/random.bin.html -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster class FileomCom(XFSHoster): __name__ = "FileomCom" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.10" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?fileom\.com/\w{12}' @@ -36,6 +36,3 @@ class FileomCom(XFSHoster): self.multiDL = True self.chunk_limit = 1 self.resume_download = self.premium - - -getInfo = create_getInfo(FileomCom) diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index abd5c4d23..c47684522 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -3,15 +3,15 @@ import re import time -from module.plugins.internal.utils import json +from module.plugins.internal.misc import json from module.plugins.captcha.ReCaptcha import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class FilepostCom(SimpleHoster): __name__ = "FilepostCom" __type__ = "hoster" - __version__ = "0.38" + __version__ = "0.39" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(?:filepost\.com/files|fp\.io)/(?P<ID>[^/]+)' @@ -77,14 +77,15 @@ class FilepostCom(SimpleHoster): self.link = self.get_json_response(get_dict, post_dict, 'link') if not self.link: - #: Solve recaptcha - recaptcha = ReCaptcha(self) - post_dict['recaptcha_response_field'], post_dict['recaptcha_challenge_field'] = recaptcha.challenge(captcha_key) + #: Solve ReCaptcha + self.captcha = ReCaptcha(pyfile) + post_dict['recaptcha_response_field'], post_dict['recaptcha_challenge_field'] = self.captcha.challenge(captcha_key) self.link = self.get_json_response(get_dict, post_dict, 'link') def get_json_response(self, get_dict, post_dict, field): - res = json.loads(self.load('https://filepost.com/files/get/', get=get_dict, post=post_dict)) + html = self.load('https://filepost.com/files/get/', get=get_dict, post=post_dict) + res = json.loads(html) self.log_debug(res) @@ -117,6 +118,3 @@ class FilepostCom(SimpleHoster): self.error(_("JSON %s 2") % field) return res['js']['answer'][field] - - -getInfo = create_getInfo(FilepostCom) diff --git a/module/plugins/hoster/FilepupNet.py b/module/plugins/hoster/FilepupNet.py index 0e6750c91..3178c5799 100644 --- a/module/plugins/hoster/FilepupNet.py +++ b/module/plugins/hoster/FilepupNet.py @@ -6,13 +6,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class FilepupNet(SimpleHoster): __name__ = "FilepupNet" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.07" __status__ = "testing" __pattern__ = r'http://(?:www\.)?filepup\.net/files/\w+' @@ -46,6 +46,3 @@ class FilepupNet(SimpleHoster): if m is not None: dl_link = m.group(1) self.download(dl_link, post={'task': "download"}) - - -getInfo = create_getInfo(FilepupNet) diff --git a/module/plugins/hoster/FilerNet.py b/module/plugins/hoster/FilerNet.py index 0849a42d5..a1ad5d8c9 100644 --- a/module/plugins/hoster/FilerNet.py +++ b/module/plugins/hoster/FilerNet.py @@ -4,17 +4,16 @@ # http://filer.net/get/ivgf5ztw53et3ogd # http://filer.net/get/hgo14gzcng3scbvv -import pycurl import re from module.plugins.captcha.ReCaptcha import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class FilerNet(SimpleHoster): __name__ = "FilerNet" __type__ = "hoster" - __version__ = "0.23" + __version__ = "0.24" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?filer\.net/get/\w+' @@ -49,8 +48,8 @@ class FilerNet(SimpleHoster): if 'hash' not in inputs: self.error(_("Unable to detect hash")) - recaptcha = ReCaptcha(self) - response, challenge = recaptcha.challenge() + self.captcha = ReCaptcha(pyfile) + response, challenge = self.captcha.challenge() header = self.load(pyfile.url, post={'recaptcha_challenge_field': challenge, @@ -59,6 +58,3 @@ class FilerNet(SimpleHoster): just_header=True) self.link = header.get('location') - - -getInfo = create_getInfo(FilerNet) diff --git a/module/plugins/hoster/FilerioCom.py b/module/plugins/hoster/FilerioCom.py index 9c045b168..5bfc09dfa 100644 --- a/module/plugins/hoster/FilerioCom.py +++ b/module/plugins/hoster/FilerioCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster class FilerioCom(XFSHoster): __name__ = "FilerioCom" __type__ = "hoster" - __version__ = "0.11" + __version__ = "0.12" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(filerio\.(in|com)|filekeen\.com)/\w{12}' @@ -26,6 +26,3 @@ class FilerioCom(XFSHoster): URL_REPLACEMENTS = [(r'filekeen\.com', "filerio.in")] OFFLINE_PATTERN = r'>"File Not Found|File has been removed' - - -getInfo = create_getInfo(FilerioCom) diff --git a/module/plugins/hoster/FilesMailRu.py b/module/plugins/hoster/FilesMailRu.py index 38c6290b4..68aa24149 100644 --- a/module/plugins/hoster/FilesMailRu.py +++ b/module/plugins/hoster/FilesMailRu.py @@ -4,7 +4,7 @@ import re from module.network.RequestFactory import getURL as get_url from module.plugins.internal.Hoster import Hoster -from module.plugins.internal.utils import chunks +from module.plugins.internal.misc import chunks def get_info(urls): @@ -33,7 +33,7 @@ def get_info(urls): class FilesMailRu(Hoster): __name__ = "FilesMailRu" __type__ = "hoster" - __version__ = "0.37" + __version__ = "0.38" __status__ = "testing" __pattern__ = r'http://(?:www\.)?files\.mail\.ru/.+' @@ -101,11 +101,11 @@ class FilesMailRu(Hoster): #: then the download will be restarted. It's only bad for these #: who want download a HTML-File (it's one in a million ;-) ) # - #: The maximum UploadSize allowed on files.mail.ru at the moment == 100MB + #: The maximum UploadSize allowed on files.mail.ru at the moment is 100MB #: so i set it to check every download because sometimes there are downloads #: that contain the HTML-Text and 60MB ZEROs after that in a xyzfile.part1.rar file #: (Loading 100MB in to ram is not an option) - if self.check_file({'html': "<meta name="}, read_size=50000) is "html": + if self.scan_download({'html': "<meta name="}, read_size=50000) is "html": self.log_info(_("There was HTML Code in the Downloaded File (%s)...redirect error? The Download will be restarted." % self.pyfile.name)) self.retry() diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index 97041c434..d682134ee 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -5,10 +5,10 @@ import re from module.network.RequestFactory import getURL as get_url from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.internal.Hoster import Hoster -from module.plugins.internal.utils import chunks, json, parse_size, seconds_to_midnight +from module.plugins.internal.misc import json, parse_size, seconds_to_midnight -def check_file(plugin, urls): +def get_info(plugin, urls): html = get_url(plugin.URLS[1], post={'urls': "\n".join(urls)}) file_info = [] @@ -69,7 +69,7 @@ class FileserveCom(Hoster): def process(self, pyfile): pyfile.name, pyfile.size, status, self.url = check_file(self, [self.url])[0] - if status != 2: + if status is not 2: self.offline() self.log_debug("File Name: %s Size: %d" % (pyfile.name, pyfile.size)) @@ -118,7 +118,7 @@ class FileserveCom(Hoster): self.download(self.url, post={'download': "normal"}) self.log_debug(self.req.http.lastEffectiveURL) - check = self.check_file({'expired': self.LINK_EXPIRED_PATTERN, + check = self.scan_download({'expired': self.LINK_EXPIRED_PATTERN, 'wait' : re.compile(self.LONG_WAIT_PATTERN), 'limit' : self.DL_LIMIT_PATTERN}) @@ -157,13 +157,14 @@ class FileserveCom(Hoster): def do_captcha(self): captcha_key = re.search(self.CAPTCHA_KEY_PATTERN, self.data).group(1) - recaptcha = ReCaptcha(self) - - response, challenge = recaptcha.challenge(captcha_key) - res = json.loads(self.load(self.URLS[2], - post={'recaptcha_challenge_field' : challenge, - 'recaptcha_response_field' : response, - 'recaptcha_shortencode_field': self.file_id})) + self.captcha = ReCaptcha(self.pyfile) + + response, challenge = self.captcha.challenge(captcha_key) + html = self.load(self.URLS[2], + post={'recaptcha_challenge_field' : challenge, + 'recaptcha_response_field' : response, + 'recaptcha_shortencode_field': self.file_id}) + res = json.loads(html) if res['success']: self.captcha.correct() else: @@ -204,11 +205,6 @@ class FileserveCom(Hoster): self.download(premium_url or self.pyfile.url) if not premium_url and \ - self.check_file({'login': re.compile(self.NOT_LOGGED_IN_PATTERN)}): + self.scan_download({'login': re.compile(self.NOT_LOGGED_IN_PATTERN)}): self.account.relogin() self.retry(msg=_("Not logged in")) - - -def get_info(urls): - for chunk in chunks(urls, 100): - yield check_file(FileserveCom, chunk) diff --git a/module/plugins/hoster/FileshareInUa.py b/module/plugins/hoster/FileshareInUa.py index 3e863177c..93d1fc894 100644 --- a/module/plugins/hoster/FileshareInUa.py +++ b/module/plugins/hoster/FileshareInUa.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class FileshareInUa(DeadHoster): __name__ = "FileshareInUa" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __status__ = "stable" __pattern__ = r'https?://(?:www\.)?fileshare\.in\.ua/\w{7}' @@ -15,6 +15,3 @@ class FileshareInUa(DeadHoster): __description__ = """Fileshare.in.ua hoster plugin""" __license__ = "GPLv3" __authors__ = [("fwannmacher", "felipe@warhammerproject.com")] - - -getInfo = create_getInfo(FileshareInUa) diff --git a/module/plugins/hoster/FilesonicCom.py b/module/plugins/hoster/FilesonicCom.py index 0b6bfdb88..f04dfc2e5 100644 --- a/module/plugins/hoster/FilesonicCom.py +++ b/module/plugins/hoster/FilesonicCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class FilesonicCom(DeadHoster): __name__ = "FilesonicCom" __type__ = "hoster" - __version__ = "0.38" + __version__ = "0.39" __status__ = "stable" __pattern__ = r'http://(?:www\.)?filesonic\.com/file/\w+' @@ -16,6 +16,3 @@ class FilesonicCom(DeadHoster): __license__ = "GPLv3" __authors__ = [("jeix", "jeix@hasnomail.de"), ("paulking", None)] - - -getInfo = create_getInfo(FilesonicCom) diff --git a/module/plugins/hoster/FileuploadNet.py b/module/plugins/hoster/FileuploadNet.py index 891cc5640..fc0486948 100644 --- a/module/plugins/hoster/FileuploadNet.py +++ b/module/plugins/hoster/FileuploadNet.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class FileuploadNet(SimpleHoster): __name__ = "FileuploadNet" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(en\.)?file-upload\.net/download-\d+/.+' @@ -33,6 +33,3 @@ class FileuploadNet(SimpleHoster): def setup(self): self.multiDL = True self.chunk_limit = 1 - - -getInfo = create_getInfo(FileuploadNet) diff --git a/module/plugins/hoster/FilezyNet.py b/module/plugins/hoster/FilezyNet.py index 649385730..c5d411196 100644 --- a/module/plugins/hoster/FilezyNet.py +++ b/module/plugins/hoster/FilezyNet.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class FilezyNet(DeadHoster): __name__ = "FilezyNet" __type__ = "hoster" - __version__ = "0.23" + __version__ = "0.24" __status__ = "stable" __pattern__ = r'http://(?:www\.)?filezy\.net/\w{12}' @@ -15,6 +15,3 @@ class FilezyNet(DeadHoster): __description__ = """Filezy.net hoster plugin""" __license__ = "GPLv3" __authors__ = [] - - -getInfo = create_getInfo(FilezyNet) diff --git a/module/plugins/hoster/FiredriveCom.py b/module/plugins/hoster/FiredriveCom.py index 40165944c..377d620e8 100644 --- a/module/plugins/hoster/FiredriveCom.py +++ b/module/plugins/hoster/FiredriveCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class FiredriveCom(DeadHoster): __name__ = "FiredriveCom" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.09" __status__ = "stable" __pattern__ = r'https?://(?:www\.)?(firedrive|putlocker)\.com/(mobile/)?(file|embed)/(?P<ID>\w+)' @@ -15,6 +15,3 @@ class FiredriveCom(DeadHoster): __description__ = """Firedrive.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - -getInfo = create_getInfo(FiredriveCom) diff --git a/module/plugins/hoster/FlyFilesNet.py b/module/plugins/hoster/FlyFilesNet.py index 88d89fbd7..29a197781 100644 --- a/module/plugins/hoster/FlyFilesNet.py +++ b/module/plugins/hoster/FlyFilesNet.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster class FlyFilesNet(SimpleHoster): __name__ = "FlyFilesNet" __type__ = "hoster" - __version__ = "0.13" + __version__ = "0.14" __status__ = "testing" __pattern__ = r'http://(?:www\.)?flyfiles\.net/.+' diff --git a/module/plugins/hoster/FourSharedCom.py b/module/plugins/hoster/FourSharedCom.py index 1e9d8ce54..ccfd30f4a 100644 --- a/module/plugins/hoster/FourSharedCom.py +++ b/module/plugins/hoster/FourSharedCom.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class FourSharedCom(SimpleHoster): __name__ = "FourSharedCom" __type__ = "hoster" - __version__ = "0.35" + __version__ = "0.36" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?4shared(-china)?\.com/(account/)?(download|get|file|document|photo|video|audio|mp3|office|rar|zip|archive|music)/.+' @@ -64,6 +64,3 @@ class FourSharedCom(SimpleHoster): pass self.wait(20) - - -getInfo = create_getInfo(FourSharedCom) diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py index e1366913e..5ce95bd8e 100644 --- a/module/plugins/hoster/FreakshareCom.py +++ b/module/plugins/hoster/FreakshareCom.py @@ -4,7 +4,7 @@ import re from module.plugins.internal.Hoster import Hoster from module.plugins.captcha.ReCaptcha import ReCaptcha -from module.plugins.internal.utils import seconds_to_midnight +from module.plugins.internal.misc import seconds_to_midnight class FreakshareCom(Hoster): @@ -45,7 +45,7 @@ class FreakshareCom(Hoster): self.download(pyfile.url, post=self.req_opts) - check = self.check_file({ + check = self.scan_download({ 'bad' : "bad try", 'paralell' : "> Sorry, you cant download more then 1 files at time. <", 'empty' : "Warning: Unknown: Filename cannot be empty", @@ -179,7 +179,7 @@ class FreakshareCom(Hoster): challenge = re.search(r"http://api\.recaptcha\.net/challenge\?k=(\w+)", herewego) if challenge: - re_captcha = ReCaptcha(self) + re_captcha = ReCaptcha(self.pyfile) (request_options['recaptcha_challenge_field'], request_options['recaptcha_response_field']) = re_captcha.challenge(challenge.group(1)) diff --git a/module/plugins/hoster/FreeWayMe.py b/module/plugins/hoster/FreeWayMe.py index 1865a3901..1cdf00842 100644 --- a/module/plugins/hoster/FreeWayMe.py +++ b/module/plugins/hoster/FreeWayMe.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo +from module.plugins.internal.MultiHoster import MultiHoster class FreeWayMe(MultiHoster): __name__ = "FreeWayMe" __type__ = "hoster" - __version__ = "0.22" + __version__ = "0.23" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?free-way\.(bz|me)/.+' @@ -43,7 +43,7 @@ class FreeWayMe(MultiHoster): if 'location' in header: headers = self.load(header.get('location'), just_header=True) - if headers['code'] == 500: + if headers['code'] is 500: #: Error on 2nd stage self.log_error(_("Error [stage2]")) else: @@ -55,6 +55,3 @@ class FreeWayMe(MultiHoster): self.log_error(_("Error [stage1]")) #@TODO: handle errors - - -getInfo = create_getInfo(FreeWayMe) diff --git a/module/plugins/hoster/FreevideoCz.py b/module/plugins/hoster/FreevideoCz.py index 5e4a05a27..832936828 100644 --- a/module/plugins/hoster/FreevideoCz.py +++ b/module/plugins/hoster/FreevideoCz.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class FreevideoCz(DeadHoster): __name__ = "FreevideoCz" __type__ = "hoster" - __version__ = "0.33" + __version__ = "0.34" __status__ = "stable" __pattern__ = r'http://(?:www\.)?freevideo\.cz/vase-videa/.+' @@ -15,6 +15,3 @@ class FreevideoCz(DeadHoster): __description__ = """Freevideo.cz hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - -getInfo = create_getInfo(FreevideoCz)
\ No newline at end of file diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py index 6031132c4..8fa920e07 100644 --- a/module/plugins/hoster/FshareVn.py +++ b/module/plugins/hoster/FshareVn.py @@ -5,7 +5,8 @@ import time import urlparse from module.network.RequestFactory import getURL as get_url -from module.plugins.internal.SimpleHoster import SimpleHoster, parse_fileInfo +from module.plugins.internal.Base import parse_fileInfo +from module.plugins.internal.SimpleHoster import SimpleHoster def get_info(urls): @@ -23,7 +24,7 @@ def double_decode(m): class FshareVn(SimpleHoster): __name__ = "FshareVn" __type__ = "hoster" - __version__ = "0.24" + __version__ = "0.25" __status__ = "testing" __pattern__ = r'http://(?:www\.)?fshare\.vn/file/.+' diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index a9e0f1713..c6449629f 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -1,16 +1,17 @@ # -*- coding: utf-8 -*- -import pycurl import re import urlparse +import pycurl + from module.plugins.internal.Hoster import Hoster, parse_name class Ftp(Hoster): __name__ = "Ftp" __type__ = "hoster" - __version__ = "0.57" + __version__ = "0.58" __status__ = "testing" __pattern__ = r'(?:ftps?|sftp)://([\w\-.]+(:[\w\-.]+)?@)?[\w\-.]+(:\d+)?/.+' diff --git a/module/plugins/hoster/GamefrontCom.py b/module/plugins/hoster/GamefrontCom.py index c46c77208..49460f397 100644 --- a/module/plugins/hoster/GamefrontCom.py +++ b/module/plugins/hoster/GamefrontCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class GamefrontCom(SimpleHoster): __name__ = "GamefrontCom" __type__ = "hoster" - __version__ = "0.11" + __version__ = "0.12" __status__ = "testing" __pattern__ = r'http://(?:www\.)?gamefront\.com/files/(?P<ID>\d+)' @@ -37,6 +37,3 @@ class GamefrontCom(SimpleHoster): self.data = self.load("http://www.gamefront.com/files/service/thankyou", get={'id': self.info['pattern']['ID']}) return super(GamefrontCom, self).handle_free(pyfile) - - -getInfo = create_getInfo(GamefrontCom) diff --git a/module/plugins/hoster/GigapetaCom.py b/module/plugins/hoster/GigapetaCom.py index 722a317df..fb8fccc81 100644 --- a/module/plugins/hoster/GigapetaCom.py +++ b/module/plugins/hoster/GigapetaCom.py @@ -1,16 +1,15 @@ # -*- coding: utf-8 -*- -import pycurl import random import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class GigapetaCom(SimpleHoster): __name__ = "GigapetaCom" __type__ = "hoster" - __version__ = "0.07" + __version__ = "0.08" __status__ = "testing" __pattern__ = r'http://(?:www\.)?gigapeta\.com/dl/\w+' @@ -48,6 +47,3 @@ class GigapetaCom(SimpleHoster): just_header=True) self.link = header.get('location') - - -getInfo = create_getInfo(GigapetaCom) diff --git a/module/plugins/hoster/GooIm.py b/module/plugins/hoster/GooIm.py index 6d10e6dae..24fb41106 100644 --- a/module/plugins/hoster/GooIm.py +++ b/module/plugins/hoster/GooIm.py @@ -5,13 +5,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class GooIm(SimpleHoster): __name__ = "GooIm" __type__ = "hoster" - __version__ = "0.07" + __version__ = "0.08" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?goo\.im/.+' @@ -38,6 +38,3 @@ class GooIm(SimpleHoster): def handle_free(self, pyfile): self.wait(10) self.link = pyfile.url - - -getInfo = create_getInfo(GooIm) diff --git a/module/plugins/hoster/GoogledriveCom.py b/module/plugins/hoster/GoogledriveCom.py index d70b44efc..3090d5f85 100644 --- a/module/plugins/hoster/GoogledriveCom.py +++ b/module/plugins/hoster/GoogledriveCom.py @@ -6,14 +6,14 @@ import re import urlparse -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -from module.plugins.internal.utils import html_unescape +from module.plugins.internal.SimpleHoster import SimpleHoster +from module.plugins.internal.misc import html_unescape class GoogledriveCom(SimpleHoster): __name__ = "GoogledriveCom" __type__ = "hoster" - __version__ = "0.17" + __version__ = "0.20" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(drive|docs)\.google\.com/(file/d/\w+|uc\?.*id=)' @@ -35,7 +35,7 @@ class GoogledriveCom(SimpleHoster): def setup(self): - self.multiDL = True + self.multiDL = True self.resume_download = True self.chunk_limit = 1 @@ -47,14 +47,12 @@ class GoogledriveCom(SimpleHoster): if m is None: return - link = self.fixurl(link, "https://docs.google.com/") - dl = self.isdownload(link, redirect=False) + link = self.fixurl(m.group(1), "https://docs.google.com/") + dl = self.isdownload(link) - if not dl: - self.data = self.load(link) - else: + if dl: self.link = dl - break - - -getInfo = create_getInfo(GoogledriveCom) + return + else: + self.data = self.load(link) +
\ No newline at end of file diff --git a/module/plugins/hoster/HellshareCz.py b/module/plugins/hoster/HellshareCz.py index c4cbde712..8c540538e 100644 --- a/module/plugins/hoster/HellshareCz.py +++ b/module/plugins/hoster/HellshareCz.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class HellshareCz(SimpleHoster): __name__ = "HellshareCz" __type__ = "hoster" - __version__ = "0.88" + __version__ = "0.89" __status__ = "testing" __pattern__ = r'http://(?:www\.)?hellshare\.(?:cz|com|sk|hu|pl)/[^?]*/\d+' @@ -34,6 +34,3 @@ class HellshareCz(SimpleHoster): def setup(self): self.resume_download = self.multiDL = bool(self.account) self.chunk_limit = 1 - - -getInfo = create_getInfo(HellshareCz) diff --git a/module/plugins/hoster/HellspyCz.py b/module/plugins/hoster/HellspyCz.py index e018a82f1..04c508840 100644 --- a/module/plugins/hoster/HellspyCz.py +++ b/module/plugins/hoster/HellspyCz.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class HellspyCz(DeadHoster): __name__ = "HellspyCz" __type__ = "hoster" - __version__ = "0.31" + __version__ = "0.32" __status__ = "stable" __pattern__ = r'http://(?:www\.)?(?:hellspy\.(?:cz|com|sk|hu|pl)|sciagaj\.pl)(/\S+/\d+)' @@ -15,6 +15,3 @@ class HellspyCz(DeadHoster): __description__ = """HellSpy.cz hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - -getInfo = create_getInfo(HellspyCz) diff --git a/module/plugins/hoster/HighWayMe.py b/module/plugins/hoster/HighWayMe.py index 178c11daf..e972839e1 100644 --- a/module/plugins/hoster/HighWayMe.py +++ b/module/plugins/hoster/HighWayMe.py @@ -2,8 +2,8 @@ import re -from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -from module.plugins.internal.utils import seconds_to_midnight +from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.misc import seconds_to_midnight class HighWayMe(MultiHoster): @@ -30,7 +30,7 @@ class HighWayMe(MultiHoster): def check_errors(self): - if self.data.get('code') == 302: #@NOTE: This is not working. It should by if 302 Moved Temporarily then... But I don't now how to implement it. + if self.data.get('code') is 302: #@NOTE: This is not working. It should by if 302 Moved Temporarily then... But I don't now how to implement it. self.account.relogin() self.retry() @@ -77,6 +77,3 @@ class HighWayMe(MultiHoster): self.pyfile.size = 0 self.link = re.search(r'<download>([^<]+)</download>', self.data).group(1) - - -getInfo = create_getInfo(HighWayMe) diff --git a/module/plugins/hoster/HostujeNet.py b/module/plugins/hoster/HostujeNet.py index 212578328..0f0d18e19 100644 --- a/module/plugins/hoster/HostujeNet.py +++ b/module/plugins/hoster/HostujeNet.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class HostujeNet(SimpleHoster): __name__ = "HostujeNet" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" __status__ = "testing" __pattern__ = r'http://(?:www\.)?hostuje\.net/\w+' @@ -50,6 +50,3 @@ class HostujeNet(SimpleHoster): self.error(_("Form not found")) self.download(action, post=inputs) - - -getInfo = create_getInfo(HostujeNet) diff --git a/module/plugins/hoster/HotfileCom.py b/module/plugins/hoster/HotfileCom.py index be76eebff..291138209 100644 --- a/module/plugins/hoster/HotfileCom.py +++ b/module/plugins/hoster/HotfileCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class HotfileCom(DeadHoster): __name__ = "HotfileCom" __type__ = "hoster" - __version__ = "0.40" + __version__ = "0.41" __status__ = "stable" __pattern__ = r'https?://(?:www\.)?hotfile\.com/dl/\d+/\w+' @@ -18,6 +18,3 @@ class HotfileCom(DeadHoster): ("spoob", "spoob@pyload.org"), ("mkaay", "mkaay@mkaay.de"), ("JoKoT3", "jokot3@gmail.com")] - - -getInfo = create_getInfo(HotfileCom) diff --git a/module/plugins/hoster/Http.py b/module/plugins/hoster/Http.py index 5740e498f..f324ee986 100644 --- a/module/plugins/hoster/Http.py +++ b/module/plugins/hoster/Http.py @@ -3,13 +3,13 @@ import re import urlparse -from module.plugins.internal.Hoster import Hoster, create_getInfo +from module.plugins.internal.Hoster import Hoster class Http(Hoster): __name__ = "Http" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" __status__ = "testing" __pattern__ = r'(?:jd|pys?)://.+' @@ -66,9 +66,12 @@ class Http(Hoster): def check_download(self): - errmsg = self.check_file({'Html error' : re.compile(r'\A(?:\s*<.+>)?((?:[\w\s]*(?:[Ee]rror|ERROR)\s*\:?)?\s*\d{3})(?:\Z|\s+)'), - 'Html file' : re.compile(r'\A\s*<!DOCTYPE html'), - 'Request error': re.compile(r'([Aa]n error occured while processing your request)')}) + errmsg = self.scan_download({ + 'Html error' : re.compile(r'\A(?:\s*<.+>)?((?:[\w\s]*(?:[Ee]rror|ERROR)\s*\:?)?\s*\d{3})(?:\Z|\s+)'), + 'Html file' : re.compile(r'\A\s*<!DOCTYPE html'), + 'Request error': re.compile(r'([Aa]n error occured while processing your request)') + }) + if not errmsg: return @@ -80,6 +83,3 @@ class Http(Hoster): self.log_warning(_("Check result: ") + errmsg, _("Waiting 1 minute and retry")) self.retry(3, 60, errmsg) - - -getInfo = create_getInfo(Http) diff --git a/module/plugins/hoster/HugefilesNet.py b/module/plugins/hoster/HugefilesNet.py index 2dae78ea2..0c8f1ecc4 100644 --- a/module/plugins/hoster/HugefilesNet.py +++ b/module/plugins/hoster/HugefilesNet.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster class HugefilesNet(XFSHoster): __name__ = "HugefilesNet" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.10" __status__ = "testing" __pattern__ = r'http://(?:www\.)?hugefiles\.net/\w{12}' @@ -28,6 +28,3 @@ class HugefilesNet(XFSHoster): SIZE_PATTERN = r'File Size:</span>\s*<span.*?>(?P<S>[^<]+)</span></div>' FORM_INPUTS_MAP = {'ctype': re.compile(r'\d+')} - - -getInfo = create_getInfo(HugefilesNet) diff --git a/module/plugins/hoster/HundredEightyUploadCom.py b/module/plugins/hoster/HundredEightyUploadCom.py index 8aaf2d770..96af206e1 100644 --- a/module/plugins/hoster/HundredEightyUploadCom.py +++ b/module/plugins/hoster/HundredEightyUploadCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster class HundredEightyUploadCom(XFSHoster): __name__ = "HundredEightyUploadCom" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.10" __status__ = "testing" __pattern__ = r'http://(?:www\.)?180upload\.com/\w{12}' @@ -24,6 +24,3 @@ class HundredEightyUploadCom(XFSHoster): PLUGIN_DOMAIN = "180upload.com" OFFLINE_PATTERN = r'>File Not Found' - - -getInfo = create_getInfo(HundredEightyUploadCom) diff --git a/module/plugins/hoster/IFileWs.py b/module/plugins/hoster/IFileWs.py index f3f6321f7..ec9efcb03 100644 --- a/module/plugins/hoster/IFileWs.py +++ b/module/plugins/hoster/IFileWs.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class IFileWs(DeadHoster): __name__ = "IFileWs" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __status__ = "stable" __pattern__ = r'http://(?:www\.)?ifile\.ws/\w{12}' @@ -15,6 +15,3 @@ class IFileWs(DeadHoster): __description__ = """Ifile.ws hoster plugin""" __license__ = "GPLv3" __authors__ = [("z00nx", "z00nx0@gmail.com")] - - -getInfo = create_getInfo(IFileWs) diff --git a/module/plugins/hoster/IcyFilesCom.py b/module/plugins/hoster/IcyFilesCom.py index 507a4d57d..16ae7ce9a 100644 --- a/module/plugins/hoster/IcyFilesCom.py +++ b/module/plugins/hoster/IcyFilesCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class IcyFilesCom(DeadHoster): __name__ = "IcyFilesCom" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.10" __status__ = "stable" __pattern__ = r'http://(?:www\.)?icyfiles\.com/(.+)' @@ -15,6 +15,3 @@ class IcyFilesCom(DeadHoster): __description__ = """IcyFiles.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("godofdream", "soilfiction@gmail.com")] - - -getInfo = create_getInfo(IcyFilesCom) diff --git a/module/plugins/hoster/IfileIt.py b/module/plugins/hoster/IfileIt.py index 4cb8216aa..73cee4d0f 100644 --- a/module/plugins/hoster/IfileIt.py +++ b/module/plugins/hoster/IfileIt.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class IfileIt(DeadHoster): __name__ = "IfileIt" __type__ = "hoster" - __version__ = "0.32" + __version__ = "0.33" __status__ = "stable" __pattern__ = r'^unmatchable$' @@ -15,6 +15,3 @@ class IfileIt(DeadHoster): __description__ = """Ifile.it hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - -getInfo = create_getInfo(IfileIt) diff --git a/module/plugins/hoster/IfolderRu.py b/module/plugins/hoster/IfolderRu.py index 279d9f0f0..919d37b75 100644 --- a/module/plugins/hoster/IfolderRu.py +++ b/module/plugins/hoster/IfolderRu.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class IfolderRu(SimpleHoster): __name__ = "IfolderRu" __type__ = "hoster" - __version__ = "0.42" + __version__ = "0.43" __status__ = "testing" __pattern__ = r'http://(?:www)?(files\.)?(ifolder\.ru|metalarea\.org|rusfolder\.(com|net|ru))/(files/)?(?P<ID>\d+)' @@ -61,7 +61,3 @@ class IfolderRu(SimpleHoster): self.retry_captcha() self.link = re.search(self.LINK_FREE_PATTERN, self.data).group(1) - - -getInfo = create_getInfo(IfolderRu) - diff --git a/module/plugins/hoster/JumbofilesCom.py b/module/plugins/hoster/JumbofilesCom.py index f90916eb6..fe3ffb9eb 100644 --- a/module/plugins/hoster/JumbofilesCom.py +++ b/module/plugins/hoster/JumbofilesCom.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class JumbofilesCom(SimpleHoster): __name__ = "JumbofilesCom" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.07" __status__ = "testing" __pattern__ = r'http://(?:www\.)?jumbofiles\.com/(?P<ID>\w{12})' @@ -37,6 +37,3 @@ class JumbofilesCom(SimpleHoster): post_data = {'id': self.info['pattern']['ID'], 'op': "download3", 'rand': ""} html = self.load(self.pyfile.url, post=post_data) self.link = re.search(self.LINK_FREE_PATTERN, html).group(1) - - -getInfo = create_getInfo(JumbofilesCom) diff --git a/module/plugins/hoster/JunocloudMe.py b/module/plugins/hoster/JunocloudMe.py index 15d596e59..a146a5ea4 100644 --- a/module/plugins/hoster/JunocloudMe.py +++ b/module/plugins/hoster/JunocloudMe.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster class JunocloudMe(XFSHoster): __name__ = "JunocloudMe" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.10" __status__ = "testing" __pattern__ = r'http://(?:\w+\.)?junocloud\.me/\w{12}' @@ -27,6 +27,3 @@ class JunocloudMe(XFSHoster): OFFLINE_PATTERN = r'>No such file with this filename<' TEMP_OFFLINE_PATTERN = r'The page may have been renamed, removed or be temporarily unavailable.<' - - -getInfo = create_getInfo(JunocloudMe) diff --git a/module/plugins/hoster/Keep2ShareCc.py b/module/plugins/hoster/Keep2ShareCc.py index 1dba9713a..43c89176b 100644 --- a/module/plugins/hoster/Keep2ShareCc.py +++ b/module/plugins/hoster/Keep2ShareCc.py @@ -4,13 +4,13 @@ import re import urlparse from module.plugins.captcha.ReCaptcha import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class Keep2ShareCc(SimpleHoster): __name__ = "Keep2ShareCc" __type__ = "hoster" - __version__ = "0.28" + __version__ = "0.29" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(keep2share|k2s|keep2s)\.cc/file/(?P<ID>\w+)' @@ -114,12 +114,13 @@ class Keep2ShareCc(SimpleHoster): m = re.search(self.CAPTCHA_PATTERN, self.data) self.log_debug("CAPTCHA_PATTERN found %s" % m) + if m is not None: captcha_url = urlparse.urljoin("http://keep2s.cc/", m.group(1)) post_data['CaptchaForm[code]'] = self.captcha.decrypt(captcha_url) else: - recaptcha = ReCaptcha(self) - response, challenge = recaptcha.challenge() + self.captcha = ReCaptcha(self.pyfile) + response, challenge = self.captcha.challenge() post_data.update({'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) @@ -129,7 +130,3 @@ class Keep2ShareCc(SimpleHoster): self.retry_captcha() else: self.captcha.correct() - - -getInfo = create_getInfo(Keep2ShareCc) - diff --git a/module/plugins/hoster/KickloadCom.py b/module/plugins/hoster/KickloadCom.py index b962c5dad..c0253cddd 100644 --- a/module/plugins/hoster/KickloadCom.py +++ b/module/plugins/hoster/KickloadCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class KickloadCom(DeadHoster): __name__ = "KickloadCom" __type__ = "hoster" - __version__ = "0.24" + __version__ = "0.25" __status__ = "stable" __pattern__ = r'http://(?:www\.)?kickload\.com/get/.+' @@ -15,6 +15,3 @@ class KickloadCom(DeadHoster): __description__ = """Kickload.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("mkaay", "mkaay@mkaay.de")] - - -getInfo = create_getInfo(KickloadCom) diff --git a/module/plugins/hoster/KingfilesNet.py b/module/plugins/hoster/KingfilesNet.py index ddc6286b6..e1d44d63c 100644 --- a/module/plugins/hoster/KingfilesNet.py +++ b/module/plugins/hoster/KingfilesNet.py @@ -3,13 +3,13 @@ import re from module.plugins.captcha.SolveMedia import SolveMedia -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class KingfilesNet(SimpleHoster): __name__ = "KingfilesNet" __type__ = "hoster" - __version__ = "0.11" + __version__ = "0.12" __status__ = "testing" __pattern__ = r'http://(?:www\.)?kingfiles\.net/(?P<ID>\w{12})' @@ -51,8 +51,8 @@ class KingfilesNet(SimpleHoster): self.data = self.load(pyfile.url, post=post_data) - solvemedia = SolveMedia(self) - response, challenge = solvemedia.challenge() + self.captcha = SolveMedia(pyfile) + response, challenge = self.captcha.challenge() #: Make the downloadlink appear and load the file m = re.search(self.RAND_ID_PATTERN, self.data) @@ -79,6 +79,3 @@ class KingfilesNet(SimpleHoster): self.error(_("Download url not found")) self.link = m.group(1) - - -getInfo = create_getInfo(KingfilesNet) diff --git a/module/plugins/hoster/LemUploadsCom.py b/module/plugins/hoster/LemUploadsCom.py index b3633e3be..531fd995e 100644 --- a/module/plugins/hoster/LemUploadsCom.py +++ b/module/plugins/hoster/LemUploadsCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class LemUploadsCom(DeadHoster): __name__ = "LemUploadsCom" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __status__ = "stable" __pattern__ = r'https?://(?:www\.)?lemuploads\.com/\w{12}' @@ -15,6 +15,3 @@ class LemUploadsCom(DeadHoster): __description__ = """LemUploads.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("t4skforce", "t4skforce1337[AT]gmail[DOT]com")] - - -getInfo = create_getInfo(LemUploadsCom) diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 2d50651bd..805e15bf9 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -9,11 +9,11 @@ import re import urlparse -from module.plugins.internal.utils import json +from module.plugins.internal.misc import json from module.network.RequestFactory import getURL as get_url from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster -from module.plugins.internal.utils import seconds_to_midnight +from module.plugins.internal.misc import seconds_to_midnight def api_response(url): @@ -91,8 +91,8 @@ class LetitbitNet(SimpleHoster): self.log_debug(res) - recaptcha = ReCaptcha(self) - response, challenge = recaptcha.challenge() + self.captcha = ReCaptcha(pyfile) + response, challenge = self.captcha.challenge() post_data = {'recaptcha_challenge_field': challenge, 'recaptcha_response_field': response, diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py index 9ac1053c2..18d9b5677 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -3,8 +3,8 @@ import re import urlparse -from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -from module.plugins.internal.utils import json +from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.misc import json class LinksnappyCom(MultiHoster): @@ -52,6 +52,3 @@ class LinksnappyCom(MultiHoster): def _get_host(url): host = urlparse.urlsplit(url).netloc return re.search(r'[\w\-]+\.\w+$', host).group(0) - - -getInfo = create_getInfo(LinksnappyCom) diff --git a/module/plugins/hoster/LoadTo.py b/module/plugins/hoster/LoadTo.py index 83c312a2f..d33f1c9ef 100644 --- a/module/plugins/hoster/LoadTo.py +++ b/module/plugins/hoster/LoadTo.py @@ -7,13 +7,13 @@ import re from module.plugins.captcha.SolveMedia import SolveMedia -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class LoadTo(SimpleHoster): __name__ = "LoadTo" __type__ = "hoster" - __version__ = "0.27" + __version__ = "0.28" __status__ = "testing" __pattern__ = r'http://(?:www\.)?load\.to/\w+' @@ -57,16 +57,13 @@ class LoadTo(SimpleHoster): if m is not None: self.wait(m.group(1)) - #: Load.to is using solvemedia captchas since ~july 2014: - solvemedia = SolveMedia(self) - captcha_key = solvemedia.detect_key() + #: Load.to is using SolveMedia captchas since ~july 2014: + self.captcha = SolveMedia(pyfile) + captcha_key = self.captcha.detect_key() if captcha_key: - response, challenge = solvemedia.challenge(captcha_key) + response, challenge = self.captcha.challenge(captcha_key) self.download(self.link, post={'adcopy_challenge': challenge, 'adcopy_response' : response, 'returnUrl' : pyfile.url}) - - -getInfo = create_getInfo(LoadTo) diff --git a/module/plugins/hoster/LolabitsEs.py b/module/plugins/hoster/LolabitsEs.py index ae3b61210..4dc1ce751 100644 --- a/module/plugins/hoster/LolabitsEs.py +++ b/module/plugins/hoster/LolabitsEs.py @@ -2,14 +2,14 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -from module.plugins.internal.utils import html_unescape +from module.plugins.internal.SimpleHoster import SimpleHoster +from module.plugins.internal.misc import html_unescape class LolabitsEs(SimpleHoster): __name__ = "LolabitsEs" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?lolabits\.es/.+' @@ -50,6 +50,3 @@ class LolabitsEs(SimpleHoster): decode="unicode-escape") self.link = html_unescape(re.search(self.LINK_PATTERN, self.data).group(1)) - - -getInfo = create_getInfo(LolabitsEs) diff --git a/module/plugins/hoster/LomafileCom.py b/module/plugins/hoster/LomafileCom.py index cb92d7741..6c82be808 100644 --- a/module/plugins/hoster/LomafileCom.py +++ b/module/plugins/hoster/LomafileCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class LomafileCom(DeadHoster): __name__ = "LomafileCom" __type__ = "hoster" - __version__ = "0.55" + __version__ = "0.56" __status__ = "stable" __pattern__ = r'http://lomafile\.com/\w{12}' @@ -16,6 +16,3 @@ class LomafileCom(DeadHoster): __license__ = "GPLv3" __authors__ = [("nath_schwarz", "nathan.notwhite@gmail.com"), ("guidobelix", "guidobelix@hotmail.it")] - - -getInfo = create_getInfo(LomafileCom) diff --git a/module/plugins/hoster/LuckyShareNet.py b/module/plugins/hoster/LuckyShareNet.py index 47ffb295e..1aa5501d5 100644 --- a/module/plugins/hoster/LuckyShareNet.py +++ b/module/plugins/hoster/LuckyShareNet.py @@ -2,15 +2,15 @@ import re -from module.plugins.internal.utils import json +from module.plugins.internal.misc import json from module.plugins.captcha.ReCaptcha import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class LuckyShareNet(SimpleHoster): __name__ = "LuckyShareNet" __type__ = "hoster" - __version__ = "0.12" + __version__ = "0.13" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?luckyshare\.net/(?P<ID>\d{10,})' @@ -51,14 +51,14 @@ class LuckyShareNet(SimpleHoster): self.log_debug("JSON: " + rep) - jso = self.parse_json(rep) - self.wait(jso['time']) + json_data = self.parse_json(rep) + self.wait(json_data['time']) - recaptcha = ReCaptcha(self) + self.captcha = ReCaptcha(pyfile) - response, challenge = recaptcha.challenge() + response, challenge = self.captcha.challenge() rep = self.load(r"http://luckyshare.net/download/verify/challenge/%s/response/%s/hash/%s" % - (challenge, response, jso['hash'])) + (challenge, response, json_data['hash'])) self.log_debug("JSON: " + rep) @@ -67,9 +67,6 @@ class LuckyShareNet(SimpleHoster): elif 'link' in rep: self.captcha.correct() - jso.update(self.parse_json(rep)) - if jso['link']: - self.link = jso['link'] - - -getInfo = create_getInfo(LuckyShareNet) + json_data.update(self.parse_json(rep)) + if json_data['link']: + self.link = json_data['link'] diff --git a/module/plugins/hoster/MediafireCom.py b/module/plugins/hoster/MediafireCom.py index 5917ffd5b..f21329a4b 100644 --- a/module/plugins/hoster/MediafireCom.py +++ b/module/plugins/hoster/MediafireCom.py @@ -2,13 +2,13 @@ from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.captcha.SolveMedia import SolveMedia -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class MediafireCom(SimpleHoster): __name__ = "MediafireCom" __type__ = "hoster" - __version__ = "0.93" + __version__ = "0.94" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?mediafire\.com/(file/|view/\??|download(\.php\?|/)|\?)(?P<ID>\w+)' @@ -41,20 +41,22 @@ class MediafireCom(SimpleHoster): def handle_captcha(self): - solvemedia = SolveMedia(self) + solvemedia = SolveMedia(self.pyfile) captcha_key = solvemedia.detect_key() if captcha_key: + self.captcha = solvemedia response, challenge = solvemedia.challenge(captcha_key) self.data = self.load("http://www.mediafire.com/?" + self.info['pattern']['ID'], post={'adcopy_challenge': challenge, 'adcopy_response' : response}) return - recaptcha = ReCaptcha(self) + recaptcha = ReCaptcha(self.pyfile) captcha_key = recaptcha.detect_key() if captcha_key: + self.captcha = recaptcha response, challenge = recaptcha.challenge(captcha_key) self.data = self.load(self.pyfile.url, post={'g-recaptcha-response': response}) @@ -76,6 +78,3 @@ class MediafireCom(SimpleHoster): self.fail(_("Wrong password")) return super(MediafireCom, self).handle_free(pyfile) - - -getInfo = create_getInfo(MediafireCom) diff --git a/module/plugins/hoster/MegaCoNz.py b/module/plugins/hoster/MegaCoNz.py index 52851d80a..12cbd2635 100644 --- a/module/plugins/hoster/MegaCoNz.py +++ b/module/plugins/hoster/MegaCoNz.py @@ -1,19 +1,17 @@ # -*- coding: utf-8 -*- import array +import base64 import os import random import re +import Crypto.Cipher +import Crypto.Util # import pycurl -from base64 import standard_b64decode - -from Crypto.Cipher import AES -from Crypto.Util import Counter - from module.plugins.internal.Hoster import Hoster -from module.plugins.internal.utils import decode, encode, json +from module.plugins.internal.misc import decode, encode, json ############################ General errors ################################### @@ -48,7 +46,7 @@ from module.plugins.internal.utils import decode, encode, json class MegaCoNz(Hoster): __name__ = "MegaCoNz" __type__ = "hoster" - __version__ = "0.33" + __version__ = "0.34" __status__ = "testing" __pattern__ = r'(https?://(?:www\.)?mega(\.co)?\.nz/|mega:|chrome:.+?)#(?P<TYPE>N|)!(?P<ID>[\w^_]+)!(?P<KEY>[\w\-,]+)' @@ -96,7 +94,7 @@ class MegaCoNz(Hoster): def decrypt_attr(self, data, key): k, iv, meta_mac = self.get_cipher_key(key) - cbc = AES.new(k, AES.MODE_CBC, "\0" * 16) + cbc = Crypto.Cipher.AES.new(k, Crypto.Cipher.AES.MODE_CBC, "\0" * 16) attr = decode(cbc.decrypt(self.b64_decode(data))) self.log_debug("Decrypted Attr: %s" % attr) @@ -116,8 +114,8 @@ class MegaCoNz(Hoster): #: Convert counter to long and shift bytes k, iv, meta_mac = self.get_cipher_key(key) - ctr = Counter.new(128, initial_value=long(n.encode("hex"), 16) << 64) - cipher = AES.new(k, AES.MODE_CTR, counter=ctr) + ctr = Crypto.Util.Counter.new(128, initial_value=long(n.encode("hex"), 16) << 64) + cipher = Crypto.Cipher.AES.new(k, Crypto.Cipher.AES.MODE_CTR, counter=ctr) self.pyfile.setStatus("decrypting") self.pyfile.setProgress(0) @@ -165,10 +163,10 @@ class MegaCoNz(Hoster): df.close() # if file_mac[0] ^ file_mac[1], file_mac[2] ^ file_mac[3] is not meta_mac: - # os.remove(file_decrypted) + # self.remove(file_decrypted, trash=False) # self.fail(_("Checksum mismatch")) - os.remove(file_crypted) + self.remove(file_crypted, trash=False) self.last_download = decode(file_decrypted) diff --git a/module/plugins/hoster/MegaDebridEu.py b/module/plugins/hoster/MegaDebridEu.py index 4772ac1fe..8a8380cbd 100644 --- a/module/plugins/hoster/MegaDebridEu.py +++ b/module/plugins/hoster/MegaDebridEu.py @@ -3,14 +3,14 @@ import re import urllib -from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -from module.plugins.internal.utils import json +from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.misc import json class MegaDebridEu(MultiHoster): __name__ = "MegaDebridEu" __type__ = "hoster" - __version__ = "0.52" + __version__ = "0.53" __status__ = "testing" __pattern__ = r'http://((?:www\d+\.|s\d+\.)?mega-debrid\.eu|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/download/file/[\w^_]+' @@ -61,6 +61,3 @@ class MegaDebridEu(MultiHoster): res = json.loads(jsonResponse) if res['response_code'] == "ok": self.link = res['debridLink'][1:-1] - - -getInfo = create_getInfo(MegaDebridEu) diff --git a/module/plugins/hoster/MegaFilesSe.py b/module/plugins/hoster/MegaFilesSe.py index 8ec8a56a4..9a0173df0 100644 --- a/module/plugins/hoster/MegaFilesSe.py +++ b/module/plugins/hoster/MegaFilesSe.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class MegaFilesSe(DeadHoster): __name__ = "MegaFilesSe" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __status__ = "stable" __pattern__ = r'http://(?:www\.)?megafiles\.se/\w{12}' @@ -15,6 +15,3 @@ class MegaFilesSe(DeadHoster): __description__ = """MegaFiles.se hoster plugin""" __license__ = "GPLv3" __authors__ = [("t4skforce", "t4skforce1337[AT]gmail[DOT]com")] - - -getInfo = create_getInfo(MegaFilesSe) diff --git a/module/plugins/hoster/MegaRapidCz.py b/module/plugins/hoster/MegaRapidCz.py index dee74e653..3d1b288d6 100644 --- a/module/plugins/hoster/MegaRapidCz.py +++ b/module/plugins/hoster/MegaRapidCz.py @@ -1,11 +1,13 @@ # -*- coding: utf-8 -*- -import pycurl import re +import pycurl + from module.network.HTTPRequest import BadHeader from module.network.RequestFactory import getRequest as get_request -from module.plugins.internal.SimpleHoster import SimpleHoster, parse_fileInfo +from module.plugins.internal.Base import parse_fileInfo +from module.plugins.internal.SimpleHoster import SimpleHoster def get_info(urls): @@ -22,7 +24,7 @@ def get_info(urls): class MegaRapidCz(SimpleHoster): __name__ = "MegaRapidCz" __type__ = "hoster" - __version__ = "0.61" + __version__ = "0.62" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(share|mega)rapid\.cz/soubor/\d+/.+' diff --git a/module/plugins/hoster/MegaRapidoNet.py b/module/plugins/hoster/MegaRapidoNet.py index 6094cf6ac..68a74bf66 100644 --- a/module/plugins/hoster/MegaRapidoNet.py +++ b/module/plugins/hoster/MegaRapidoNet.py @@ -2,7 +2,7 @@ import random -from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo +from module.plugins.internal.MultiHoster import MultiHoster def random_with_n_digits(n): @@ -23,7 +23,7 @@ def random_with_n_digits(n): class MegaRapidoNet(MultiHoster): __name__ = "MegaRapidoNet" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __pattern__ = r'http://(?:www\.)?\w+\.megarapido\.net/\?file=\w+' @@ -58,7 +58,3 @@ class MegaRapidoNet(MultiHoster): self.error(_("You have logged in at another place")) return super(MegaRapidoNet, self).handle_premium(pyfile) - - -getInfo = create_getInfo(MegaRapidoNet) - diff --git a/module/plugins/hoster/MegacrypterCom.py b/module/plugins/hoster/MegacrypterCom.py index 484ff8da1..ee0531b2b 100644 --- a/module/plugins/hoster/MegacrypterCom.py +++ b/module/plugins/hoster/MegacrypterCom.py @@ -2,7 +2,7 @@ import re -from module.plugins.internal.utils import json +from module.plugins.internal.misc import json from module.plugins.hoster.MegaCoNz import MegaCoNz @@ -10,7 +10,7 @@ from module.plugins.hoster.MegaCoNz import MegaCoNz class MegacrypterCom(MegaCoNz): __name__ = "MegacrypterCom" __type__ = "hoster" - __version__ = "0.25" + __version__ = "0.26" __status__ = "testing" __pattern__ = r'https?://\w{0,10}\.?megacrypter\.com/[\w\-!]+' diff --git a/module/plugins/hoster/MegareleaseOrg.py b/module/plugins/hoster/MegareleaseOrg.py index 0c798a588..379d0c0f8 100644 --- a/module/plugins/hoster/MegareleaseOrg.py +++ b/module/plugins/hoster/MegareleaseOrg.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class MegareleaseOrg(DeadHoster): __name__ = "MegareleaseOrg" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __status__ = "stable" __pattern__ = r'https?://(?:www\.)?megarelease\.org/\w{12}' @@ -16,6 +16,3 @@ class MegareleaseOrg(DeadHoster): __license__ = "GPLv3" __authors__ = [("derek3x", "derek3x@vmail.me"), ("stickell", "l.stickell@yahoo.it")] - - -getInfo = create_getInfo(MegareleaseOrg) diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index 2d6e0f0d5..5e5c023e4 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -3,13 +3,13 @@ import re import time -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class MegasharesCom(SimpleHoster): __name__ = "MegasharesCom" __type__ = "hoster" - __version__ = "0.35" + __version__ = "0.36" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(d\d{2}\.)?megashares\.com/((index\.php)?\?d\d{2}=|dl/)\w+' @@ -108,6 +108,3 @@ class MegasharesCom(SimpleHoster): self.link = m.group(1) self.log_debug("%s: %s" % (msg, self.link)) - - -getInfo = create_getInfo(MegasharesCom) diff --git a/module/plugins/hoster/MegauploadCom.py b/module/plugins/hoster/MegauploadCom.py index 4b985ea84..9fea42a73 100644 --- a/module/plugins/hoster/MegauploadCom.py +++ b/module/plugins/hoster/MegauploadCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class MegauploadCom(DeadHoster): __name__ = "MegauploadCom" __type__ = "hoster" - __version__ = "0.34" + __version__ = "0.35" __status__ = "stable" __pattern__ = r'http://(?:www\.)?megaupload\.com/\?.*&?(d|v)=\w+' @@ -15,6 +15,3 @@ class MegauploadCom(DeadHoster): __description__ = """Megaupload.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("spoob", "spoob@pyload.org")] - - -getInfo = create_getInfo(MegauploadCom) diff --git a/module/plugins/hoster/MegavideoCom.py b/module/plugins/hoster/MegavideoCom.py index 4bb2b9413..1015db5dc 100644 --- a/module/plugins/hoster/MegavideoCom.py +++ b/module/plugins/hoster/MegavideoCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class MegavideoCom(DeadHoster): __name__ = "MegavideoCom" __type__ = "hoster" - __version__ = "0.24" + __version__ = "0.25" __status__ = "stable" __pattern__ = r'http://(?:www\.)?megavideo\.com/\?.*&?(d|v)=\w+' @@ -16,6 +16,3 @@ class MegavideoCom(DeadHoster): __license__ = "GPLv3" __authors__ = [("jeix", "jeix@hasnomail.de"), ("mkaay", "mkaay@mkaay.de")] - - -getInfo = create_getInfo(MegavideoCom) diff --git a/module/plugins/hoster/MovReelCom.py b/module/plugins/hoster/MovReelCom.py index 9e5b8e2c2..0de1d0d50 100644 --- a/module/plugins/hoster/MovReelCom.py +++ b/module/plugins/hoster/MovReelCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster class MovReelCom(XFSHoster): __name__ = "MovReelCom" __type__ = "hoster" - __version__ = "1.28" + __version__ = "1.29" __status__ = "testing" __pattern__ = r'http://(?:www\.)?movreel\.com/\w{12}' @@ -24,6 +24,3 @@ class MovReelCom(XFSHoster): PLUGIN_DOMAIN = "movreel.com" LINK_PATTERN = r'<a href="(.+?)">Download Link' - - -getInfo = create_getInfo(MovReelCom) diff --git a/module/plugins/hoster/MultihostersCom.py b/module/plugins/hoster/MultihostersCom.py index 58e4ce0e4..fc6aca3bc 100644 --- a/module/plugins/hoster/MultihostersCom.py +++ b/module/plugins/hoster/MultihostersCom.py @@ -6,7 +6,7 @@ from module.plugins.hoster.ZeveraCom import ZeveraCom class MultihostersCom(ZeveraCom): __name__ = "MultihostersCom" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.07" __status__ = "testing" __pattern__ = r'https?://(?:www\.)multihosters\.com/(getFiles\.ashx|Members/download\.ashx)\?.*ourl=.+' diff --git a/module/plugins/hoster/MultishareCz.py b/module/plugins/hoster/MultishareCz.py index 051985c1d..fca6974f9 100644 --- a/module/plugins/hoster/MultishareCz.py +++ b/module/plugins/hoster/MultishareCz.py @@ -3,13 +3,13 @@ import random import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class MultishareCz(SimpleHoster): __name__ = "MultishareCz" __type__ = "hoster" - __version__ = "0.45" + __version__ = "0.46" __status__ = "testing" __pattern__ = r'http://(?:www\.)?multishare\.cz/stahnout/(?P<ID>\d+)' @@ -46,7 +46,7 @@ class MultishareCz(SimpleHoster): self.update_info() - if not self.check_traffic(): + if self.out_of_traffic(): self.fail(_("Not enough credit left to download file")) self.download("http://dl%d.mms.multishare.cz/html/mms_process.php" % round(random.random() * 10000 * random.random()), @@ -54,6 +54,3 @@ class MultishareCz(SimpleHoster): 'u_hash': self.acc_info['u_hash'], 'link' : pyfile.url}, disposition=True) - - -getInfo = create_getInfo(MultishareCz) diff --git a/module/plugins/hoster/MyfastfileCom.py b/module/plugins/hoster/MyfastfileCom.py index 5424bbebe..defa1847c 100644 --- a/module/plugins/hoster/MyfastfileCom.py +++ b/module/plugins/hoster/MyfastfileCom.py @@ -2,14 +2,14 @@ import re -from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -from module.plugins.internal.utils import json +from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.misc import json class MyfastfileCom(MultiHoster): __name__ = "MyfastfileCom" __type__ = "hoster" - __version__ = "0.13" + __version__ = "0.14" __status__ = "testing" __pattern__ = r'http://\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/dl/' @@ -41,6 +41,3 @@ class MyfastfileCom(MultiHoster): self.fail(_("Unable to unrestrict link")) self.link = self.data['link'] - - -getInfo = create_getInfo(MyfastfileCom) diff --git a/module/plugins/hoster/MystoreTo.py b/module/plugins/hoster/MystoreTo.py index 7429900c5..31c472f29 100644 --- a/module/plugins/hoster/MystoreTo.py +++ b/module/plugins/hoster/MystoreTo.py @@ -5,13 +5,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class MystoreTo(SimpleHoster): __name__ = "MystoreTo" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.07" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?mystore\.to/dl/.+' @@ -46,6 +46,3 @@ class MystoreTo(SimpleHoster): self.link = self.load("http://mystore.to/api/download", post={'FID': fid}) - - -getInfo = create_getInfo(MystoreTo) diff --git a/module/plugins/hoster/MyvideoDe.py b/module/plugins/hoster/MyvideoDe.py index ee52cb121..410d81249 100644 --- a/module/plugins/hoster/MyvideoDe.py +++ b/module/plugins/hoster/MyvideoDe.py @@ -3,13 +3,13 @@ import re from module.plugins.internal.Hoster import Hoster -from module.plugins.internal.utils import html_unescape +from module.plugins.internal.misc import html_unescape class MyvideoDe(Hoster): __name__ = "MyvideoDe" __type__ = "hoster" - __version__ = "0.94" + __version__ = "0.95" __status__ = "testing" __pattern__ = r'http://(?:www\.)?myvideo\.de/watch/' diff --git a/module/plugins/hoster/NahrajCz.py b/module/plugins/hoster/NahrajCz.py index 73169aa22..c46d5112f 100644 --- a/module/plugins/hoster/NahrajCz.py +++ b/module/plugins/hoster/NahrajCz.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class NahrajCz(DeadHoster): __name__ = "NahrajCz" __type__ = "hoster" - __version__ = "0.24" + __version__ = "0.25" __status__ = "stable" __pattern__ = r'http://(?:www\.)?nahraj\.cz/content/download/.+' @@ -15,6 +15,3 @@ class NahrajCz(DeadHoster): __description__ = """Nahraj.cz hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - -getInfo = create_getInfo(NahrajCz) diff --git a/module/plugins/hoster/NarodRu.py b/module/plugins/hoster/NarodRu.py index e34dcbc2d..4f7c7e321 100644 --- a/module/plugins/hoster/NarodRu.py +++ b/module/plugins/hoster/NarodRu.py @@ -4,13 +4,13 @@ import random import re import urlparse -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class NarodRu(SimpleHoster): __name__ = "NarodRu" __type__ = "hoster" - __version__ = "0.15" + __version__ = "0.16" __status__ = "testing" __pattern__ = r'http://(?:www\.)?narod(\.yandex)?\.ru/(disk|start/\d+\.\w+\-narod\.yandex\.ru)/(?P<ID>\d+)/.+' @@ -57,6 +57,3 @@ class NarodRu(SimpleHoster): elif u'<b class="error-msg"><strong>ÐÑОблОÑÑ?</strong>' in self.data: self.retry_captcha() - - -getInfo = create_getInfo(NarodRu) diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index c646217c3..28da823a7 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class NetloadIn(DeadHoster): __name__ = "NetloadIn" __type__ = "hoster" - __version__ = "0.53" + __version__ = "0.54" __status__ = "stable" __pattern__ = r'https?://(?:www\.)?netload\.(in|me)/(?P<PATH>datei|index\.php\?id=10&file_id=)(?P<ID>\w+)' @@ -17,6 +17,3 @@ class NetloadIn(DeadHoster): __authors__ = [("spoob", "spoob@pyload.org"), ("RaNaN", "ranan@pyload.org"), ("Gregy", "gregy@gregy.cz" )] - - -getInfo = create_getInfo(NetloadIn) diff --git a/module/plugins/hoster/NitroflareCom.py b/module/plugins/hoster/NitroflareCom.py index 9ca6ab187..3e2970985 100644 --- a/module/plugins/hoster/NitroflareCom.py +++ b/module/plugins/hoster/NitroflareCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster class NitroflareCom(SimpleHoster): __name__ = "NitroflareCom" __type__ = "hoster" - __version__ = "0.17" + __version__ = "0.19" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?nitroflare\.com/view/(?P<ID>[\w^_]+)' @@ -57,8 +57,8 @@ class NitroflareCom(SimpleHoster): self.wait(wait_time) - recaptcha = ReCaptcha(self) - response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) + self.captcha = ReCaptcha(pyfile) + response, challenge = self.captcha.challenge(self.RECAPTCHA_KEY) self.data = self.load("http://nitroflare.com/ajax/freeDownload.php", post={'method' : "fetchDownload", diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py index 48db4be71..7a244e745 100644 --- a/module/plugins/hoster/NoPremiumPl.py +++ b/module/plugins/hoster/NoPremiumPl.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -from module.plugins.internal.utils import json +from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.misc import json class NoPremiumPl(MultiHoster): __name__ = "NoPremiumPl" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __pattern__ = r'https?://direct\.nopremium\.pl.+' @@ -103,6 +103,3 @@ class NoPremiumPl(MultiHoster): except Exception: self.temp_offline("Query error #2") - - -getInfo = create_getInfo(NoPremiumPl) diff --git a/module/plugins/hoster/NosuploadCom.py b/module/plugins/hoster/NosuploadCom.py index 9171d3b32..2b94e3bbc 100644 --- a/module/plugins/hoster/NosuploadCom.py +++ b/module/plugins/hoster/NosuploadCom.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster class NosuploadCom(XFSHoster): __name__ = "NosuploadCom" __type__ = "hoster" - __version__ = "0.35" + __version__ = "0.36" __status__ = "testing" __pattern__ = r'http://(?:www\.)?nosupload\.com/\?d=\w{12}' @@ -45,6 +45,3 @@ class NosuploadCom(XFSHoster): #: Stage3: get the download link return re.search(self.LINK_PATTERN, self.data, re.S).group(1) - - -getInfo = create_getInfo(NosuploadCom) diff --git a/module/plugins/hoster/NovafileCom.py b/module/plugins/hoster/NovafileCom.py index 622108c85..7229a88a0 100644 --- a/module/plugins/hoster/NovafileCom.py +++ b/module/plugins/hoster/NovafileCom.py @@ -4,13 +4,13 @@ # http://novafile.com/vfun4z6o2cit # http://novafile.com/s6zrr5wemuz4 -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster class NovafileCom(XFSHoster): __name__ = "NovafileCom" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.10" __status__ = "testing" __pattern__ = r'http://(?:www\.)?novafile\.com/\w{12}' @@ -32,6 +32,3 @@ class NovafileCom(XFSHoster): WAIT_PATTERN = r'<p>Please wait <span id="count".*?>(\d+)</span> seconds</p>' LINK_PATTERN = r'<a href="(http://s\d+\.novafile\.com/.*?)" class="btn btn-green">Download File</a>' - - -getInfo = create_getInfo(NovafileCom) diff --git a/module/plugins/hoster/NowDownloadSx.py b/module/plugins/hoster/NowDownloadSx.py index 6737ffc5b..a57e6eb55 100644 --- a/module/plugins/hoster/NowDownloadSx.py +++ b/module/plugins/hoster/NowDownloadSx.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class NowDownloadSx(SimpleHoster): __name__ = "NowDownloadSx" __type__ = "hoster" - __version__ = "0.13" + __version__ = "0.14" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(nowdownload\.[a-zA-Z]{2,}/(dl/|download\.php.+?id=|mobile/(#/files/|.+?id=))|likeupload\.org/)\w+' @@ -62,6 +62,3 @@ class NowDownloadSx(SimpleHoster): m = re.search(self.LINK_FREE_PATTERN, self.data) if m is not None: self.link = m.group(1) - - -getInfo = create_getInfo(NowDownloadSx) diff --git a/module/plugins/hoster/NowVideoSx.py b/module/plugins/hoster/NowVideoSx.py index cc45faf77..a9d7d2a0f 100644 --- a/module/plugins/hoster/NowVideoSx.py +++ b/module/plugins/hoster/NowVideoSx.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class NowVideoSx(SimpleHoster): __name__ = "NowVideoSx" __type__ = "hoster" - __version__ = "0.15" + __version__ = "0.16" __status__ = "testing" __pattern__ = r'http://(?:www\.)?nowvideo\.[a-zA-Z]{2,}/(video/|mobile/(#/videos/|.+?id=))(?P<ID>\w+)' @@ -43,6 +43,3 @@ class NowVideoSx(SimpleHoster): m = re.search(self.LINK_FREE_PATTERN, self.data) if m is not None: self.link = m.group(1) - - -getInfo = create_getInfo(NowVideoSx) diff --git a/module/plugins/hoster/OboomCom.py b/module/plugins/hoster/OboomCom.py index 23340e2ce..bb823256f 100644 --- a/module/plugins/hoster/OboomCom.py +++ b/module/plugins/hoster/OboomCom.py @@ -5,7 +5,7 @@ import re -from module.plugins.internal.utils import json +from module.plugins.internal.misc import json from module.plugins.internal.Hoster import Hoster from module.plugins.captcha.ReCaptcha import ReCaptcha @@ -13,7 +13,7 @@ from module.plugins.captcha.ReCaptcha import ReCaptcha class OboomCom(Hoster): __name__ = "OboomCom" __type__ = "hoster" - __version__ = "0.41" + __version__ = "0.42" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?oboom\.com/(?:#(?:id=|/)?)?(?P<ID>\w{8})' @@ -47,9 +47,7 @@ class OboomCom(Hoster): self.download("http://%s/1.0/dlh" % self.download_domain, get={'ticket': self.download_ticket, 'http_errors': 0}) - def load_url(self, url, get=None): - if get is None: - get = {} + def load_url(self, url, get={}): return json.loads(self.load(url, get)) @@ -67,15 +65,15 @@ class OboomCom(Hoster): else: apiUrl = "http://www.oboom.com/1.0/guestsession" result = self.load_url(apiUrl) - if result[0] == 200: + if result[0] is 200: self.session_token = result[1] else: self.fail(_("Could not retrieve token for guest session. Error code: %s") % result[0]) def solve_captcha(self): - recaptcha = ReCaptcha(self) - response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) + self.captcha = ReCaptcha(self.pyfile) + response, challenge = self.captcha.challenge(self.RECAPTCHA_KEY) apiUrl = "http://www.oboom.com/1.0/download/ticket" params = {'recaptcha_challenge_field': challenge, @@ -85,14 +83,14 @@ class OboomCom(Hoster): result = self.load_url(apiUrl, params) - if result[0] == 200: + if result[0] is 200: self.download_token = result[1] self.download_auth = result[2] self.captcha.correct() self.wait(30) else: - if result[0] == 403: + if result[0] is 403: if result[1] == -1: #: Another download is running self.set_wait(15 * 60) else: @@ -102,7 +100,7 @@ class OboomCom(Hoster): self.wait() self.retry(5) - elif result[0] == 400 and result[1] == "forbidden": + elif result[0] is 400 and result[1] == "forbidden": self.retry(5, 15 * 60, _("Service unavailable")) self.retry_captcha() @@ -113,7 +111,7 @@ class OboomCom(Hoster): params = {'token': token, 'items': fileId, 'http_errors': 0} result = self.load_url(apiUrl, params) - if result[0] == 200: + if result[0] is 200: item = result[1][0] if item['state'] == "online": self.file_size = item['size'] @@ -134,10 +132,10 @@ class OboomCom(Hoster): params['auth'] = self.download_auth result = self.load_url(apiUrl, params) - if result[0] == 200: + if result[0] is 200: self.download_domain = result[1] self.download_ticket = result[2] - elif result[0] == 421: + elif result[0] is 421: self.retry(wait=result[2] + 60, msg=_("Connection limit exceeded")) else: self.fail(_("Could not retrieve download ticket. Error code: %s") % result[0]) diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py index ef6f49da3..953ca2715 100644 --- a/module/plugins/hoster/OneFichierCom.py +++ b/module/plugins/hoster/OneFichierCom.py @@ -3,7 +3,7 @@ import re from module.network.RequestFactory import getURL as get_url -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class OneFichierCom(SimpleHoster): @@ -86,8 +86,6 @@ class OneFichierCom(SimpleHoster): def handle_free(self, pyfile): - self.check_errors() - url, inputs = self.parse_html_form('action="https://1fichier.com/\?[\w^_]+') if not url: @@ -98,7 +96,7 @@ class OneFichierCom(SimpleHoster): inputs['dl_no_ssl'] = "on" - self.data=self.load(url, post=inputs) + self.data = self.load(url, post=inputs) m = re.search(self.LINK_PATTERN, self.data) if m: @@ -106,6 +104,4 @@ class OneFichierCom(SimpleHoster): def handle_premium(self, pyfile): - self.download(pyfile.url, post={'did': 0, 'dl_no_ssl': "on"}, disposition=False) #@TODO: Remove disposition in 0.4.10 - - + self.download(pyfile.url, post={'did': 1, 'dl_no_ssl': "on"}, disposition=False) #@TODO: Remove disposition in 0.4.10 diff --git a/module/plugins/hoster/OpenloadIo.py b/module/plugins/hoster/OpenloadIo.py index 48638bdab..57a7e72b1 100644 --- a/module/plugins/hoster/OpenloadIo.py +++ b/module/plugins/hoster/OpenloadIo.py @@ -3,14 +3,14 @@ import re from module.network.RequestFactory import getURL -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -from module.plugins.internal.utils import json +from module.plugins.internal.SimpleHoster import SimpleHoster +from module.plugins.internal.misc import json class OpenloadIo(SimpleHoster): __name__ = "OpenloadIo" __type__ = "hoster" - __version__ = "0.13" + __version__ = "0.14" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?openload\.(co|io)/(f|embed)/(?P<ID>[\w\-]+)' @@ -67,6 +67,3 @@ class OpenloadIo(SimpleHoster): download_json = self._load_json(self._DOWNLOAD_FILE_URI_PATTERN.format(file_id, ticket)) self.link = download_json['result']['url'] - - -getInfo = create_getInfo(OpenloadIo) diff --git a/module/plugins/hoster/OronCom.py b/module/plugins/hoster/OronCom.py index 0be85d6fd..6fac2d014 100644 --- a/module/plugins/hoster/OronCom.py +++ b/module/plugins/hoster/OronCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class OronCom(DeadHoster): __name__ = "OronCom" __type__ = "hoster" - __version__ = "0.17" + __version__ = "0.18" __status__ = "stable" __pattern__ = r'https?://(?:www\.)?oron\.com/\w{12}' @@ -16,6 +16,3 @@ class OronCom(DeadHoster): __license__ = "GPLv3" __authors__ = [("chrox", "chrox@pyload.org"), ("DHMH", "DHMH@pyload.org")] - - -getInfo = create_getInfo(OronCom) diff --git a/module/plugins/hoster/OverLoadMe.py b/module/plugins/hoster/OverLoadMe.py index f3c04b516..07d906b15 100644 --- a/module/plugins/hoster/OverLoadMe.py +++ b/module/plugins/hoster/OverLoadMe.py @@ -3,14 +3,14 @@ import re import urllib -from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -from module.plugins.internal.utils import json, parse_size +from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.misc import json, parse_size class OverLoadMe(MultiHoster): __name__ = "OverLoadMe" __type__ = "hoster" - __version__ = "0.16" + __version__ = "0.17" __status__ = "testing" __pattern__ = r'https?://.*overload\.me/.+' @@ -40,7 +40,7 @@ class OverLoadMe(MultiHoster): self.log_debug(data) - if data['error'] == 1: + if data['error'] is 1: self.log_warning(data['msg']) self.temp_offline() else: @@ -48,6 +48,3 @@ class OverLoadMe(MultiHoster): if pyfile.name and pyfile.name.endswith('.tmp') and data['filename']: pyfile.name = data['filename'] pyfile.size = parse_size(data['filesize']) - - -getInfo = create_getInfo(OverLoadMe) diff --git a/module/plugins/hoster/PandaplaNet.py b/module/plugins/hoster/PandaplaNet.py index 0a6e499ee..ebc0fdaa7 100644 --- a/module/plugins/hoster/PandaplaNet.py +++ b/module/plugins/hoster/PandaplaNet.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class PandaplaNet(DeadHoster): __name__ = "PandaplaNet" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.07" __status__ = "stable" __pattern__ = r'http://(?:www\.)?pandapla\.net/\w{12}' @@ -15,6 +15,3 @@ class PandaplaNet(DeadHoster): __description__ = """Pandapla.net hoster plugin""" __license__ = "GPLv3" __authors__ = [("t4skforce", "t4skforce1337[AT]gmail[DOT]com")] - - -getInfo = create_getInfo(PandaplaNet) diff --git a/module/plugins/hoster/PornhostCom.py b/module/plugins/hoster/PornhostCom.py index a5f11e7fa..0f0291f76 100644 --- a/module/plugins/hoster/PornhostCom.py +++ b/module/plugins/hoster/PornhostCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.Hoster import Hoster class PornhostCom(Hoster): __name__ = "PornhostCom" __type__ = "hoster" - __version__ = "0.24" + __version__ = "0.25" __status__ = "testing" __pattern__ = r'http://(?:www\.)?pornhost\.com/(\d+/\d+\.html|\d+)' diff --git a/module/plugins/hoster/PornhubCom.py b/module/plugins/hoster/PornhubCom.py index c3a734037..e93f765ad 100644 --- a/module/plugins/hoster/PornhubCom.py +++ b/module/plugins/hoster/PornhubCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.Hoster import Hoster class PornhubCom(Hoster): __name__ = "PornhubCom" __type__ = "hoster" - __version__ = "0.54" + __version__ = "0.55" __status__ = "testing" __pattern__ = r'http://(?:www\.)?pornhub\.com/view_video\.php\?viewkey=\w+' diff --git a/module/plugins/hoster/PotloadCom.py b/module/plugins/hoster/PotloadCom.py index 8eaca6ebe..7d8cdb5cc 100644 --- a/module/plugins/hoster/PotloadCom.py +++ b/module/plugins/hoster/PotloadCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class PotloadCom(DeadHoster): __name__ = "PotloadCom" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __status__ = "stable" __pattern__ = r'http://(?:www\.)?potload\.com/\w{12}' @@ -15,6 +15,3 @@ class PotloadCom(DeadHoster): __description__ = """Potload.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] - - -getInfo = create_getInfo(PotloadCom) diff --git a/module/plugins/hoster/PremiumTo.py b/module/plugins/hoster/PremiumTo.py index 9f005efe0..d550c91bd 100644 --- a/module/plugins/hoster/PremiumTo.py +++ b/module/plugins/hoster/PremiumTo.py @@ -4,14 +4,14 @@ from __future__ import with_statement import os -from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -from module.plugins.internal.utils import encode +from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.misc import encode class PremiumTo(MultiHoster): __name__ = "PremiumTo" __type__ = "hoster" - __version__ = "0.28" + __version__ = "0.29" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -42,21 +42,20 @@ class PremiumTo(MultiHoster): def check_download(self): - if self.check_file({'nopremium': "No premium account available"}): + if self.scan_download({'nopremium': "No premium account available"}): self.retry(60, 5 * 60, "No premium account available") err = "" if self.req.http.code == "420": #: Custom error code send - fail file = encode(self.last_download) + with open(file, "rb") as f: err = f.read(256).strip() - os.remove(file) + + self.remove(file) if err: self.fail(err) return super(PremiumTo, self).check_download() - - -getInfo = create_getInfo(PremiumTo) diff --git a/module/plugins/hoster/PremiumizeMe.py b/module/plugins/hoster/PremiumizeMe.py index eeb002cb0..1f98aa0fe 100644 --- a/module/plugins/hoster/PremiumizeMe.py +++ b/module/plugins/hoster/PremiumizeMe.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -from module.plugins.internal.utils import json +from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.misc import json class PremiumizeMe(MultiHoster): __name__ = "PremiumizeMe" __type__ = "hoster" - __version__ = "0.23" + __version__ = "0.24" __status__ = "testing" __pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.activate @@ -38,16 +38,17 @@ class PremiumizeMe(MultiHoster): user, info = self.account.select() #: Get rewritten link using the premiumize.me api v1 (see https://secure.premiumize.me/?show=api) - data = json.loads(self.load("http://api.premiumize.me/pm-api/v1.php", #@TODO: Revert to `https` in 0.4.10 - get={'method' : "directdownloadlink", - 'params[login]': user, - 'params[pass]' : info['login']['password'], - 'params[link]' : pyfile.url})) + html = self.load("http://api.premiumize.me/pm-api/v1.php", #@TODO: Revert to `https` in 0.4.10 + get={'method' : "directdownloadlink", + 'params[login]': user, + 'params[pass]' : info['login']['password'], + 'params[link]' : pyfile.url}) + data = json.loads(html) #: Check status and decide what to do status = data['status'] - if status == 200: + if status is 200: if 'filename' in data['result']: self.pyfile.name = data['result']['filename'] @@ -57,10 +58,10 @@ class PremiumizeMe(MultiHoster): self.link = data['result']['location'] return - elif status == 400: + elif status is 400: self.fail(_("Invalid url")) - elif status == 404: + elif status is 404: self.offline() elif status >= 500: @@ -68,6 +69,3 @@ class PremiumizeMe(MultiHoster): else: self.fail(data['statusmessage']) - - -getInfo = create_getInfo(PremiumizeMe) diff --git a/module/plugins/hoster/PromptfileCom.py b/module/plugins/hoster/PromptfileCom.py index 6f92dcea2..c674f19f5 100644 --- a/module/plugins/hoster/PromptfileCom.py +++ b/module/plugins/hoster/PromptfileCom.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class PromptfileCom(SimpleHoster): __name__ = "PromptfileCom" __type__ = "hoster" - __version__ = "0.16" + __version__ = "0.17" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?promptfile\.com/' @@ -44,6 +44,3 @@ class PromptfileCom(SimpleHoster): #: STAGE 2: get the direct link return super(PromptfileCom, self).handle_free(pyfile) - - -getInfo = create_getInfo(PromptfileCom) diff --git a/module/plugins/hoster/PrzeklejPl.py b/module/plugins/hoster/PrzeklejPl.py index 5c8e66194..f8a67097e 100644 --- a/module/plugins/hoster/PrzeklejPl.py +++ b/module/plugins/hoster/PrzeklejPl.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class PrzeklejPl(DeadHoster): __name__ = "PrzeklejPl" __type__ = "hoster" - __version__ = "0.14" + __version__ = "0.15" __status__ = "stable" __pattern__ = r'http://(?:www\.)?przeklej\.pl/plik/.+' @@ -15,6 +15,3 @@ class PrzeklejPl(DeadHoster): __description__ = """Przeklej.pl hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - -getInfo = create_getInfo(PrzeklejPl) diff --git a/module/plugins/hoster/PutdriveCom.py b/module/plugins/hoster/PutdriveCom.py index eabb42e4d..cd81183ea 100644 --- a/module/plugins/hoster/PutdriveCom.py +++ b/module/plugins/hoster/PutdriveCom.py @@ -6,7 +6,7 @@ from module.plugins.hoster.ZeveraCom import ZeveraCom class PutdriveCom(ZeveraCom): __name__ = "PutdriveCom" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __pattern__ = r'https?://(?:www\.)putdrive\.com/(getFiles\.ashx|Members/download\.ashx)\?.*ourl=.+' diff --git a/module/plugins/hoster/QuickshareCz.py b/module/plugins/hoster/QuickshareCz.py index abcd24d1e..49a55c6b1 100644 --- a/module/plugins/hoster/QuickshareCz.py +++ b/module/plugins/hoster/QuickshareCz.py @@ -1,15 +1,14 @@ # -*- coding: utf-8 -*- -import pycurl import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class QuickshareCz(SimpleHoster): __name__ = "QuickshareCz" __type__ = "hoster" - __version__ = "0.60" + __version__ = "0.61" __status__ = "testing" __pattern__ = r'http://(?:[^/]*\.)?quickshare\.cz/stahnout-soubor/.+' @@ -54,7 +53,7 @@ class QuickshareCz(SimpleHoster): else: self.handle_free(pyfile) - if self.check_file({'error': re.compile(r"\AChyba!")}, max_size=100): + if self.scan_download({'error': re.compile(r"\AChyba!")}, read_size=100): self.fail(_("File not m or plugin defect")) @@ -88,6 +87,3 @@ class QuickshareCz(SimpleHoster): download_url = '%s/download_premium.php' % self.jsvars['server'] data = dict((x, self.jsvars[x]) for x in self.jsvars if x in ("ID1", "ID2", "ID4", "ID5")) self.download(download_url, get=data) - - -getInfo = create_getInfo(QuickshareCz) diff --git a/module/plugins/hoster/RPNetBiz.py b/module/plugins/hoster/RPNetBiz.py index 72efe9914..a662db101 100644 --- a/module/plugins/hoster/RPNetBiz.py +++ b/module/plugins/hoster/RPNetBiz.py @@ -2,14 +2,14 @@ import re -from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -from module.plugins.internal.utils import json +from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.misc import json class RPNetBiz(MultiHoster): __name__ = "RPNetBiz" __type__ = "hoster" - __version__ = "0.19" + __version__ = "0.20" __status__ = "testing" __pattern__ = r'https?://.+rpnet\.biz' @@ -79,6 +79,3 @@ class RPNetBiz(MultiHoster): self.fail(link_status['error']) else: self.fail(_("Something went wrong, not supposed to enter here")) - - -getInfo = create_getInfo(RPNetBiz) diff --git a/module/plugins/hoster/RapideoPl.py b/module/plugins/hoster/RapideoPl.py index e0cc2c6d3..fc62c4b34 100644 --- a/module/plugins/hoster/RapideoPl.py +++ b/module/plugins/hoster/RapideoPl.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -from module.plugins.internal.utils import json +from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.misc import json class RapideoPl(MultiHoster): __name__ = "RapideoPl" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -103,6 +103,3 @@ class RapideoPl(MultiHoster): except Exception: self.temp_offline("Query error #2") - - -getInfo = create_getInfo(RapideoPl) diff --git a/module/plugins/hoster/RapidfileshareNet.py b/module/plugins/hoster/RapidfileshareNet.py index 546e17a8d..d8f2a5a9e 100644 --- a/module/plugins/hoster/RapidfileshareNet.py +++ b/module/plugins/hoster/RapidfileshareNet.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster class RapidfileshareNet(XFSHoster): __name__ = "RapidfileshareNet" __type__ = "hoster" - __version__ = "0.07" + __version__ = "0.08" __status__ = "testing" __pattern__ = r'http://(?:www\.)?rapidfileshare\.net/\w{12}' @@ -28,6 +28,3 @@ class RapidfileshareNet(XFSHoster): OFFLINE_PATTERN = r'>No such file with this filename' TEMP_OFFLINE_PATTERN = r'The page may have been renamed, removed or be temporarily unavailable.<' - - -getInfo = create_getInfo(RapidfileshareNet) diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py index 150aec221..27fb4fda0 100644 --- a/module/plugins/hoster/RapidgatorNet.py +++ b/module/plugins/hoster/RapidgatorNet.py @@ -1,20 +1,21 @@ # -*- coding: utf-8 -*- -import pycurl import re -from module.plugins.internal.utils import json +import pycurl + from module.network.HTTPRequest import BadHeader from module.plugins.captcha.AdsCaptcha import AdsCaptcha from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.captcha.SolveMedia import SolveMedia -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster +from module.plugins.internal.misc import json class RapidgatorNet(SimpleHoster): __name__ = "RapidgatorNet" __type__ = "hoster" - __version__ = "0.38" + __version__ = "0.39" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(rapidgator\.net|rg\.to)/file/\w+' @@ -72,19 +73,19 @@ class RapidgatorNet(SimpleHoster): get={'sid': self.sid, 'url': self.pyfile.url}) self.log_debug("API:%s" % cmd, html, "SID: %s" % self.sid) - jso = json.loads(html) - status = jso['response_status'] - msg = jso['response_details'] + json_data = json.loads(html) + status = json_data['response_status'] + msg = json_data['response_details'] except BadHeader, e: self.log_error("API: %s" % cmd, e, "SID: %s" % self.sid) status = e.code msg = e - if status == 200: - return jso['response'] + if status is 200: + return json_data['response'] - elif status == 423: + elif status is 423: self.account.empty() self.retry() @@ -149,9 +150,10 @@ class RapidgatorNet(SimpleHoster): def handle_captcha(self): for klass in (AdsCaptcha, ReCaptcha, SolveMedia): - inst = klass(self) - if inst.detect_key(): - return inst + captcha = klass(self.pyfile) + if captcha.detect_key(): + self.captcha = captcha + return captcha def get_json_response(self, url): @@ -160,6 +162,3 @@ class RapidgatorNet(SimpleHoster): self.retry() self.log_debug(url, res) return json.loads(res) - - -getInfo = create_getInfo(RapidgatorNet) diff --git a/module/plugins/hoster/RapiduNet.py b/module/plugins/hoster/RapiduNet.py index 09910de69..dea828274 100644 --- a/module/plugins/hoster/RapiduNet.py +++ b/module/plugins/hoster/RapiduNet.py @@ -1,18 +1,18 @@ # -*- coding: utf-8 -*- -import pycurl import re import time -from module.plugins.internal.utils import json -from module.plugins.captcha.ReCaptcha import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +import pycurl +from module.plugins.captcha.ReCaptcha import ReCaptcha +from module.plugins.internal.SimpleHoster import SimpleHoster +from module.plugins.internal.misc import json class RapiduNet(SimpleHoster): __name__ = "RapiduNet" __type__ = "hoster" - __version__ = "0.12" + __version__ = "0.13" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?rapidu\.net/(?P<ID>\d{10})' @@ -60,8 +60,8 @@ class RapiduNet(SimpleHoster): else: self.wait(int(jsvars['timeToDownload']) - int(time.time())) - recaptcha = ReCaptcha(self) - response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) + self.captcha = ReCaptcha(pyfile) + response, challenge = self.captcha.challenge(self.RECAPTCHA_KEY) jsvars = self.get_json_response("https://rapidu.net/ajax.php", get={'a': "getCheckCaptcha"}, @@ -82,6 +82,3 @@ class RapiduNet(SimpleHoster): self.log_debug(res) return json.loads(res) - - -getInfo = create_getInfo(RapiduNet) diff --git a/module/plugins/hoster/RarefileNet.py b/module/plugins/hoster/RarefileNet.py index c9ea75cb1..390063d10 100644 --- a/module/plugins/hoster/RarefileNet.py +++ b/module/plugins/hoster/RarefileNet.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster class RarefileNet(XFSHoster): __name__ = "RarefileNet" __type__ = "hoster" - __version__ = "0.13" + __version__ = "0.14" __status__ = "testing" __pattern__ = r'http://(?:www\.)?rarefile\.net/\w{12}' @@ -26,6 +26,3 @@ class RarefileNet(XFSHoster): PLUGIN_DOMAIN = "rarefile.net" LINK_PATTERN = r'<a href="(.+?)">\1</a>' - - -getInfo = create_getInfo(RarefileNet) diff --git a/module/plugins/hoster/RealdebridCom.py b/module/plugins/hoster/RealdebridCom.py index a8d2f7da1..41208df89 100644 --- a/module/plugins/hoster/RealdebridCom.py +++ b/module/plugins/hoster/RealdebridCom.py @@ -4,14 +4,14 @@ import re import time import urllib -from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -from module.plugins.internal.utils import json, parse_size +from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.misc import json, parse_size class RealdebridCom(MultiHoster): __name__ = "RealdebridCom" __type__ = "hoster" - __version__ = "0.71" + __version__ = "0.72" __status__ = "testing" __pattern__ = r'https?://((?:www\.|s\d+\.)?real-debrid\.com/dl/|[\w^_]\.rdb\.so/d/)[\w^_]+' @@ -32,15 +32,16 @@ class RealdebridCom(MultiHoster): def handle_premium(self, pyfile): - data = json.loads(self.load("https://real-debrid.com/ajax/unrestrict.php", - get={'lang' : "en", - 'link' : pyfile.url, - 'password': self.get_password(), - 'time' : int(time.time() * 1000)})) + html = self.load("https://real-debrid.com/ajax/unrestrict.php", + get={'lang' : "en", + 'link' : pyfile.url, + 'password': self.get_password(), + 'time' : int(time.time() * 1000)}) + data = json.loads(html) self.log_debug("Returned Data: %s" % data) - if data['error'] != 0: + if data['error'] is not 0: if data['message'] == "Your file is unavailable on the hoster.": self.offline() else: @@ -51,6 +52,3 @@ class RealdebridCom(MultiHoster): pyfile.name = data['file_name'] pyfile.size = parse_size(data['file_size']) self.link = data['generated_links'][0][-1] - - -getInfo = create_getInfo(RealdebridCom) diff --git a/module/plugins/hoster/RedtubeCom.py b/module/plugins/hoster/RedtubeCom.py index 751458f9f..f236b4f4d 100644 --- a/module/plugins/hoster/RedtubeCom.py +++ b/module/plugins/hoster/RedtubeCom.py @@ -3,13 +3,13 @@ import re from module.plugins.internal.Hoster import Hoster -from module.plugins.internal.utils import html_unescape +from module.plugins.internal.misc import html_unescape class RedtubeCom(Hoster): __name__ = "RedtubeCom" __type__ = "hoster" - __version__ = "0.24" + __version__ = "0.25" __status__ = "testing" __pattern__ = r'http://(?:www\.)?redtube\.com/\d+' diff --git a/module/plugins/hoster/RehostTo.py b/module/plugins/hoster/RehostTo.py index 011a79c79..2ec62274a 100644 --- a/module/plugins/hoster/RehostTo.py +++ b/module/plugins/hoster/RehostTo.py @@ -2,13 +2,13 @@ import urllib -from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo +from module.plugins.internal.MultiHoster import MultiHoster class RehostTo(MultiHoster): __name__ = "RehostTo" __type__ = "hoster" - __version__ = "0.26" + __version__ = "0.27" __status__ = "testing" __pattern__ = r'https?://.*rehost\.to\..+' @@ -30,6 +30,3 @@ class RehostTo(MultiHoster): 'pass': self.account.get_data('session'), 'dl' : pyfile.url}, disposition=True) - - -getInfo = create_getInfo(RehostTo) diff --git a/module/plugins/hoster/RemixshareCom.py b/module/plugins/hoster/RemixshareCom.py index 90fe3a26f..76fcc17a5 100644 --- a/module/plugins/hoster/RemixshareCom.py +++ b/module/plugins/hoster/RemixshareCom.py @@ -10,13 +10,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class RemixshareCom(SimpleHoster): __name__ = "RemixshareCom" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __pattern__ = r'https?://remixshare\.com/(download|dl)/\w+' @@ -34,7 +34,7 @@ class RemixshareCom(SimpleHoster): INFO_PATTERN = r'title=\'.+?\'>(?P<N>.+?)</span><span class=\'light2\'> \((?P<S>\d+) (?P<U>[\w^_]+)\)<' - HASHSUM_PATTERN = r'>(?P<T>MD5): (?P<H>\w+)' + HASHSUM_PATTERN = r'>(?P<H>MD5): (?P<D>\w+)' OFFLINE_PATTERN = r'<h1>Ooops!' LINK_PATTERN = r'var uri = "(.+?)"' @@ -58,6 +58,3 @@ class RemixshareCom(SimpleHoster): self.error(_("File token")) self.link = b.group(1) + "/zzz/" + c.group(1) - - -getInfo = create_getInfo(RemixshareCom) diff --git a/module/plugins/hoster/RgHostNet.py b/module/plugins/hoster/RgHostNet.py index dc4aeb6a3..29da1de23 100644 --- a/module/plugins/hoster/RgHostNet.py +++ b/module/plugins/hoster/RgHostNet.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class RgHostNet(SimpleHoster): __name__ = "RgHostNet" __type__ = "hoster" - __version__ = "0.07" + __version__ = "0.08" __status__ = "testing" __pattern__ = r'http://(?:www\.)?rghost\.(net|ru)/[\d\-]+' @@ -24,10 +24,7 @@ class RgHostNet(SimpleHoster): INFO_PATTERN = r'data-share42-text="(?P<N>.+?) \((?P<S>[\d.,]+) (?P<U>[\w^_]+)' - HASHSUM_PATTERN = r'<dt>(?P<T>\w+)</dt>\s*<dd>(?P<H>\w+)' + HASHSUM_PATTERN = r'<dt>(?P<H>\w+)</dt>\s*<dd>(?P<D>\w+)' OFFLINE_PATTERN = r'>(File is deleted|page not found)' LINK_FREE_PATTERN = r'<a href="(.+?)" class="btn large' - - -getInfo = create_getInfo(RgHostNet) diff --git a/module/plugins/hoster/RyushareCom.py b/module/plugins/hoster/RyushareCom.py index 392b18348..16619d604 100644 --- a/module/plugins/hoster/RyushareCom.py +++ b/module/plugins/hoster/RyushareCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class RyushareCom(DeadHoster): @@ -17,6 +17,3 @@ class RyushareCom(DeadHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), ("stickell", "l.stickell@yahoo.it"), ("quareevo", "quareevo@arcor.de" )] - - -getInfo = create_getInfo(RyushareCom) diff --git a/module/plugins/hoster/SafesharingEu.py b/module/plugins/hoster/SafesharingEu.py index 0de0e9556..cdcf00e88 100644 --- a/module/plugins/hoster/SafesharingEu.py +++ b/module/plugins/hoster/SafesharingEu.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster class SafesharingEu(XFSHoster): __name__ = "SafesharingEu" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.10" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?safesharing\.eu/\w{12}' @@ -24,6 +24,3 @@ class SafesharingEu(XFSHoster): PLUGIN_DOMAIN = "safesharing.eu" ERROR_PATTERN = r'(?:<div class="alert alert-danger">)(.+?)(?:</div>)' - - -getInfo = create_getInfo(SafesharingEu) diff --git a/module/plugins/hoster/SecureUploadEu.py b/module/plugins/hoster/SecureUploadEu.py index b94e7e5dc..30b5ac84f 100644 --- a/module/plugins/hoster/SecureUploadEu.py +++ b/module/plugins/hoster/SecureUploadEu.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster class SecureUploadEu(XFSHoster): __name__ = "SecureUploadEu" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.10" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?secureupload\.eu/\w{12}' @@ -24,6 +24,3 @@ class SecureUploadEu(XFSHoster): PLUGIN_DOMAIN = "secureupload.eu" INFO_PATTERN = r'<h3>Downloading (?P<N>[^<]+) \((?P<S>[^<]+)\)</h3>' - - -getInfo = create_getInfo(SecureUploadEu) diff --git a/module/plugins/hoster/SendspaceCom.py b/module/plugins/hoster/SendspaceCom.py index 84a5949c6..cff63179e 100644 --- a/module/plugins/hoster/SendspaceCom.py +++ b/module/plugins/hoster/SendspaceCom.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class SendspaceCom(SimpleHoster): __name__ = "SendspaceCom" __type__ = "hoster" - __version__ = "0.20" + __version__ = "0.21" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?sendspace\.com/file/\w+' @@ -59,6 +59,3 @@ class SendspaceCom(SimpleHoster): self.retry_captcha() else: self.link = m.group(1) - - -getInfo = create_getInfo(SendspaceCom) diff --git a/module/plugins/hoster/Share4WebCom.py b/module/plugins/hoster/Share4WebCom.py index 5bd3e60da..5f2957b9c 100644 --- a/module/plugins/hoster/Share4WebCom.py +++ b/module/plugins/hoster/Share4WebCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.hoster.UnibytesCom import UnibytesCom, create_getInfo +from module.plugins.hoster.UnibytesCom import UnibytesCom class Share4WebCom(UnibytesCom): __name__ = "Share4WebCom" __type__ = "hoster" - __version__ = "0.15" + __version__ = "0.16" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?share4web\.com/get/\w+' @@ -18,6 +18,3 @@ class Share4WebCom(UnibytesCom): PLUGIN_DOMAIN = "share4web.com" - - -getInfo = create_getInfo(Share4WebCom) diff --git a/module/plugins/hoster/Share76Com.py b/module/plugins/hoster/Share76Com.py index 427a2f925..1d2590193 100644 --- a/module/plugins/hoster/Share76Com.py +++ b/module/plugins/hoster/Share76Com.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class Share76Com(DeadHoster): __name__ = "Share76Com" __type__ = "hoster" - __version__ = "0.07" + __version__ = "0.08" __status__ = "stable" __pattern__ = r'http://(?:www\.)?share76\.com/\w{12}' @@ -15,6 +15,3 @@ class Share76Com(DeadHoster): __description__ = """Share76.com hoster plugin""" __license__ = "GPLv3" __authors__ = [] - - -getInfo = create_getInfo(Share76Com) diff --git a/module/plugins/hoster/ShareFilesCo.py b/module/plugins/hoster/ShareFilesCo.py index ed24de6d4..a924b0bfe 100644 --- a/module/plugins/hoster/ShareFilesCo.py +++ b/module/plugins/hoster/ShareFilesCo.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class ShareFilesCo(DeadHoster): __name__ = "ShareFilesCo" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __status__ = "stable" __pattern__ = r'http://(?:www\.)?sharefiles\.co/\w{12}' @@ -15,6 +15,3 @@ class ShareFilesCo(DeadHoster): __description__ = """Sharefiles.co hoster plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] - - -getInfo = create_getInfo(ShareFilesCo) diff --git a/module/plugins/hoster/SharebeesCom.py b/module/plugins/hoster/SharebeesCom.py index 38b1bcf33..178073941 100644 --- a/module/plugins/hoster/SharebeesCom.py +++ b/module/plugins/hoster/SharebeesCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class SharebeesCom(DeadHoster): __name__ = "SharebeesCom" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __status__ = "stable" __pattern__ = r'http://(?:www\.)?sharebees\.com/\w{12}' @@ -15,6 +15,3 @@ class SharebeesCom(DeadHoster): __description__ = """ShareBees hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - -getInfo = create_getInfo(SharebeesCom) diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 06c9f6cfe..6205d6950 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -6,7 +6,7 @@ import urllib from module.network.RequestFactory import getURL as get_url from module.plugins.captcha.ReCaptcha import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class ShareonlineBiz(SimpleHoster): @@ -68,8 +68,8 @@ class ShareonlineBiz(SimpleHoster): def handle_captcha(self): - recaptcha = ReCaptcha(self) - response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) + self.captcha = ReCaptcha(self.pyfile) + response, challenge = self.captcha.challenge(self.RECAPTCHA_KEY) m = re.search(r'var wait=(\d+);', self.data) self.set_wait(int(m.group(1)) if m else 30) @@ -103,8 +103,8 @@ class ShareonlineBiz(SimpleHoster): def check_download(self): - check = self.check_file({'cookie': re.compile(r'<div id="dl_failure"'), - 'fail' : re.compile(r"<title>Share-Online")}) + check = self.scan_download({'cookie': re.compile(r'<div id="dl_failure"'), + 'fail' : re.compile(r"<title>Share-Online")}) if check == "cookie": self.retry_captcha(5, 60, _("Cookie failure")) @@ -181,6 +181,3 @@ class ShareonlineBiz(SimpleHoster): else: self.wait(60, reconnect=True) self.restart(errmsg) - - -getInfo = create_getInfo(ShareonlineBiz) diff --git a/module/plugins/hoster/ShareplaceCom.py b/module/plugins/hoster/ShareplaceCom.py index 126d441b9..75cd7ecfb 100644 --- a/module/plugins/hoster/ShareplaceCom.py +++ b/module/plugins/hoster/ShareplaceCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.Hoster import Hoster class ShareplaceCom(Hoster): __name__ = "ShareplaceCom" __type__ = "hoster" - __version__ = "0.16" + __version__ = "0.17" __status__ = "testing" __pattern__ = r'http://(?:www\.)?shareplace\.(com|org)/\?\w+' diff --git a/module/plugins/hoster/SharingmatrixCom.py b/module/plugins/hoster/SharingmatrixCom.py index 95264a55e..b51d19437 100644 --- a/module/plugins/hoster/SharingmatrixCom.py +++ b/module/plugins/hoster/SharingmatrixCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class SharingmatrixCom(DeadHoster): __name__ = "SharingmatrixCom" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" __status__ = "stable" __pattern__ = r'http://(?:www\.)?sharingmatrix\.com/file/\w+' @@ -16,6 +16,3 @@ class SharingmatrixCom(DeadHoster): __license__ = "GPLv3" __authors__ = [("jeix", "jeix@hasnomail.de"), ("paulking", None)] - - -getInfo = create_getInfo(SharingmatrixCom) diff --git a/module/plugins/hoster/ShragleCom.py b/module/plugins/hoster/ShragleCom.py index 61f7f427d..910925af5 100644 --- a/module/plugins/hoster/ShragleCom.py +++ b/module/plugins/hoster/ShragleCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class ShragleCom(DeadHoster): __name__ = "ShragleCom" __type__ = "hoster" - __version__ = "0.25" + __version__ = "0.26" __status__ = "stable" __pattern__ = r'http://(?:www\.)?(cloudnator|shragle)\.com/files/(?P<ID>.+?)/' @@ -16,6 +16,3 @@ class ShragleCom(DeadHoster): __license__ = "GPLv3" __authors__ = [("RaNaN", "RaNaN@pyload.org"), ("zoidberg", "zoidberg@mujmail.cz")] - - -getInfo = create_getInfo(ShragleCom) diff --git a/module/plugins/hoster/SimplyPremiumCom.py b/module/plugins/hoster/SimplyPremiumCom.py index debf8c33d..835aa357e 100644 --- a/module/plugins/hoster/SimplyPremiumCom.py +++ b/module/plugins/hoster/SimplyPremiumCom.py @@ -2,14 +2,14 @@ import re -from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -from module.plugins.internal.utils import seconds_to_midnight +from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.misc import seconds_to_midnight class SimplyPremiumCom(MultiHoster): __name__ = "SimplyPremiumCom" __type__ = "hoster" - __version__ = "0.14" + __version__ = "0.15" __status__ = "testing" __pattern__ = r'https?://.+simply-premium\.com' @@ -81,6 +81,3 @@ class SimplyPremiumCom(MultiHoster): except AttributeError: self.link = 'http://www.simply-premium.com/premium.php?link=' + self.pyfile.url - - -getInfo = create_getInfo(SimplyPremiumCom) diff --git a/module/plugins/hoster/SimplydebridCom.py b/module/plugins/hoster/SimplydebridCom.py index c05cd197b..732c022fa 100644 --- a/module/plugins/hoster/SimplydebridCom.py +++ b/module/plugins/hoster/SimplydebridCom.py @@ -2,14 +2,14 @@ import re -from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -from module.plugins.internal.utils import replace_patterns +from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.misc import replace_patterns class SimplydebridCom(MultiHoster): __name__ = "SimplydebridCom" __type__ = "hoster" - __version__ = "0.23" + __version__ = "0.24" __status__ = "testing" __pattern__ = r'http://\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/sd\.php' @@ -47,10 +47,7 @@ class SimplydebridCom(MultiHoster): def check_download(self): - if self.check_file({'error': "No address associated with hostname"}): + if self.scan_download({'error': "No address associated with hostname"}): self.retry(24, 3 * 60, _("Bad file downloaded")) return super(SimplydebridCom, self).check_download() - - -getInfo = create_getInfo(SimplydebridCom) diff --git a/module/plugins/hoster/SizedriveCom.py b/module/plugins/hoster/SizedriveCom.py index 24a019f02..666cc7442 100644 --- a/module/plugins/hoster/SizedriveCom.py +++ b/module/plugins/hoster/SizedriveCom.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class SizedriveCom(SimpleHoster): __name__ = "SizedriveCom" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __pattern__ = r'http://(?:www\.)?sizedrive\.com/[rd]/(?P<ID>\w+)' @@ -42,6 +42,3 @@ class SizedriveCom(SimpleHoster): m = re.search(r'<span id="boton_download" ><a href="(.+?)"', self.data) if m is not None: self.link = m.group(1) - - -getInfo = create_getInfo(SizedriveCom) diff --git a/module/plugins/hoster/SmoozedCom.py b/module/plugins/hoster/SmoozedCom.py index fbacac570..c2cc1f987 100644 --- a/module/plugins/hoster/SmoozedCom.py +++ b/module/plugins/hoster/SmoozedCom.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -from module.plugins.internal.utils import json +from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.internal.misc import json class SmoozedCom(MultiHoster): __name__ = "SmoozedCom" __type__ = "hoster" - __version__ = "0.12" + __version__ = "0.13" __status__ = "testing" __pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.activate @@ -43,7 +43,8 @@ class SmoozedCom(MultiHoster): get_data = {'session_key': self.account.get_data('session'), 'url' : pyfile.url} - data = json.loads(self.load("http://www2.smoozed.com/api/check", get=get_data)) + html = self.load("http://www2.smoozed.com/api/check", get=get_data) + data = json.loads(html) if data['state'] != "ok": self.fail(data['message']) @@ -64,6 +65,3 @@ class SmoozedCom(MultiHoster): self.fail(_("Unable to initialize download")) else: self.link = header.get('location')[-1] if isinstance(header.get('location'), list) else header.get('location') - - -getInfo = create_getInfo(SmoozedCom) diff --git a/module/plugins/hoster/SockshareCom.py b/module/plugins/hoster/SockshareCom.py index 4fd476122..4f880058d 100644 --- a/module/plugins/hoster/SockshareCom.py +++ b/module/plugins/hoster/SockshareCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class SockshareCom(DeadHoster): __name__ = "SockshareCom" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.09" __status__ = "stable" __pattern__ = r'http://(?:www\.)?sockshare\.com/(mobile/)?(file|embed)/(?P<ID>\w+)' @@ -17,6 +17,3 @@ class SockshareCom(DeadHoster): __authors__ = [("jeix", "jeix@hasnomail.de"), ("stickell", "l.stickell@yahoo.it"), ("Walter Purcaro", "vuolter@gmail.com")] - - -getInfo = create_getInfo(SockshareCom) diff --git a/module/plugins/hoster/SolidfilesCom.py b/module/plugins/hoster/SolidfilesCom.py index e9f7d4f68..b73198e9e 100644 --- a/module/plugins/hoster/SolidfilesCom.py +++ b/module/plugins/hoster/SolidfilesCom.py @@ -3,13 +3,13 @@ # Test links: # http://www.solidfiles.com/d/609cdb4b1b -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class SolidfilesCom(SimpleHoster): __name__ = "SolidfilesCom" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __pattern__ = r'http://(?:www\.)?solidfiles\.com\/d/\w+' @@ -34,6 +34,3 @@ class SolidfilesCom(SimpleHoster): def setup(self): self.multiDL = True self.chunk_limit = 1 - - -getInfo = create_getInfo(SolidfilesCom) diff --git a/module/plugins/hoster/SoundcloudCom.py b/module/plugins/hoster/SoundcloudCom.py index 258b63d75..854e98d54 100644 --- a/module/plugins/hoster/SoundcloudCom.py +++ b/module/plugins/hoster/SoundcloudCom.py @@ -2,14 +2,14 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -from module.plugins.internal.utils import json +from module.plugins.internal.SimpleHoster import SimpleHoster +from module.plugins.internal.misc import json class SoundcloudCom(SimpleHoster): __name__ = "SoundcloudCom" __type__ = "hoster" - __version__ = "0.14" + __version__ = "0.15" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?soundcloud\.com/[\w\-]+/[\w\-]+' @@ -42,8 +42,9 @@ class SoundcloudCom(SimpleHoster): client_id = "b45b1aa10f1ac2941910a7f0d10f8e28" #: Url to retrieve the actual song url - streams = json.loads(self.load("https://api.soundcloud.com/tracks/%s/streams" % song_id, - get={'client_id': client_id})) + html = self.load("https://api.soundcloud.com/tracks/%s/streams" % song_id, + get={'client_id': client_id}) + streams = json.loads(html) regex = re.compile(r'[^\d]') http_streams = sorted([(key, value) for key, value in streams.items() if key.startswith('http_')], @@ -53,8 +54,5 @@ class SoundcloudCom(SimpleHoster): self.log_debug("Streams found: %s" % (http_streams or "None")) if http_streams: - stream_name, self.link = http_streams[0 if self.get_config('quality') == "Higher" else -1] + stream_name, self.link = http_streams[0 if self.config.get('quality') == "Higher" else -1] pyfile.name += '.' + stream_name.split('_')[1].lower() - - -getInfo = create_getInfo(SoundcloudCom) diff --git a/module/plugins/hoster/SpeedLoadOrg.py b/module/plugins/hoster/SpeedLoadOrg.py index fdd743a65..b406eab68 100644 --- a/module/plugins/hoster/SpeedLoadOrg.py +++ b/module/plugins/hoster/SpeedLoadOrg.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class SpeedLoadOrg(DeadHoster): __name__ = "SpeedLoadOrg" __type__ = "hoster" - __version__ = "1.05" + __version__ = "1.06" __status__ = "stable" __pattern__ = r'http://(?:www\.)?speedload\.org/(?P<ID>\w+)' @@ -15,6 +15,3 @@ class SpeedLoadOrg(DeadHoster): __description__ = """Speedload.org hoster plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] - - -getInfo = create_getInfo(SpeedLoadOrg) diff --git a/module/plugins/hoster/SpeedfileCz.py b/module/plugins/hoster/SpeedfileCz.py index e29f78650..5ea752d35 100644 --- a/module/plugins/hoster/SpeedfileCz.py +++ b/module/plugins/hoster/SpeedfileCz.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class SpeedfileCz(DeadHoster): __name__ = "SpeedFileCz" __type__ = "hoster" - __version__ = "0.35" + __version__ = "0.36" __status__ = "stable" __pattern__ = r'http://(?:www\.)?speedfile\.cz/.+' @@ -15,6 +15,3 @@ class SpeedfileCz(DeadHoster): __description__ = """Speedfile.cz hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - -getInfo = create_getInfo(SpeedfileCz) diff --git a/module/plugins/hoster/SpeedyshareCom.py b/module/plugins/hoster/SpeedyshareCom.py index 6718ce797..a72fbe070 100644 --- a/module/plugins/hoster/SpeedyshareCom.py +++ b/module/plugins/hoster/SpeedyshareCom.py @@ -5,13 +5,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class SpeedyshareCom(SimpleHoster): __name__ = "SpeedyshareCom" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(speedyshare\.com|speedy\.sh)/\w+' @@ -43,6 +43,3 @@ class SpeedyshareCom(SimpleHoster): m = re.search(self.LINK_FREE_PATTERN, self.data) if m is None: self.link = m.group(1) - - -getInfo = create_getInfo(SpeedyshareCom) diff --git a/module/plugins/hoster/StahnuTo.py b/module/plugins/hoster/StahnuTo.py index 55e32246f..a599c6444 100644 --- a/module/plugins/hoster/StahnuTo.py +++ b/module/plugins/hoster/StahnuTo.py @@ -1,20 +1,17 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class StahnuTo(DeadHoster): __name__ = "StahnuTo" __type__ = "hoster" - __version__ = "0.14" + __version__ = "0.15" __status__ = "stable" - __pattern__ = r"http://(\w*\.)?stahnu.to/(files/get/|.*\?file=)([^/]+).*" + __pattern__ = r'http://(?:www\.)?stahnu\.to/(files/get/|.*\?file=)([^/]+).*' __config__ = [] __description__ = """Stahnu.to hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", None)] - - -getInfo = create_getInfo(StahnuTo) diff --git a/module/plugins/hoster/StorageTo.py b/module/plugins/hoster/StorageTo.py index 379951f03..f0b8233b3 100644 --- a/module/plugins/hoster/StorageTo.py +++ b/module/plugins/hoster/StorageTo.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class StorageTo(DeadHoster): __name__ = "StorageTo" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" __status__ = "stable" __pattern__ = r'http://(?:www\.)?storage\.to/get/.+' @@ -15,6 +15,3 @@ class StorageTo(DeadHoster): __description__ = """Storage.to hoster plugin""" __license__ = "GPLv3" __authors__ = [("mkaay", "mkaay@mkaay.de")] - - -getInfo = create_getInfo(StorageTo) diff --git a/module/plugins/hoster/StreamCz.py b/module/plugins/hoster/StreamCz.py index 5ed547159..0921b1878 100644 --- a/module/plugins/hoster/StreamCz.py +++ b/module/plugins/hoster/StreamCz.py @@ -6,24 +6,10 @@ from module.network.RequestFactory import getURL as get_url from module.plugins.internal.Hoster import Hoster -def get_info(urls): - result = [] - - for url in urls: - html = get_url(url) - if re.search(StreamCz.OFFLINE_PATTERN, html): - #: File offline - result.append((url, 0, 1, url)) - else: - result.append((url, 0, 2, url)) - - yield result - - class StreamCz(Hoster): __name__ = "StreamCz" __type__ = "hoster" - __version__ = "0.24" + __version__ = "0.25" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?stream\.cz/[^/]+/\d+' diff --git a/module/plugins/hoster/StreamcloudEu.py b/module/plugins/hoster/StreamcloudEu.py index b860c236b..84ba120af 100644 --- a/module/plugins/hoster/StreamcloudEu.py +++ b/module/plugins/hoster/StreamcloudEu.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster class StreamcloudEu(XFSHoster): __name__ = "StreamcloudEu" __type__ = "hoster" - __version__ = "0.14" + __version__ = "0.15" __status__ = "testing" __pattern__ = r'http://(?:www\.)?streamcloud\.eu/\w{12}' @@ -32,6 +32,3 @@ class StreamcloudEu(XFSHoster): self.multiDL = True self.chunk_limit = 1 self.resume_download = self.premium - - -getInfo = create_getInfo(StreamcloudEu) diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py index 1490f5071..724ac0916 100644 --- a/module/plugins/hoster/TurbobitNet.py +++ b/module/plugins/hoster/TurbobitNet.py @@ -1,23 +1,23 @@ # -*- coding: utf-8 -*- import binascii -import pycurl import random import re import time import urllib -from Crypto.Cipher import ARC4 +import Crypto.Cipher +import pycurl from module.plugins.captcha.ReCaptcha import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -from module.plugins.internal.utils import timestamp +from module.plugins.internal.SimpleHoster import SimpleHoster +from module.plugins.internal.misc import timestamp class TurbobitNet(SimpleHoster): __name__ = "TurbobitNet" __type__ = "hoster" - __version__ = "0.25" + __version__ = "0.26" __status__ = "broken" __pattern__ = r'http://(?:www\.)?turbobit\.net/(?:download/free/)?(?P<ID>\w+)' @@ -79,8 +79,8 @@ class TurbobitNet(SimpleHoster): self.log_debug(inputs) if inputs['captcha_type'] == "recaptcha": - recaptcha = ReCaptcha(self) - inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge() + self.captcha = ReCaptcha(self.pyfile) + inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = self.captcha.challenge() else: m = re.search(self.CAPTCHA_PATTERN, self.data) if m is None: @@ -99,12 +99,12 @@ class TurbobitNet(SimpleHoster): def get_rt_update(self): - rtUpdate = self.retrieve("rtUpdate") + rtUpdate = self.db.retrieve("rtUpdate") if rtUpdate: return rtUpdate - if self.retrieve("version") is not self.__version__ or \ - int(self.retrieve("timestamp", 0)) + 86400000 < timestamp(): + if self.db.retrieve("version") is not self.__version__ or \ + int(self.db.retrieve("timestamp", 0)) + 86400000 < timestamp(): #: that's right, we are even using jdownloader updates rtUpdate = self.load("http://update0.jdownloader.org/pluginstuff/tbupdate.js") rtUpdate = self.decrypt(rtUpdate.splitlines()[1]) @@ -113,9 +113,9 @@ class TurbobitNet(SimpleHoster): r'zza=\2;for(var zzi=0;zzi<zza.length;zzi++){\1=zza[zzi];', rtUpdate) rtUpdate = re.sub(r"for\((\w+)=", r"for(var \1=", rtUpdate) - self.store("rtUpdate", rtUpdate) - self.store("timestamp", timestamp()) - self.store("version", self.__version__) + self.db.store("rtUpdate", rtUpdate) + self.db.store("timestamp", timestamp()) + self.db.store("version", self.__version__) else: self.log_error(_("Unable to download, wait for update...")) self.temp_offline() @@ -152,7 +152,7 @@ class TurbobitNet(SimpleHoster): else: if self.retries >= 2: #: Retry with updated js - self.delete("rtUpdate") + self.db.delete("rtUpdate") else: self.retry() @@ -160,7 +160,7 @@ class TurbobitNet(SimpleHoster): def decrypt(self, data): - cipher = ARC4.new(binascii.hexlify('E\x15\xa1\x9e\xa3M\xa0\xc6\xa0\x84\xb6H\x83\xa8o\xa0')) + cipher = Crypto.Cipher.ARC4.new(binascii.hexlify('E\x15\xa1\x9e\xa3M\xa0\xc6\xa0\x84\xb6H\x83\xa8o\xa0')) return binascii.unhexlify(cipher.encrypt(binascii.unhexlify(data))) @@ -168,6 +168,3 @@ class TurbobitNet(SimpleHoster): lt = time.localtime() tz = time.altzone if lt.tm_isdst else time.timezone return "%s GMT%+03d%02d" % (time.strftime("%a %b %d %Y %H:%M:%S", lt), -tz // 3600, tz % 3600) - - -getInfo = create_getInfo(TurbobitNet) diff --git a/module/plugins/hoster/TurbouploadCom.py b/module/plugins/hoster/TurbouploadCom.py index c71e20ce4..c03432354 100644 --- a/module/plugins/hoster/TurbouploadCom.py +++ b/module/plugins/hoster/TurbouploadCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class TurbouploadCom(DeadHoster): __name__ = "TurbouploadCom" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.07" __status__ = "stable" __pattern__ = r'http://(?:www\.)?turboupload\.com/(\w+)' @@ -15,6 +15,3 @@ class TurbouploadCom(DeadHoster): __description__ = """Turboupload.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - -getInfo = create_getInfo(TurbouploadCom) diff --git a/module/plugins/hoster/TusfilesNet.py b/module/plugins/hoster/TusfilesNet.py index 3415a36ab..cbab4e856 100644 --- a/module/plugins/hoster/TusfilesNet.py +++ b/module/plugins/hoster/TusfilesNet.py @@ -2,13 +2,13 @@ from module.network.HTTPRequest import BadHeader from module.plugins.internal.Plugin import Retry -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster class TusfilesNet(XFSHoster): __name__ = "TusfilesNet" __type__ = "hoster" - __version__ = "0.16" + __version__ = "0.17" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?tusfiles\.net/\w{12}' @@ -40,9 +40,6 @@ class TusfilesNet(XFSHoster): return super(TusfilesNet, self).download(url, *args, **kwargs) except BadHeader, e: - if e.code == 503: + if e.code is 503: self.multiDL = False raise Retry("503") - - -getInfo = create_getInfo(TusfilesNet) diff --git a/module/plugins/hoster/TwoSharedCom.py b/module/plugins/hoster/TwoSharedCom.py index 389f78743..52846be9b 100644 --- a/module/plugins/hoster/TwoSharedCom.py +++ b/module/plugins/hoster/TwoSharedCom.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class TwoSharedCom(SimpleHoster): __name__ = "TwoSharedCom" __type__ = "hoster" - __version__ = "0.17" + __version__ = "0.18" __status__ = "testing" __pattern__ = r'http://(?:www\.)?2shared\.com/(account/)?(download|get|file|document|photo|video|audio)/.+' @@ -33,6 +33,3 @@ class TwoSharedCom(SimpleHoster): def setup(self): self.resume_download = True self.multiDL = True - - -getInfo = create_getInfo(TwoSharedCom) diff --git a/module/plugins/hoster/UgouploadNet.py b/module/plugins/hoster/UgouploadNet.py index fec2e11d1..e985846c5 100644 --- a/module/plugins/hoster/UgouploadNet.py +++ b/module/plugins/hoster/UgouploadNet.py @@ -3,7 +3,7 @@ import re from module.plugins.captcha.ReCaptcha import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class UgouploadNet(SimpleHoster): @@ -12,7 +12,7 @@ class UgouploadNet(SimpleHoster): __version__ = "0.02" __status__ = "testing" - __pattern__ = r'https?://(?:www)?\.ugoupload\.net/\w{4}/.+' + __pattern__ = r'https?://(?:www)?\.ugoupload\.net/\w{4}' __config__ = [("activated" , "bool", "Activated" , True), ("use_premium" , "bool", "Use premium account if available" , True), ("fallback" , "bool", "Fallback to free download if premium fails" , True), diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py index 0292871a7..1e9c2813d 100644 --- a/module/plugins/hoster/UlozTo.py +++ b/module/plugins/hoster/UlozTo.py @@ -3,8 +3,8 @@ import re import time -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -from module.plugins.internal.utils import json, timestamp +from module.plugins.internal.SimpleHoster import SimpleHoster +from module.plugins.internal.misc import json, timestamp def convert_decimal_prefix(m): @@ -15,7 +15,7 @@ def convert_decimal_prefix(m): class UlozTo(SimpleHoster): __name__ = "UlozTo" __type__ = "hoster" - __version__ = "1.18" + __version__ = "1.19" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj\.cz|zachowajto\.pl)/(?:live/)?(?P<ID>\w+/[^/?]*)' @@ -126,7 +126,7 @@ class UlozTo(SimpleHoster): def check_download(self): - check = self.check_file({ + check = self.scan_download({ 'wrong_captcha': ">An error ocurred while verifying the user", 'offline' : re.compile(self.OFFLINE_PATTERN), 'passwd' : self.PASSWD_PATTERN, @@ -153,6 +153,3 @@ class UlozTo(SimpleHoster): self.fail(_("Server error, file not downloadable")) return super(UlozTo, self).check_download() - - -getInfo = create_getInfo(UlozTo) diff --git a/module/plugins/hoster/UloziskoSk.py b/module/plugins/hoster/UloziskoSk.py index 3a0288873..d48b73d58 100644 --- a/module/plugins/hoster/UloziskoSk.py +++ b/module/plugins/hoster/UloziskoSk.py @@ -3,13 +3,13 @@ import re import urlparse -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class UloziskoSk(SimpleHoster): __name__ = "UloziskoSk" __type__ = "hoster" - __version__ = "0.28" + __version__ = "0.29" __status__ = "testing" __pattern__ = r'http://(?:www\.)?ulozisko\.sk/.+' @@ -72,6 +72,3 @@ class UloziskoSk(SimpleHoster): 'id' : id, 'name' : pyfile.name, 'but' : "++++STIAHNI+S%DABOR++++"}) - - -getInfo = create_getInfo(UloziskoSk) diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index 40e20beea..63c918da3 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -1,16 +1,15 @@ # -*- coding: utf-8 -*- -import pycurl import re import urlparse -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class UnibytesCom(SimpleHoster): __name__ = "UnibytesCom" __type__ = "hoster" - __version__ = "0.18" + __version__ = "0.19" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?unibytes\.com/[\w\- .]{11}B' @@ -70,6 +69,3 @@ class UnibytesCom(SimpleHoster): elif last_step in ("captcha", "last"): post_data['captcha'] = self.captcha.decrypt(urlparse.urljoin(domain, "captcha.jpg")) - - -getInfo = create_getInfo(UnibytesCom) diff --git a/module/plugins/hoster/UnrestrictLi.py b/module/plugins/hoster/UnrestrictLi.py index 2e9db1c3c..0c25860e1 100644 --- a/module/plugins/hoster/UnrestrictLi.py +++ b/module/plugins/hoster/UnrestrictLi.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class UnrestrictLi(DeadHoster): __name__ = "UnrestrictLi" __type__ = "hoster" - __version__ = "0.26" + __version__ = "0.27" __status__ = "stable" __pattern__ = r'https?://(?:www\.)?(unrestrict|unr)\.li/dl/[\w^_]+' @@ -15,6 +15,3 @@ class UnrestrictLi(DeadHoster): __description__ = """Unrestrict.li multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] - - -getInfo = create_getInfo(UnrestrictLi) diff --git a/module/plugins/hoster/UpleaCom.py b/module/plugins/hoster/UpleaCom.py index c552adc0f..73be37213 100644 --- a/module/plugins/hoster/UpleaCom.py +++ b/module/plugins/hoster/UpleaCom.py @@ -3,7 +3,7 @@ import re import urlparse -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster class UpleaCom(XFSHoster): @@ -67,6 +67,3 @@ class UpleaCom(XFSHoster): m = re.search(r".ulCounter\({'timer':(\d+)}\)", self.data) if m: self.wait(m.group(1)) - - -getInfo = create_getInfo(UpleaCom) diff --git a/module/plugins/hoster/UploadStationCom.py b/module/plugins/hoster/UploadStationCom.py index 0681b3bfa..92a17be38 100644 --- a/module/plugins/hoster/UploadStationCom.py +++ b/module/plugins/hoster/UploadStationCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class UploadStationCom(DeadHoster): __name__ = "UploadStationCom" __type__ = "hoster" - __version__ = "0.55" + __version__ = "0.56" __status__ = "stable" __pattern__ = r'http://(?:www\.)?uploadstation\.com/file/(?P<ID>\w+)' @@ -16,6 +16,3 @@ class UploadStationCom(DeadHoster): __license__ = "GPLv3" __authors__ = [("fragonib", "fragonib[AT]yahoo[DOT]es"), ("zoidberg", "zoidberg@mujmail.cz")] - - -getInfo = create_getInfo(UploadStationCom) diff --git a/module/plugins/hoster/UploadableCh.py b/module/plugins/hoster/UploadableCh.py index 0fc62777f..70ff60eda 100644 --- a/module/plugins/hoster/UploadableCh.py +++ b/module/plugins/hoster/UploadableCh.py @@ -3,13 +3,13 @@ import re from module.plugins.captcha.ReCaptcha import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class UploadableCh(SimpleHoster): __name__ = "UploadableCh" __type__ = "hoster" - __version__ = "0.15" + __version__ = "0.16" __status__ = "testing" __pattern__ = r'http://(?:www\.)?uploadable\.ch/file/(?P<ID>\w+)' @@ -44,13 +44,13 @@ class UploadableCh(SimpleHoster): self.wait(30) - #: Make the recaptcha appear and show it the pyload interface + #: Make the ReCaptcha appear and show it the pyload interface b = self.load(pyfile.url, post={'checkDownload': "check"}) self.log_debug(b) #: Expected output: {'success': "showCaptcha"} - recaptcha = ReCaptcha(self) + self.captcha = ReCaptcha(pyfile) - response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) + response, challenge = self.captcha.challenge(self.RECAPTCHA_KEY) #: Submit the captcha solution self.load("http://www.uploadable.ch/checkReCaptcha.php", @@ -70,12 +70,9 @@ class UploadableCh(SimpleHoster): def check_download(self): - if self.check_file({'wait': re.compile("Please wait for")}): + if self.scan_download({'wait': re.compile("Please wait for")}): self.log_info(_("Downloadlimit reached, please wait or reconnect")) self.wait(60 * 60, True) self.retry() return super(UploadableCh, self).check_download() - - -getInfo = create_getInfo(UploadableCh) diff --git a/module/plugins/hoster/UploadboxCom.py b/module/plugins/hoster/UploadboxCom.py index 95a22c792..de8cfddd6 100644 --- a/module/plugins/hoster/UploadboxCom.py +++ b/module/plugins/hoster/UploadboxCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class UploadboxCom(DeadHoster): __name__ = "Uploadbox" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.09" __status__ = "stable" __pattern__ = r'http://(?:www\.)?uploadbox\.com/files/.+' @@ -15,6 +15,3 @@ class UploadboxCom(DeadHoster): __description__ = """UploadBox.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - -getInfo = create_getInfo(UploadboxCom) diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index 9e7c0f6a1..2fe1c9744 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -5,13 +5,13 @@ import time from module.network.RequestFactory import getURL as get_url from module.plugins.captcha.ReCaptcha import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class UploadedTo(SimpleHoster): __name__ = "UploadedTo" __type__ = "hoster" - __version__ = "0.99" + __version__ = "1.00" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(uploaded\.(to|net)|ul\.to)(/file/|/?\?id=|.*?&id=|/)(?P<ID>\w+)' @@ -75,8 +75,8 @@ class UploadedTo(SimpleHoster): self.data = self.load("http://uploaded.net/js/download.js") - recaptcha = ReCaptcha(self) - response, challenge = recaptcha.challenge() + self.captcha = ReCaptcha(pyfile) + response, challenge = self.captcha.challenge() self.data = self.load("http://uploaded.net/io/ticket/captcha/%s" % self.info['pattern']['ID'], post={'recaptcha_challenge_field': challenge, @@ -85,6 +85,3 @@ class UploadedTo(SimpleHoster): super(UploadedTo, self).handle_free(pyfile) self.check_errors() - - -getInfo = create_getInfo(UploadedTo) diff --git a/module/plugins/hoster/UploadhereCom.py b/module/plugins/hoster/UploadhereCom.py index e684da0fb..1690ff0c9 100644 --- a/module/plugins/hoster/UploadhereCom.py +++ b/module/plugins/hoster/UploadhereCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class UploadhereCom(DeadHoster): __name__ = "UploadhereCom" __type__ = "hoster" - __version__ = "0.15" + __version__ = "0.16" __status__ = "stable" __pattern__ = r'http://(?:www\.)?uploadhere\.com/\w{10}' @@ -15,6 +15,3 @@ class UploadhereCom(DeadHoster): __description__ = """Uploadhere.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - -getInfo = create_getInfo(UploadhereCom) diff --git a/module/plugins/hoster/UploadheroCom.py b/module/plugins/hoster/UploadheroCom.py index 5ff34dc80..96d845259 100644 --- a/module/plugins/hoster/UploadheroCom.py +++ b/module/plugins/hoster/UploadheroCom.py @@ -6,13 +6,13 @@ import re import urlparse -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class UploadheroCom(SimpleHoster): __name__ = "UploadheroCom" __type__ = "hoster" - __version__ = "0.21" + __version__ = "0.22" __status__ = "testing" __pattern__ = r'http://(?:www\.)?uploadhero\.com?/dl/\w+' @@ -70,6 +70,3 @@ class UploadheroCom(SimpleHoster): self.retry() return super(UploadheroCom, self).check_errors() - - -getInfo = create_getInfo(UploadheroCom) diff --git a/module/plugins/hoster/UploadingCom.py b/module/plugins/hoster/UploadingCom.py index 0f779ffb2..d85e02eaf 100644 --- a/module/plugins/hoster/UploadingCom.py +++ b/module/plugins/hoster/UploadingCom.py @@ -1,17 +1,18 @@ # -*- coding: utf-8 -*- -import pycurl import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -from module.plugins.internal.utils import encode, json, timestamp +import pycurl + +from module.plugins.internal.SimpleHoster import SimpleHoster +from module.plugins.internal.misc import encode, json, timestamp class UploadingCom(SimpleHoster): __name__ = "UploadingCom" __type__ = "hoster" - __version__ = "0.46" - __status__ = "testing" + __version__ = "0.48" + __status__ = "broken" __pattern__ = r'http://(?:www\.)?uploading\.com/files/(?:get/)?(?P<ID>\w+)' __config__ = [("activated" , "bool", "Activated" , True), @@ -74,7 +75,10 @@ class UploadingCom(SimpleHoster): self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) self.req.http.lastURL = pyfile.url - res = json.loads(self.load(ajax_url, post={'action': 'second_page', 'code': self.info['pattern']['ID']})) + html = self.load(ajax_url, + post={'action': 'second_page', + 'code' : self.info['pattern']['ID']}) + res = json.loads(html) if 'answer' in res and 'wait_time' in res['answer']: wait_time = int(res['answer']['wait_time']) @@ -83,7 +87,11 @@ class UploadingCom(SimpleHoster): else: self.error(_("No AJAX/WAIT")) - res = json.loads(self.load(ajax_url, post={'action': 'get_link', 'code': self.info['pattern']['ID'], 'pass': 'false'})) + html = self.load(ajax_url, + post={'action': 'get_link', + 'code' : self.info['pattern']['ID'], + 'pass' : 'false'}) + res = json.loads(html) if 'answer' in res and 'link' in res['answer']: url = res['answer']['link'] @@ -98,6 +106,3 @@ class UploadingCom(SimpleHoster): self.error(_("No URL")) self.link = url - - -getInfo = create_getInfo(UploadingCom) diff --git a/module/plugins/hoster/UploadkingCom.py b/module/plugins/hoster/UploadkingCom.py index c565617fd..51843ed03 100644 --- a/module/plugins/hoster/UploadkingCom.py +++ b/module/plugins/hoster/UploadkingCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class UploadkingCom(DeadHoster): __name__ = "UploadkingCom" __type__ = "hoster" - __version__ = "0.17" + __version__ = "0.18" __status__ = "stable" __pattern__ = r'http://(?:www\.)?uploadking\.com/\w{10}' @@ -15,6 +15,3 @@ class UploadkingCom(DeadHoster): __description__ = """UploadKing.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - -getInfo = create_getInfo(UploadkingCom) diff --git a/module/plugins/hoster/UpstoreNet.py b/module/plugins/hoster/UpstoreNet.py index 4fcf6dcfa..ca8a85c6d 100644 --- a/module/plugins/hoster/UpstoreNet.py +++ b/module/plugins/hoster/UpstoreNet.py @@ -3,7 +3,7 @@ import re from module.plugins.captcha.ReCaptcha import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class UpstoreNet(SimpleHoster): @@ -42,8 +42,8 @@ class UpstoreNet(SimpleHoster): self.check_errors() #: STAGE 2: solv captcha and wait - #: First get the infos we need: recaptcha key and wait time - recaptcha = ReCaptcha(self) + #: First get the infos we need: self.captcha key and wait time + self.captcha = ReCaptcha(pyfile) #: Try the captcha 5 times for i in xrange(5): @@ -56,7 +56,7 @@ class UpstoreNet(SimpleHoster): self.wait(wait_time) #: then, handle the captcha - response, challenge = recaptcha.challenge() + response, challenge = self.captcha.challenge() post_data.update({'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) @@ -86,7 +86,3 @@ class UpstoreNet(SimpleHoster): self.retry(wait_time=3600, reason=_("Upstore doesn't like us today")) - - -getInfo = create_getInfo(UpstoreNet) - diff --git a/module/plugins/hoster/UptoboxCom.py b/module/plugins/hoster/UptoboxCom.py index 50e77c78a..4783adf8a 100644 --- a/module/plugins/hoster/UptoboxCom.py +++ b/module/plugins/hoster/UptoboxCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster class UptoboxCom(XFSHoster): __name__ = "UptoboxCom" __type__ = "hoster" - __version__ = "0.25" + __version__ = "0.26" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(uptobox|uptostream)\.com/\w{12}' @@ -36,6 +36,3 @@ class UptoboxCom(XFSHoster): self.multiDL = True self.chunk_limit = 1 self.resume_download = True - - -getInfo = create_getInfo(UptoboxCom) diff --git a/module/plugins/hoster/UserscloudCom.py b/module/plugins/hoster/UserscloudCom.py index 1b07ffd6d..4c8f70ce3 100644 --- a/module/plugins/hoster/UserscloudCom.py +++ b/module/plugins/hoster/UserscloudCom.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class UserscloudCom(SimpleHoster): __name__ = "UserscloudCom" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?userscloud\.com/\w{12}' @@ -37,6 +37,3 @@ class UserscloudCom(SimpleHoster): def handle_free(self, pyfile): self.download(pyfile.url, post=dict(re.findall(r'<input type="hidden" name="(.+?)" value="(.*?)">', self.data))) - - -getInfo = create_getInfo(UserscloudCom) diff --git a/module/plugins/hoster/VeehdCom.py b/module/plugins/hoster/VeehdCom.py index 30e7705aa..9999b9141 100644 --- a/module/plugins/hoster/VeehdCom.py +++ b/module/plugins/hoster/VeehdCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.Hoster import Hoster class VeehdCom(Hoster): __name__ = "VeehdCom" __type__ = "hoster" - __version__ = "0.27" + __version__ = "0.28" __status__ = "testing" __pattern__ = r'http://veehd\.com/video/\d+_\S+' @@ -61,12 +61,12 @@ class VeehdCom(Hoster): name = m.group(1) #: Replace unwanted characters in filename - if self.get_config('filename_spaces'): + if self.config.get('filename_spaces'): pattern = '[^\w ]+' else: pattern = '[^\w.]+' - return re.sub(pattern, self.get_config('replacement_char'), name) + '.avi' + return re.sub(pattern, self.config.get('replacement_char'), name) + '.avi' def get_file_url(self): diff --git a/module/plugins/hoster/VeohCom.py b/module/plugins/hoster/VeohCom.py index e1d20da31..6f651b4a3 100644 --- a/module/plugins/hoster/VeohCom.py +++ b/module/plugins/hoster/VeohCom.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class VeohCom(SimpleHoster): __name__ = "VeohCom" __type__ = "hoster" - __version__ = "0.25" + __version__ = "0.26" __status__ = "testing" __pattern__ = r'http://(?:www\.)?veoh\.com/(tv/)?(watch|videos)/(?P<ID>v\w+)' @@ -38,7 +38,7 @@ class VeohCom(SimpleHoster): def handle_free(self, pyfile): - quality = self.get_config('quality') + quality = self.config.get('quality') if quality == "Auto": quality = ("High", "Low") @@ -53,6 +53,3 @@ class VeohCom(SimpleHoster): self.log_info(_("No %s quality video found") % q.upper()) else: self.fail(_("No video found!")) - - -getInfo = create_getInfo(VeohCom) diff --git a/module/plugins/hoster/VidPlayNet.py b/module/plugins/hoster/VidPlayNet.py index d883a5fdd..df2f1bdab 100644 --- a/module/plugins/hoster/VidPlayNet.py +++ b/module/plugins/hoster/VidPlayNet.py @@ -3,13 +3,13 @@ # Test links: # BigBuckBunny_320x180.mp4 - 61.7 Mb - http://vidplay.net/38lkev0h3jv0 -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster class VidPlayNet(XFSHoster): __name__ = "VidPlayNet" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?vidplay\.net/\w{12}' @@ -27,6 +27,3 @@ class VidPlayNet(XFSHoster): PLUGIN_DOMAIN = "vidplay.net" NAME_PATTERN = r'<b>Password:</b></div>\s*<h[1-6]>(?P<N>[^<]+)</h[1-6]>' - - -getInfo = create_getInfo(VidPlayNet) diff --git a/module/plugins/hoster/VimeoCom.py b/module/plugins/hoster/VimeoCom.py index 3e62a431a..6c659e2d7 100644 --- a/module/plugins/hoster/VimeoCom.py +++ b/module/plugins/hoster/VimeoCom.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class VimeoCom(SimpleHoster): __name__ = "VimeoCom" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(player\.)?vimeo\.com/(video/)?(?P<ID>\d+)' @@ -50,14 +50,14 @@ class VimeoCom(SimpleHoster): link = dict((l.group('QL').lower(), l.group('URL')) for l in re.finditer(pattern, html)) - if self.get_config('original'): + if self.config.get('original'): if "original" in link: self.link = link[q] return else: self.log_info(_("Original file not downloadable")) - quality = self.get_config('quality') + quality = self.config.get('quality') if quality == "Highest": qlevel = ("hd", "sd", "mobile") elif quality == "Lowest": @@ -73,6 +73,3 @@ class VimeoCom(SimpleHoster): self.log_info(_("No %s quality video found") % q.upper()) else: self.fail(_("No video found!")) - - -getInfo = create_getInfo(VimeoCom) diff --git a/module/plugins/hoster/Vipleech4UCom.py b/module/plugins/hoster/Vipleech4UCom.py index 96dff1a59..9133dbc97 100644 --- a/module/plugins/hoster/Vipleech4UCom.py +++ b/module/plugins/hoster/Vipleech4UCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class Vipleech4UCom(DeadHoster): __name__ = "Vipleech4UCom" __type__ = "hoster" - __version__ = "0.23" + __version__ = "0.24" __status__ = "stable" __pattern__ = r'http://(?:www\.)?vipleech4u\.com/manager\.php' @@ -15,6 +15,3 @@ class Vipleech4UCom(DeadHoster): __description__ = """Vipleech4u.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] - - -getInfo = create_getInfo(Vipleech4UCom) diff --git a/module/plugins/hoster/VkCom.py b/module/plugins/hoster/VkCom.py index 858c0111c..762ebc092 100644 --- a/module/plugins/hoster/VkCom.py +++ b/module/plugins/hoster/VkCom.py @@ -5,16 +5,16 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class VkCom(SimpleHoster): __name__ = "VkCom" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" __status__ = "testing" - __pattern__ = r"https?://(?:www\.)?vk\.com/video_ext\.php/\?.+" + __pattern__ = r'https?://(?:www\.)?vk\.com/video_ext\.php/\?.+' __config__ = [("activated" , "bool", "Activated" , True), ("use_premium" , "bool", "Use premium account if available" , True), ("fallback" , "bool", "Fallback to free download if premium fails" , True), @@ -33,7 +33,4 @@ class VkCom(SimpleHoster): def handle_free(self, pyfile): - self.link = re.findall(self.LINK_FREE_PATTERN, self.data)[0 if self.get_config('quality') == "Low" else -1] - - -getInfo = create_getInfo(VkCom) + self.link = re.findall(self.LINK_FREE_PATTERN, self.data)[0 if self.config.get('quality') == "Low" else -1] diff --git a/module/plugins/hoster/WarserverCz.py b/module/plugins/hoster/WarserverCz.py index e8522096e..4e9d45daf 100644 --- a/module/plugins/hoster/WarserverCz.py +++ b/module/plugins/hoster/WarserverCz.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class WarserverCz(DeadHoster): __name__ = "WarserverCz" __type__ = "hoster" - __version__ = "0.16" + __version__ = "0.17" __status__ = "stable" __pattern__ = r'http://(?:www\.)?warserver\.cz/stahnout/\d+' @@ -15,6 +15,3 @@ class WarserverCz(DeadHoster): __description__ = """Warserver.cz hoster plugin""" __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - -getInfo = create_getInfo(WarserverCz) diff --git a/module/plugins/hoster/WebshareCz.py b/module/plugins/hoster/WebshareCz.py index 7fe639335..b9c1274f5 100644 --- a/module/plugins/hoster/WebshareCz.py +++ b/module/plugins/hoster/WebshareCz.py @@ -3,13 +3,13 @@ import re from module.network.RequestFactory import getURL as get_url -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class WebshareCz(SimpleHoster): __name__ = "WebshareCz" __type__ = "hoster" - __version__ = "0.22" + __version__ = "0.23" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(en\.)?webshare\.cz/(?:#/)?file/(?P<ID>\w+)' @@ -57,6 +57,3 @@ class WebshareCz(SimpleHoster): def handle_premium(self, pyfile): return self.handle_free(pyfile) - - -getInfo = create_getInfo(WebshareCz) diff --git a/module/plugins/hoster/WrzucTo.py b/module/plugins/hoster/WrzucTo.py index 5c1a903a9..dc0646e4c 100644 --- a/module/plugins/hoster/WrzucTo.py +++ b/module/plugins/hoster/WrzucTo.py @@ -1,15 +1,16 @@ # -*- coding: utf-8 -*- -import pycurl import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +import pycurl + +from module.plugins.internal.SimpleHoster import SimpleHoster class WrzucTo(SimpleHoster): __name__ = "WrzucTo" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.07" __status__ = "testing" __pattern__ = r'http://(?:www\.)?wrzuc\.to/(\w+(\.wt|\.html)|(\w+/?linki/\w+))' @@ -36,7 +37,7 @@ class WrzucTo(SimpleHoster): def handle_free(self, pyfile): data = dict(re.findall(r'(md5|file): "(.*?)"', self.data)) - if len(data) != 2: + if len(data) is not 2: self.error(_("No file ID")) self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) @@ -47,10 +48,7 @@ class WrzucTo(SimpleHoster): self.data = self.load("http://www.wrzuc.to/ajax/server/download_link", post={'file': data['file']}) data.update(re.findall(r'"(download_link|server_id)":"(.*?)"', self.data)) - if len(data) != 4: + if len(data) is not 4: self.error(_("No download URL")) self.link = "http://%s.wrzuc.to/pobierz/%s" % (data['server_id'], data['download_link']) - - -getInfo = create_getInfo(WrzucTo) diff --git a/module/plugins/hoster/WuploadCom.py b/module/plugins/hoster/WuploadCom.py index 14d383e30..132a9da27 100644 --- a/module/plugins/hoster/WuploadCom.py +++ b/module/plugins/hoster/WuploadCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class WuploadCom(DeadHoster): __name__ = "WuploadCom" __type__ = "hoster" - __version__ = "0.26" + __version__ = "0.27" __status__ = "stable" __pattern__ = r'http://(?:www\.)?wupload\..+?/file/((\w+/)?\d+)(/.*)?' @@ -16,6 +16,3 @@ class WuploadCom(DeadHoster): __license__ = "GPLv3" __authors__ = [("jeix", "jeix@hasnomail.de"), ("Paul King", None)] - - -getInfo = create_getInfo(WuploadCom) diff --git a/module/plugins/hoster/X7To.py b/module/plugins/hoster/X7To.py index 85d260856..8d172ce77 100644 --- a/module/plugins/hoster/X7To.py +++ b/module/plugins/hoster/X7To.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class X7To(DeadHoster): __name__ = "X7To" __type__ = "hoster" - __version__ = "0.44" + __version__ = "0.45" __status__ = "stable" __pattern__ = r'http://(?:www\.)?x7\.to/' @@ -15,6 +15,3 @@ class X7To(DeadHoster): __description__ = """X7.to hoster plugin""" __license__ = "GPLv3" __authors__ = [("ernieb", "ernieb")] - - -getInfo = create_getInfo(X7To) diff --git a/module/plugins/hoster/Xdcc.py b/module/plugins/hoster/XDCC.py index cf512c7b4..3985a050c 100644 --- a/module/plugins/hoster/Xdcc.py +++ b/module/plugins/hoster/XDCC.py @@ -1,21 +1,20 @@ # -*- coding: utf-8 -*- import re +import select import socket import struct import sys import time -from select import select - from module.plugins.internal.Hoster import Hoster -from module.plugins.internal.utils import fs_join +from module.plugins.internal.misc import fsjoin -class Xdcc(Hoster): - __name__ = "Xdcc" +class XDCC(Hoster): + __name__ = "XDCC" __type__ = "hoster" - __version__ = "0.36" + __version__ = "0.38" __status__ = "testing" __config__ = [("nick", "str", "Nickname", "pyload"), @@ -49,7 +48,7 @@ class Xdcc(Hoster): else: errno = e.args[0] - if errno == 10054: + if errno is 10054: self.log_debug("Server blocked our ip, retry in 5 min") self.wait(300) continue @@ -67,15 +66,15 @@ class Xdcc(Hoster): chan = m.group(2) bot = m.group(3) pack = m.group(4) - nick = self.get_config('nick') - ident = self.get_config('ident') - real = self.get_config('realname') + nick = self.config.get('nick') + ident = self.config.get('ident') + real = self.config.get('realname') temp = server.split(':') ln = len(temp) - if ln == 2: + if ln is 2: host, port = temp - elif ln == 1: + elif ln is 1: host, port = temp[0], 6667 else: self.fail(_("Invalid hostname for IRC Server: %s") % server) @@ -119,7 +118,7 @@ class Xdcc(Hoster): sock.close() self.fail(_("XDCC Bot did not answer")) - fdset = select([sock], [], [], 0) + fdset = select.select([sock], [], [], 0) if sock not in fdset[0]: continue @@ -140,7 +139,7 @@ class Xdcc(Hoster): self.fail(_("IRC-Error: %s") % line) msg = line.split(None, 3) - if len(msg) != 4: + if len(msg) is not 4: continue msg = { @@ -189,7 +188,7 @@ class Xdcc(Hoster): self.pyfile.name = packname dl_folder = self.pyload.config.get("general", "download_folder") - filename = fs_join(dl_folder, packname) + filename = fsjoin(dl_folder, packname) self.log_info(_("Downloading %s from %s:%d") % (packname, ip, port)) diff --git a/module/plugins/hoster/XFileSharing.py b/module/plugins/hoster/XFileSharing.py index e0556789a..d225e73a2 100644 --- a/module/plugins/hoster/XFileSharing.py +++ b/module/plugins/hoster/XFileSharing.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from module.plugins.internal.XFSHoster import XFSHoster class XFileSharing(XFSHoster): __name__ = "XFileSharing" __type__ = "hoster" - __version__ = "0.63" + __version__ = "0.64" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -48,7 +48,7 @@ class XFileSharing(XFSHoster): def setup_base(self): if self.account: self.req = self.pyload.requestFactory.getRequest(self.PLUGIN_NAME, self.account.user) - self.premium = self.account.info['data']['premium'] #@NOTE: Avoid one unnecessary get_info call by `self.account.premium` here + self.premium = self.account.info['data']['premium'] #@NOTE: Don't call get_info here to reduce overhead else: self.req = self.pyload.requestFactory.getRequest(self.classname) self.premium = False @@ -62,6 +62,3 @@ class XFileSharing(XFSHoster): self.__class__.__name__ = str(self.PLUGIN_NAME) super(XFileSharing, self).load_account() self.__class__.__name__ = class_name - - -getInfo = create_getInfo(XFileSharing) diff --git a/module/plugins/hoster/XHamsterCom.py b/module/plugins/hoster/XHamsterCom.py index 56e61860a..d4b0c343e 100644 --- a/module/plugins/hoster/XHamsterCom.py +++ b/module/plugins/hoster/XHamsterCom.py @@ -3,7 +3,7 @@ import re import urllib -from module.plugins.internal.utils import json +from module.plugins.internal.misc import json from module.plugins.internal.Hoster import Hoster @@ -18,7 +18,7 @@ def clean_json(json_expr): class XHamsterCom(Hoster): __name__ = "XHamsterCom" __type__ = "hoster" - __version__ = "0.16" + __version__ = "0.17" __status__ = "testing" __pattern__ = r'http://(?:www\.)?xhamster\.com/movies/.+' @@ -36,8 +36,8 @@ class XHamsterCom(Hoster): if not self.file_exists(): self.offline() - if self.get_config('type'): - self.desired_fmt = self.get_config('type') + if self.config.get('type'): + self.desired_fmt = self.config.get('type') pyfile.name = self.get_file_name() + self.desired_fmt self.download(self.get_file_url()) diff --git a/module/plugins/hoster/XVideosCom.py b/module/plugins/hoster/XVideosCom.py index e41433893..2347c8cfc 100644 --- a/module/plugins/hoster/XVideosCom.py +++ b/module/plugins/hoster/XVideosCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.Hoster import Hoster class XVideosCom(Hoster): __name__ = "XVideos.com" __type__ = "hoster" - __version__ = "0.14" + __version__ = "0.15" __status__ = "testing" __pattern__ = r'http://(?:www\.)?xvideos\.com/video(\d+)' diff --git a/module/plugins/hoster/XdadevelopersCom.py b/module/plugins/hoster/XdadevelopersCom.py index 282a3cc06..843f835cf 100644 --- a/module/plugins/hoster/XdadevelopersCom.py +++ b/module/plugins/hoster/XdadevelopersCom.py @@ -5,13 +5,13 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class XdadevelopersCom(SimpleHoster): __name__ = "XdadevelopersCom" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.07" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?forum\.xda-developers\.com/devdb/project/dl/\?id=\d+' @@ -39,6 +39,3 @@ class XdadevelopersCom(SimpleHoster): def handle_free(self, pyfile): self.link = pyfile.url + "&task=get" #@TODO: Revert to `get={'task': "get"}` in 0.4.10 - - -getInfo = create_getInfo(XdadevelopersCom) diff --git a/module/plugins/hoster/YadiSk.py b/module/plugins/hoster/YadiSk.py index 9905a13d7..0ce46ce30 100644 --- a/module/plugins/hoster/YadiSk.py +++ b/module/plugins/hoster/YadiSk.py @@ -3,14 +3,14 @@ import re import random -from module.plugins.internal.utils import json -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.misc import json +from module.plugins.internal.SimpleHoster import SimpleHoster class YadiSk(SimpleHoster): __name__ = "YadiSk" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __pattern__ = r'https?://yadi\.sk/d/[\w\-]+' @@ -88,6 +88,3 @@ class YadiSk(SimpleHoster): except Exception: pass - - -getInfo = create_getInfo(YadiSk) diff --git a/module/plugins/hoster/YibaishiwuCom.py b/module/plugins/hoster/YibaishiwuCom.py index 2dbec6c09..24c90a856 100644 --- a/module/plugins/hoster/YibaishiwuCom.py +++ b/module/plugins/hoster/YibaishiwuCom.py @@ -3,14 +3,14 @@ import re import urlparse -from module.plugins.internal.utils import json -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.misc import json +from module.plugins.internal.SimpleHoster import SimpleHoster class YibaishiwuCom(SimpleHoster): __name__ = "YibaishiwuCom" __type__ = "hoster" - __version__ = "0.17" + __version__ = "0.18" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(?:u\.)?115\.com/file/(?P<ID>\w+)' @@ -41,7 +41,8 @@ class YibaishiwuCom(SimpleHoster): self.log_debug(('FREEUSER' if m.group(2) == "download" else 'GUEST') + ' URL', url) - res = json.loads(self.load(urlparse.urljoin("http://115.com/", url), decode=False)) + html = self.load(urlparse.urljoin("http://115.com/", url), decode=False) + res = json.loads(html) if "urls" in res: mirrors = res['urls'] @@ -61,6 +62,3 @@ class YibaishiwuCom(SimpleHoster): pass else: self.fail(_("No working link found")) - - -getInfo = create_getInfo(YibaishiwuCom) diff --git a/module/plugins/hoster/YoupornCom.py b/module/plugins/hoster/YoupornCom.py index 8c30f5707..aa07bb2db 100644 --- a/module/plugins/hoster/YoupornCom.py +++ b/module/plugins/hoster/YoupornCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.Hoster import Hoster class YoupornCom(Hoster): __name__ = "YoupornCom" __type__ = "hoster" - __version__ = "0.24" + __version__ = "0.25" __status__ = "testing" __pattern__ = r'http://(?:www\.)?youporn\.com/watch/.+' diff --git a/module/plugins/hoster/YourfilesTo.py b/module/plugins/hoster/YourfilesTo.py index 91d5cefa2..719c149a7 100644 --- a/module/plugins/hoster/YourfilesTo.py +++ b/module/plugins/hoster/YourfilesTo.py @@ -9,7 +9,7 @@ from module.plugins.internal.Hoster import Hoster class YourfilesTo(Hoster): __name__ = "YourfilesTo" __type__ = "hoster" - __version__ = "0.26" + __version__ = "0.27" __status__ = "testing" __pattern__ = r'http://(?:www\.)?yourfiles\.(to|biz)/\?d=\w+' diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py index f15df801a..81638e1ea 100644 --- a/module/plugins/hoster/YoutubeCom.py +++ b/module/plugins/hoster/YoutubeCom.py @@ -6,13 +6,13 @@ import subprocess import urllib from module.plugins.internal.Hoster import Hoster -from module.plugins.internal.utils import html_unescape, replace_patterns, which +from module.plugins.internal.misc import html_unescape, replace_patterns, which class YoutubeCom(Hoster): __name__ = "YoutubeCom" __type__ = "hoster" - __version__ = "0.48" + __version__ = "0.49" __status__ = "testing" __pattern__ = r'https?://(?:[^/]*\.)?(youtu\.be/|youtube\.com/watch\?(?:.*&)?v=)\w+' @@ -76,7 +76,7 @@ class YoutubeCom(Hoster): self.temp_offline() #: Get config - use3d = self.get_config('3d') + use3d = self.config.get('3d') if use3d: quality = {'sd': 82, 'hd': 84, 'fullhd': 85, '240p': 83, '360p': 82, @@ -85,10 +85,10 @@ class YoutubeCom(Hoster): quality = {'sd': 18, 'hd': 22, 'fullhd': 37, '240p': 5, '360p': 18, '480p': 35, '720p': 22, '1080p': 37, '3072p': 38} - desired_fmt = self.get_config('fmt') + desired_fmt = self.config.get('fmt') if not desired_fmt: - desired_fmt = quality.get(self.get_config('quality'), 18) + desired_fmt = quality.get(self.config.get('quality'), 18) elif desired_fmt not in self.formats: self.log_warning(_("FMT %d unknown, using default") % desired_fmt) @@ -105,7 +105,7 @@ class YoutubeCom(Hoster): self.log_debug("AVAILABLE STREAMS: %s" % [x[0] for x in streams]) #: Build dictionary of supported itags (3D/2D) - allowed = lambda x: self.get_config(self.formats[x][0]) + allowed = lambda x: self.config.get(self.formats[x][0]) streams = [x for x in streams if x[0] in self.formats and allowed(x[0])] if not streams: @@ -171,4 +171,4 @@ class YoutubeCom(Hoster): "-acodec", "copy", filename]) - os.remove(inputfile) + self.remove(inputfile, trash=False) diff --git a/module/plugins/hoster/ZDF.py b/module/plugins/hoster/ZDF.py index 866b9c84f..cfc374f6d 100644 --- a/module/plugins/hoster/ZDF.py +++ b/module/plugins/hoster/ZDF.py @@ -10,7 +10,7 @@ from module.plugins.internal.Hoster import Hoster class ZDF(Hoster): __name__ = "ZDF Mediathek" __type__ = "hoster" - __version__ = "0.87" + __version__ = "0.88" __status__ = "testing" __pattern__ = r'http://(?:www\.)?zdf\.de/ZDFmediathek/\D*(\d+)\D*' diff --git a/module/plugins/hoster/ZShareNet.py b/module/plugins/hoster/ZShareNet.py index 699adcc06..c46ac09ca 100644 --- a/module/plugins/hoster/ZShareNet.py +++ b/module/plugins/hoster/ZShareNet.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class ZShareNet(DeadHoster): __name__ = "ZShareNet" __type__ = "hoster" - __version__ = "0.24" + __version__ = "0.25" __status__ = "stable" __pattern__ = r'https?://(?:ww[2w]\.)?zshares?\.net/.+' @@ -16,6 +16,3 @@ class ZShareNet(DeadHoster): __license__ = "GPLv3" __authors__ = [("espes", None), ("Cptn Sandwich", None)] - - -getInfo = create_getInfo(ZShareNet) diff --git a/module/plugins/hoster/ZahikiNet.py b/module/plugins/hoster/ZahikiNet.py index ed45119e6..800cc0729 100644 --- a/module/plugins/hoster/ZahikiNet.py +++ b/module/plugins/hoster/ZahikiNet.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster class ZahikiNet(DeadHoster): __name__ = "ZahikiNet" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?zahiki\.net/\w+/.+' @@ -15,6 +15,3 @@ class ZahikiNet(DeadHoster): __description__ = """Zahiki.net hoster plugin""" __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - -getInfo = create_getInfo(ZahikiNet) diff --git a/module/plugins/hoster/ZeveraCom.py b/module/plugins/hoster/ZeveraCom.py index ede1855c2..7747f494c 100644 --- a/module/plugins/hoster/ZeveraCom.py +++ b/module/plugins/hoster/ZeveraCom.py @@ -2,13 +2,13 @@ import re -from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo +from module.plugins.internal.MultiHoster import MultiHoster class ZeveraCom(MultiHoster): __name__ = "ZeveraCom" __type__ = "hoster" - __version__ = "0.35" + __version__ = "0.36" __status__ = "testing" __pattern__ = r'https?://(?:www\.)zevera\.com/(getFiles\.ashx|Members/download\.ashx)\?.*ourl=.+' @@ -30,6 +30,3 @@ class ZeveraCom(MultiHoster): def handle_premium(self, pyfile): self.link = "https://%s/getFiles.ashx?ourl=%s" % (self.account.PLUGIN_DOMAIN, pyfile.url) - - -getInfo = create_getInfo(ZeveraCom) diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index 69fe38610..b1b084ee8 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -6,13 +6,13 @@ import urllib import BeautifulSoup from module.plugins.captcha.ReCaptcha import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster class ZippyshareCom(SimpleHoster): __name__ = "ZippyshareCom" __type__ = "hoster" - __version__ = "0.85" + __version__ = "0.86" __status__ = "testing" __pattern__ = r'http://www\d{0,3}\.zippyshare\.com/v(/|iew\.jsp.*key=)(?P<KEY>[\w^_]+)' @@ -30,9 +30,10 @@ class ZippyshareCom(SimpleHoster): COOKIES = [("zippyshare.com", "ziplocale", "en")] - NAME_PATTERN = r'(<title>Zippyshare.com - |"/)(?P<N>[^/]+)(</title>|";)' - SIZE_PATTERN = r'>Size:.+?">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' - OFFLINE_PATTERN = r'does not exist (anymore )?on this server<' + NAME_PATTERN = r'(<title>Zippyshare.com - |"/)(?P<N>[^/]+)(</title>|";)' + SIZE_PATTERN = r'>Size:.+?">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'does not exist (anymore )?on this server<' + TEMP_OFFLINE_PATTERN = None LINK_PREMIUM_PATTERN = r"document.location = '(.+?)'" @@ -44,13 +45,13 @@ class ZippyshareCom(SimpleHoster): def handle_free(self, pyfile): - recaptcha = ReCaptcha(self) - captcha_key = recaptcha.detect_key() + self.captcha = ReCaptcha(pyfile) + captcha_key = self.captcha.detect_key() if captcha_key: try: self.link = re.search(self.LINK_PREMIUM_PATTERN, self.data) - recaptcha.challenge() + self.captcha.challenge() except Exception, e: self.error(e) @@ -94,6 +95,3 @@ class ZippyshareCom(SimpleHoster): #: Get the file's url by evaluating all the scripts scripts = ["var GVAR = {}"] + list(initScripts) + scripts + ['GVAR["dlbutton_href"]'] return self.js.eval('\n'.join(scripts)) - - -getInfo = create_getInfo(ZippyshareCom) diff --git a/module/plugins/internal/Account.py b/module/plugins/internal/Account.py index ba8db0a6d..c63d182d9 100644 --- a/module/plugins/internal/Account.py +++ b/module/plugins/internal/Account.py @@ -6,7 +6,7 @@ import threading import time from module.plugins.internal.Plugin import Plugin, Skip -from module.plugins.internal.utils import compare_time, isiterable, lock, parse_size, safe_format +from module.plugins.internal.misc import Periodical, compare_time, decode, isiterable, lock, parse_size class Account(Plugin): @@ -23,8 +23,6 @@ class Account(Plugin): LOGIN_TIMEOUT = 30 * 60 #: Relogin account every 30 minutes TUNE_TIMEOUT = True #: Automatically tune relogin interval - PERIODICAL_INTERVAL = None - def __init__(self, manager, accounts): self._init(manager.core) @@ -37,9 +35,9 @@ class Account(Plugin): self.timeout = self.LOGIN_TIMEOUT - #: Callback of periodical job task - self.cb = None - self.interval = None + #: Callback of periodical job task, used by HookManager + self.periodical = Periodical(self, self.periodical_task) + self.cb = self.periodical.cb #@TODO: Recheck in 0.4.10 self.init() @@ -66,56 +64,30 @@ class Account(Plugin): return bool(self.get_data('premium')) - def setup(self): - """ - Setup for enviroment and other things, called before logging (possibly more than one time) - """ - pass - - - def set_interval(self, value): - newinterval = max(0, self.PERIODICAL_INTERVAL, value) + def _log(self, level, plugintype, pluginname, messages): + log = getattr(self.pyload.log, level) + msg = u" | ".join(decode(a).strip() for a in messages if a) - if newinterval != value: - return False - - if newinterval != self.interval: - self.interval = newinterval - - return True - - - def start_periodical(self, interval=None, threaded=False, delay=None): - if interval is not None and self.set_interval(interval) is False: - return False - else: - self.cb = self.pyload.scheduler.addJob(max(1, delay), self._periodical, [threaded], threaded=threaded) - return True - - - def restart_periodical(self, *args, **kwargs): - self.stop_periodical() - return self.start_periodical(*args, **kwargs) - - - def stop_periodical(self): + #: Hide any password try: - return self.pyload.scheduler.removeJob(self.cb) - finally: - self.cb = None - + msg = msg.replace(self.info['login']['password'], "**********") + except Exception: + pass - def _periodical(self, threaded): - try: - self.periodical() + log("%(plugintype)s %(pluginname)s: %(msg)s" % + {'plugintype': plugintype.upper(), + 'pluginname': pluginname, + 'msg' : msg}) - except Exception, e: - self.log_error(_("Error performing periodical task"), e) - self.restart_periodical(threaded=threaded, delay=self.interval) + def setup(self): + """ + Setup for enviroment and other things, called before logging (possibly more than one time) + """ + pass - def periodical(self): + def periodical_task(self): raise NotImplementedError @@ -209,7 +181,7 @@ class Account(Plugin): self.sync() clear = lambda x: {} if isinstance(x, dict) else [] if isiterable(x) else None - self.info['data'] = dict((k, clear(v)) for k, v in self.info['data'].iteritems()) + self.info['data'] = dict((k, clear(v)) for k, v in self.info['data'].items()) self.info['data']['options'] = {'limitdl': ['0']} self.syncback() @@ -237,7 +209,7 @@ class Account(Plugin): self.syncback() - self.log_debug("Account info for user `%s`: %s" % (self.user, safe_format(self.info, self.info['login']['password']))) + self.log_debug("Account info for user `%s`: %s" % (self.user, self.info)) return self.info @@ -452,7 +424,7 @@ class Account(Plugin): ########################################################################### - def parse_traffic(self, size, unit=None): #@NOTE: Returns kilobytes in 0.4.9 + def parse_traffic(self, size, unit=None): #@NOTE: Returns kilobytes only in 0.4.9 self.log_debug("Size: %s" % size, "Unit: %s" % (unit or "N/D")) return parse_size(size, unit or "byte") / 1024 #@TODO: Remove `/ 1024` in 0.4.10 diff --git a/module/plugins/internal/Addon.py b/module/plugins/internal/Addon.py index ee0febffc..183186fd2 100644 --- a/module/plugins/internal/Addon.py +++ b/module/plugins/internal/Addon.py @@ -1,15 +1,9 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.Plugin import Plugin - +import threading -class Expose(object): - """ - Used for decoration to declare rpc services - """ - def __new__(cls, f, *args, **kwargs): - hookManager.addRPC(f.__module__, f.func_name, f.func_doc) - return f +from module.plugins.internal.Plugin import Plugin +from module.plugins.internal.misc import Periodical, isiterable def threaded(fn): @@ -19,10 +13,19 @@ def threaded(fn): return run +class Expose(object): + """ + Used for decoration to declare rpc services + """ + def __new__(cls, fn, *args, **kwargs): + hookManager.addRPC(fn.__module__, fn.func_name, fn.func_doc) + return fn + + class Addon(Plugin): __name__ = "Addon" __type__ = "hook" #@TODO: Change to `addon` in 0.4.10 - __version__ = "0.14" + __version__ = "0.50" __status__ = "stable" __threaded__ = [] #@TODO: Remove in 0.4.10 @@ -32,29 +35,24 @@ class Addon(Plugin): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - PERIODICAL_INTERVAL = None - - def __init__(self, core, manager): self._init(core) #: `HookManager` self.manager = manager + self.lock = threading.Lock() #: Automatically register event listeners for functions, attribute will be deleted dont use it yourself self.event_map = {} - #: Deprecated alternative to event_map - #: List of events the plugin can handle, name the functions exactly like eventname. - self.event_list = [] #@NOTE: dont make duplicate entries in event_map - self.info['ip'] = None #@TODO: Remove in 0.4.10 #: Callback of periodical job task, used by HookManager - self.cb = None - self.interval = None + self.periodical = Periodical(self, self.periodical_task) + self.cb = self.periodical.cb #@TODO: Recheck in 0.4.10 self.init() + self._init_events() #@TODO: Remove in 0.4.10 self.init_events() @@ -63,7 +61,7 @@ class Addon(Plugin): """ Checks if addon is activated """ - return self.get_config("activated") + return self.config.get("activated") #@TODO: Remove in 0.4.10 @@ -72,10 +70,25 @@ class Addon(Plugin): return super(Addon, self)._log(level, plugintype, pluginname, messages) + #@TODO: Remove in 0.4.10 + def _init_events(self): + event_map = {'allDownloadsFinished' : "all_downloads_finished" , + 'allDownloadsProcessed': "all_downloads_processed", + 'configChanged' : "config_changed" , + 'download_processed' : "download_processed" , + 'download_start' : "download_start" , + 'linksAdded' : "links_added" , + 'packageDeleted' : "package_deleted" , + 'package_failed' : "package_failed" , + 'package_processed' : "package_processed" } + for event, funcs in event_map.items(): + self.manager.addEvent(event, getattr(self, funcs)) + + def init_events(self): if self.event_map: for event, funcs in self.event_map.items(): - if type(funcs) in (list, tuple): + if isiterable(funcs): for f in funcs: self.manager.addEvent(event, getattr(self, f)) else: @@ -84,63 +97,13 @@ class Addon(Plugin): #: Delete for various reasons self.event_map = None - if self.event_list: - self.log_debug("Deprecated method `event_list`, use `event_map` instead") - - for f in self.event_list: - self.manager.addEvent(f, getattr(self, f)) - - self.event_list = None - - - def set_interval(self, value): - newinterval = max(0, self.PERIODICAL_INTERVAL, value) - - if newinterval != value: - return False - - if newinterval != self.interval: - self.interval = newinterval - - return True - - - def start_periodical(self, interval=None, threaded=False, delay=None): - if interval is not None and self.set_interval(interval) is False: - return False - else: - self.cb = self.pyload.scheduler.addJob(max(1, delay), self._periodical, [threaded], threaded=threaded) - return True - - - def restart_periodical(self, *args, **kwargs): - self.stop_periodical() - return self.start_periodical(*args, **kwargs) - - - def stop_periodical(self): - try: - return self.pyload.scheduler.removeJob(self.cb) - finally: - self.cb = None - - def _periodical(self, threaded): - try: - self.periodical() - - except Exception, e: - self.log_error(_("Error performing periodical task"), e) - - self.restart_periodical(threaded=threaded, delay=self.interval) - - - def periodical(self): + def periodical_task(self): raise NotImplementedError #: Deprecated method, use `activated` property instead (Remove in 0.4.10) - def isActivated(self, *args, **kwargs): + def isActivated(self): return self.activated @@ -152,9 +115,9 @@ class Addon(Plugin): #: Deprecated method, use `deactivate` instead (Remove in 0.4.10) - def unload(self, *args, **kwargs): - self.store("info", self.info) - return self.deactivate(*args, **kwargs) + def unload(self): + self.db.store("info", self.info) + return self.deactivate() def activate(self): @@ -165,13 +128,9 @@ class Addon(Plugin): #: Deprecated method, use `activate` instead (Remove in 0.4.10) - def coreReady(self, *args, **kwargs): - self.retrieve("info", self.info) - - if self.PERIODICAL_INTERVAL: - self.start_periodical(self.PERIODICAL_INTERVAL, delay=5) - - return self.activate(*args, **kwargs) + def coreReady(self): + self.db.retrieve("info", self.info) + return self.activate() def exit(self): @@ -182,9 +141,25 @@ class Addon(Plugin): #: Deprecated method, use `exit` instead (Remove in 0.4.10) - def coreExiting(self, *args, **kwargs): - self.unload(*args, **kwargs) #@TODO: Fix in 0.4.10 - return self.exit(*args, **kwargs) + def coreExiting(self): + self.unload() #@TODO: Fix in 0.4.10 + return self.exit() + + + def config_changed(self, category, option, value, section): + pass + + + def all_downloads_finished(self): + pass + + + def all_downloads_processed(self): + pass + + + def links_added(self, urls, pypack): + pass def download_preparing(self, pyfile): @@ -197,13 +172,22 @@ class Addon(Plugin): return self.download_preparing(pyfile) + def download_start(self, pyfile, url, filename): + pass + + + def download_processed(self, pyfile): + pass + + def download_finished(self, pyfile): pass #: Deprecated method, use `download_finished` instead (Remove in 0.4.10) - def downloadFinished(self, *args, **kwargs): - return self.download_finished(*args, **kwargs) + def downloadFinished(self, pyfile): + if pyfile.hasStatus("finished"): #: Check if still "finished" (Fix in 0.4.10) + return self.download_finished(pyfile) def download_failed(self, pyfile): @@ -211,8 +195,21 @@ class Addon(Plugin): #: Deprecated method, use `download_failed` instead (Remove in 0.4.10) - def downloadFailed(self, *args, **kwargs): - return self.download_failed(*args, **kwargs) + def downloadFailed(self, pyfile): + if pyfile.hasStatus("failed"): #: Check if still "failed" (Fix in 0.4.10) + return self.download_failed(pyfile) + + + def package_processed(self, pypack): + pass + + + def package_deleted(self, pid): + pass + + + def package_failed(self, pypack): + pass def package_finished(self, pypack): @@ -220,8 +217,8 @@ class Addon(Plugin): #: Deprecated method, use `package_finished` instead (Remove in 0.4.10) - def packageFinished(self, *args, **kwargs): - return self.package_finished(*args, **kwargs) + def packageFinished(self, pypack): + return self.package_finished(pypack) def before_reconnect(self, ip): @@ -229,8 +226,8 @@ class Addon(Plugin): #: Deprecated method, use `before_reconnect` instead (Remove in 0.4.10) - def beforeReconnecting(self, *args, **kwargs): - return self.before_reconnect(*args, **kwargs) + def beforeReconnecting(self, ip): + return self.before_reconnect(ip) def after_reconnect(self, ip, oldip): @@ -251,8 +248,8 @@ class Addon(Plugin): #: Deprecated method, use `captcha_task` instead (Remove in 0.4.10) - def newCaptchaTask(self, *args, **kwargs): - return self.captcha_task(*args, **kwargs) + def newCaptchaTask(self, task): + return self.captcha_task(task) def captcha_correct(self, task): @@ -260,8 +257,8 @@ class Addon(Plugin): #: Deprecated method, use `captcha_correct` instead (Remove in 0.4.10) - def captchaCorrect(self, *args, **kwargs): - return self.captcha_correct(*args, **kwargs) + def captchaCorrect(self, task): + return self.captcha_correct(task) def captcha_invalid(self, task): @@ -269,5 +266,5 @@ class Addon(Plugin): #: Deprecated method, use `captcha_invalid` instead (Remove in 0.4.10) - def captchaInvalid(self, *args, **kwargs): - return self.captcha_invalid(*args, **kwargs) + def captchaInvalid(self, task): + return self.captcha_invalid(task) diff --git a/module/plugins/internal/Base.py b/module/plugins/internal/Base.py index e28121ce2..47111ca8e 100644 --- a/module/plugins/internal/Base.py +++ b/module/plugins/internal/Base.py @@ -8,11 +8,11 @@ import urlparse from module.plugins.internal.Captcha import Captcha from module.plugins.internal.Plugin import Plugin, Abort, Fail, Reconnect, Retry, Skip -from module.plugins.internal.utils import (decode, encode, fixurl, format_size, format_time, - parse_html_form, parse_name, replace_patterns) +from module.plugins.internal.misc import (decode, encode, fixurl, format_size, format_time, + parse_html_form, parse_name, replace_patterns) -#@TODO: Remove in 0.4.10 +#@TODO: Recheck in 0.4.10 def getInfo(urls): #: result = [ .. (name, size, status, url) .. ] pass @@ -24,19 +24,10 @@ def parse_fileInfo(klass, url="", html=""): return encode(info['name']), info['size'], info['status'], info['url'] -#@TODO: Remove in 0.4.10 -def create_getInfo(klass): - def get_info(urls): - for url in urls: - yield parse_fileInfo(klass, url) - - return get_info - - class Base(Plugin): __name__ = "Base" __type__ = "base" - __version__ = "0.19" + __version__ = "0.20" __status__ = "stable" __pattern__ = r'^unmatchable$' @@ -55,6 +46,7 @@ class Base(Plugin): def get_info(cls, url="", html=""): url = fixurl(url, unquote=True) info = {'name' : parse_name(url), + 'hash' : {}, 'pattern': {}, 'size' : 0, 'status' : 3 if url else 8, @@ -72,9 +64,6 @@ class Base(Plugin): def __init__(self, pyfile): self._init(pyfile.m.core) - #: - self.premium = None - #: Engage wan reconnection self.wantReconnect = False #@TODO: Change to `want_reconnect` in 0.4.10 @@ -82,22 +71,25 @@ class Base(Plugin): self.multiDL = True #@TODO: Change to `multi_dl` in 0.4.10 #: time.time() + wait in seconds - self.waiting = False + self.waiting = False #: Account handler instance, see :py:class:`Account` self.account = None self.user = None #@TODO: Remove in 0.4.10 + self.premium = None #: Associated pyfile instance, see `PyFile` self.pyfile = pyfile - self.thread = None #: Holds thread in future + #: Holds thread in future + self.thread = None #: Js engine, see `JsEngine` self.js = self.pyload.js #: Captcha stuff - self.captcha = Captcha(self) + _Captcha = self.pyload.pluginManager.loadClass("captcha", self.classname) or Captcha + self.captcha = _Captcha(pyfile) #: Some plugins store html code here self.data = "" @@ -112,6 +104,13 @@ class Base(Plugin): def _log(self, level, plugintype, pluginname, messages): log = getattr(self.pyload.log, level) msg = u" | ".join(decode(a).strip() for a in messages if a) + + #: Hide any password + try: + msg = msg.replace(self.account.info['login']['password'], "**********") + except Exception: + pass + log("%(plugintype)s %(pluginname)s[%(id)s]: %(msg)s" % {'plugintype': plugintype.upper(), 'pluginname': pluginname, @@ -136,11 +135,12 @@ class Base(Plugin): def _setup(self): #@TODO: Remove in 0.4.10 - self.data = "" self.pyfile.error = "" - self.last_html = None + self.data = "" + self.last_html = "" + self.last_header = {} - if self.get_config('use_premium', True): + if self.config.get('use_premium', True): self.load_account() #@TODO: Move to PluginThread in 0.4.10 else: self.account = False @@ -193,7 +193,7 @@ class Base(Plugin): size = self.info.get('size') if size > 0: - self.pyfile.size = int(self.info['size']) #@TODO: Fix int conversion in 0.4.10 + self.pyfile.size = int(self.info.get('size')) #@TODO: Fix int conversion in 0.4.10 else: size = self.pyfile.size @@ -249,24 +249,29 @@ class Base(Plugin): self.abort() - def _process(self, thread): - """ - Handles important things to do before starting - """ + def _initialize(self): self.log_debug("Plugin version: " + self.__version__) self.log_debug("Plugin status: " + self.__status__) if self.__status__ is "broken": - self.fail(_("Plugin is temporarily unavailable")) + self.abort(_("Plugin is temporarily unavailable")) elif self.__status__ is "testing": self.log_warning(_("Plugin may be unstable")) + + def _process(self, thread): + """ + Handles important things to do before starting + """ self.thread = thread + + self._initialize() self._setup() - # self.pyload.hookManager.downloadPreparing(self.pyfile) #@TODO: Recheck in 0.4.10 - self.check_status() + #@TODO: Enable in 0.4.10 + # self.pyload.hookManager.downloadPreparing(self.pyfile) + # self.check_status() self.pyfile.setStatus("starting") @@ -277,6 +282,7 @@ class Base(Plugin): #: Deprecated method, use `_process` instead (Remove in 0.4.10) def preprocessing(self, *args, **kwargs): + time.sleep(1) #@NOTE: Recheck info thread synchronization in 0.4.10 return self._process(*args, **kwargs) @@ -320,15 +326,13 @@ class Base(Plugin): """ Waits the time previously set """ - pyfile = self.pyfile - if seconds is not None: self.set_wait(seconds) if reconnect is not None: self.set_reconnect(reconnect) - wait_time = pyfile.waitUntil - time.time() + wait_time = self.pyfile.waitUntil - time.time() if wait_time < 1: self.log_warning(_("Invalid wait time interval")) @@ -336,8 +340,8 @@ class Base(Plugin): self.waiting = True - status = pyfile.status #@NOTE: Recheck in 0.4.10 - pyfile.setStatus("waiting") + status = self.pyfile.status #@NOTE: Recheck in 0.4.10 + self.pyfile.setStatus("waiting") self.log_info(_("Waiting %s...") % format_time(wait_time)) @@ -347,12 +351,12 @@ class Base(Plugin): self.log_warning(_("Reconnection ignored due logged account")) if not self.wantReconnect or self.account: - while pyfile.waitUntil > time.time(): + while self.pyfile.waitUntil > time.time(): self.check_status() time.sleep(2) else: - while pyfile.waitUntil > time.time(): + while self.pyfile.waitUntil > time.time(): self.check_status() self.thread.m.reconnecting.wait(1) @@ -366,7 +370,7 @@ class Base(Plugin): time.sleep(2) self.waiting = False - pyfile.status = status #@NOTE: Recheck in 0.4.10 + self.pyfile.status = status #@NOTE: Recheck in 0.4.10 def skip(self, msg=""): diff --git a/module/plugins/internal/Captcha.py b/module/plugins/internal/Captcha.py index d30271dd4..fe0830693 100644 --- a/module/plugins/internal/Captcha.py +++ b/module/plugins/internal/Captcha.py @@ -6,13 +6,13 @@ import os import time from module.plugins.internal.Plugin import Plugin -from module.plugins.internal.utils import encode +from module.plugins.internal.misc import encode class Captcha(Plugin): __name__ = "Captcha" __type__ = "captcha" - __version__ = "0.47" + __version__ = "0.48" __status__ = "stable" __description__ = """Base anti-captcha plugin""" @@ -20,10 +20,10 @@ class Captcha(Plugin): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - def __init__(self, plugin): #@TODO: Pass pyfile instead plugin, so store plugin's html in its associated pyfile as data - self._init(plugin.pyload) + def __init__(self, pyfile): + self._init(pyfile.m.core) - self.plugin = plugin + self.pyfile = pyfile self.task = None #: captchaManager task self.init() @@ -31,28 +31,27 @@ class Captcha(Plugin): def _log(self, level, plugintype, pluginname, messages): messages = (self.__name__,) + messages - return self.plugin._log(level, plugintype, self.plugin.__name__, messages) + return self.pyfile.plugin._log(level, plugintype, self.pyfile.plugin.__name__, messages) def recognize(self, image): """ Extend to build your custom anti-captcha ocr """ - self.log_debug("This function does nothing") pass def decrypt(self, url, get={}, post={}, ref=False, cookies=True, decode=False, req=None, input_type='jpg', output_type='textual', ocr=True, timeout=120): - img = self.load(url, get=get, post=post, ref=ref, cookies=cookies, decode=decode, req=req or self.plugin.req) + img = self.load(url, get=get, post=post, ref=ref, cookies=cookies, decode=decode, req=req or self.pyfile.plugin.req) return self.decrypt_image(img, input_type, output_type, ocr, timeout) - def decrypt_image(self, data, input_type='jpg', output_type='textual', ocr=False, timeout=120): + def decrypt_image(self, img, input_type='jpg', output_type='textual', ocr=False, timeout=120): """ Loads a captcha and decrypts it with ocr, plugin, user input - :param data: image raw data + :param img: image raw data :param get: get part for request :param post: post part for request :param cookies: True if cookies should be enabled @@ -67,27 +66,27 @@ class Captcha(Plugin): result = "" time_ref = ("%.2f" % time.time())[-6:].replace(".", "") - with open(os.path.join("tmp", "captcha_image_%s_%s.%s" % (self.plugin.__name__, time_ref, input_type)), "wb") as tmp_img: - tmp_img.write(encode(data)) + with open(os.path.join("tmp", "captcha_image_%s_%s.%s" % (self.pyfile.plugin.__name__, time_ref, input_type)), "wb") as img_f: + img_f.write(encode(img)) if ocr: if isinstance(ocr, basestring): - OCR = self.pyload.pluginManager.loadClass("captcha", ocr) #: Rename `captcha` to `ocr` in 0.4.10 - result = OCR(self.plugin).recognize(tmp_img.name) + _OCR = self.pyload.pluginManager.loadClass("captcha", ocr) #: Rename `captcha` to `ocr` in 0.4.10 + result = _OCR(self.pyfile).recognize(img_f.name) else: - result = self.recognize(tmp_img.name) + result = self.recognize(img_f.name) if not result: captchaManager = self.pyload.captchaManager try: - self.task = captchaManager.newTask(data, input_type, tmp_img.name, output_type) + self.task = captchaManager.newTask(img, input_type, img_f.name, output_type) captchaManager.handleCaptcha(self.task) self.task.setWaiting(max(timeout, 50)) #@TODO: Move to `CaptchaManager` in 0.4.10 while self.task.isWaiting(): - self.plugin.check_status() + self.pyfile.plugin.check_status() time.sleep(1) finally: @@ -97,16 +96,12 @@ class Captcha(Plugin): self.fail(self.task.error) elif not self.task.result: - self.plugin.retry_captcha(msg=_("No captcha result obtained in appropriate time")) + self.pyfile.plugin.retry_captcha(msg=_("No captcha result obtained in appropriate time")) result = self.task.result if not self.pyload.debug: - try: - os.remove(tmp_img.name) - - except OSError, e: - self.log_warning(_("Error removing `%s`") % tmp_img.name, e) + self.remove(img_f.name, trash=False) # self.log_info(_("Captcha result: ") + result) #@TODO: Remove from here? diff --git a/module/plugins/internal/CaptchaService.py b/module/plugins/internal/CaptchaService.py index 397f4f750..6f08d4498 100644 --- a/module/plugins/internal/CaptchaService.py +++ b/module/plugins/internal/CaptchaService.py @@ -27,7 +27,7 @@ class CaptchaService(Captcha): def retrieve_data(self): - return self.plugin.data or self.plugin.last_html or "" + return self.pyfile.plugin.data or self.pyfile.plugin.last_html or "" def detect_key(self, data=None): diff --git a/module/plugins/internal/Container.py b/module/plugins/internal/Container.py index cff4ac4ec..db14a286e 100644 --- a/module/plugins/internal/Container.py +++ b/module/plugins/internal/Container.py @@ -4,21 +4,22 @@ from __future__ import with_statement import os import re +import urlparse from module.plugins.internal.Crypter import Crypter -from module.plugins.internal.utils import encode, exists, fs_join +from module.plugins.internal.misc import encode, exists class Container(Crypter): __name__ = "Container" __type__ = "container" - __version__ = "0.09" + __version__ = "0.10" __status__ = "stable" __pattern__ = r'^unmatchable$' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available", True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default")] __description__ = """Base container decrypter plugin""" __license__ = "GPLv3" @@ -30,30 +31,39 @@ class Container(Crypter): """ Main method """ - self._load2disk() + self._make_tmpfile() self.decrypt(pyfile) - self.delete_tmp() - if self.links: self._generate_packages() elif not self.packages: self.error(_("No link grabbed"), "decrypt") + self._delete_tmpfile() + self._create_packages() - def _load2disk(self): + def _delete_tmpfile(self): + if self.pyfile.name.startswith("tmp_"): + self.remove(pyfile.url, trash=False) + + + def _make_tmpfile(self): """ Loads container to disk if its stored remotely and overwrite url, or check existent on several places at disk """ - if self.pyfile.url.startswith("http"): - self.pyfile.name = re.findall("([^\/=]+)", self.pyfile.url)[-1] + remote = bool(urlparse.urlparse(self.pyfile.url).netloc) + + if remote: content = self.load(self.pyfile.url) - self.pyfile.url = fs_join(self.pyload.config.get("general", "download_folder"), self.pyfile.name) + + self.pyfile.name = "tmp_" + self.pyfile.name + self.pyfile.url = os.path.join(self.pyload.config.get("general", "download_folder"), self.pyfile.name) + try: with open(self.pyfile.url, "wb") as f: f.write(encode(content)) @@ -61,23 +71,5 @@ class Container(Crypter): except IOError, e: self.fail(e) - else: - self.pyfile.name = os.path.basename(self.pyfile.url) - - if not exists(self.pyfile.url): - if exists(fs_join(pypath, self.pyfile.url)): - self.pyfile.url = fs_join(pypath, self.pyfile.url) - else: - self.fail(_("File not exists")) - else: - self.data = self.pyfile.url #@NOTE: ??? - - - def delete_tmp(self): - if not self.pyfile.name.startswith("tmp_"): - return - - try: - os.remove(self.pyfile.url) - except OSError, e: - self.log_warning(_("Error removing `%s`") % self.pyfile.url, e) + elif not exists(self.pyfile.url): + self.fail(_("File not found")) diff --git a/module/plugins/internal/Crypter.py b/module/plugins/internal/Crypter.py index 157ce5dab..596bbcfb4 100644 --- a/module/plugins/internal/Crypter.py +++ b/module/plugins/internal/Crypter.py @@ -1,20 +1,19 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.Base import Base, create_getInfo, parse_fileInfo -from module.plugins.internal.utils import fixname, parse_name +from module.plugins.internal.Base import Base +from module.plugins.internal.misc import parse_name, safename class Crypter(Base): __name__ = "Crypter" __type__ = "crypter" - __version__ = "0.14" + __version__ = "0.16" __status__ = "stable" __pattern__ = r'^unmatchable$' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), #: Overrides pyload.config.get("general", "folder_per_package") - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available", True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default")] __description__ = """Base decrypter plugin""" __license__ = "GPLv3" @@ -23,18 +22,15 @@ class Crypter(Base): def init_base(self): self.packages = [] #: Put all packages here. It's a list of tuples like: ( name, [list of links], folder ) - self.links = [] #: List of urls, pyLoad will generate packagenames + self.links = [] #: List of urls, pyLoad will generate packagenames def setup_base(self): self.packages = [] - self.links = [] + self.links = [] def process(self, pyfile): - """ - Main method - """ self.decrypt(pyfile) if self.links: @@ -57,7 +53,8 @@ class Crypter(Base): """ Generate new packages from self.links """ - packages = [(name, links, None) for name, links in self.pyload.api.generatePackages(self.links).items()] + pdict = self.pyload.api.generatePackages(self.links) + packages = [(name, links, parse_name(name)) for name, links in pdict.items()] self.packages.extend(packages) @@ -65,41 +62,37 @@ class Crypter(Base): """ Create new packages from self.packages """ - package_folder = self.pyfile.package().folder - package_password = self.pyfile.package().password - package_queue = self.pyfile.package().queue + pack_folder = self.pyfile.package().folder + pack_password = self.pyfile.package().password + pack_queue = self.pyfile.package().queue + + folder_per_package = self.config.get('folder_per_package', "Default") - folder_per_package = self.pyload.config.get("general", "folder_per_package") - use_subfolder = self.get_config('use_subfolder', folder_per_package) - subfolder_per_package = self.get_config('subfolder_per_package', True) + if folder_per_package is "Default": + folder_per_package = self.pyload.config.get("general", "folder_per_package") for name, links, folder in self.packages: - self.log_info(_("Parsed package: %s") % name, - _("Found %d links") % len(links), - _("Saved to folder: %s") % folder if folder else _("Saved to default download folder")) + self.log_info(_("Create package: %s") % name, + _("%d links") % len(links)) links = map(self.fixurl, links) self.log_debug("LINKS for package " + name, *links) - pid = self.pyload.api.addPackage(name, links, package_queue) + pid = self.pyload.api.addPackage(name, links, pack_queue) - if package_password: - self.pyload.api.setPackageData(pid, {'password': package_password}) + if pack_password: + self.pyload.api.setPackageData(pid, {'password': pack_password}) #: Workaround to do not break API addPackage method - set_folder = lambda x="": self.pyload.api.setPackageData(pid, {'folder': fixname(x)}) + set_folder = lambda x: self.pyload.api.setPackageData(pid, {'folder': safename(x or "")}) - if use_subfolder: - if not subfolder_per_package: - set_folder(package_folder) - self.log_debug("Set package %(name)s folder to: %(folder)s" % {'name': name, 'folder': folder}) + if not folder_per_package: + folder = pack_folder - elif not folder_per_package or name is not folder: - if not folder: - folder = parse_name(name) + elif not folder or folder == name: + folder = parse_name(name) - set_folder(folder) - self.log_debug("Set package %(name)s folder to: %(folder)s" % {'name': name, 'folder': folder}) + self.log_info(_("Save package `%(name)s` to folder: %(folder)s") + % {'name': name, 'folder': folder}) - elif folder_per_package: - set_folder() + set_folder(folder) diff --git a/module/plugins/internal/DeadCrypter.py b/module/plugins/internal/DeadCrypter.py index 5618667ba..0ad81db6c 100644 --- a/module/plugins/internal/DeadCrypter.py +++ b/module/plugins/internal/DeadCrypter.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.Crypter import Crypter, create_getInfo +from module.plugins.internal.Crypter import Crypter class DeadCrypter(Crypter): __name__ = "DeadCrypter" __type__ = "crypter" - __version__ = "0.10" + __version__ = "0.11" __status__ = "stable" __pattern__ = r'^unmatchable$' @@ -26,6 +26,3 @@ class DeadCrypter(Crypter): def setup(self): self.offline(_("Crypter is no longer available")) - - -getInfo = create_getInfo(DeadCrypter) diff --git a/module/plugins/internal/DeadHoster.py b/module/plugins/internal/DeadHoster.py index 329f2fdea..430c5eab0 100644 --- a/module/plugins/internal/DeadHoster.py +++ b/module/plugins/internal/DeadHoster.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.Hoster import Hoster, create_getInfo +from module.plugins.internal.Hoster import Hoster class DeadHoster(Hoster): __name__ = "DeadHoster" __type__ = "hoster" - __version__ = "0.20" + __version__ = "0.21" __status__ = "stable" __pattern__ = r'^unmatchable$' @@ -26,6 +26,3 @@ class DeadHoster(Hoster): def setup(self): self.offline(_("Hoster is no longer available")) - - -getInfo = create_getInfo(DeadHoster) diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index 41ba4d429..1d035f3e6 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -5,7 +5,7 @@ import re from module.PyFile import PyFile from module.plugins.internal.Plugin import Plugin -from module.plugins.internal.utils import encode +from module.plugins.internal.misc import encode class ArchiveError(Exception): @@ -40,7 +40,7 @@ class Extractor(Plugin): @classmethod def isarchive(cls, filename): name = os.path.basename(filename).lower() - return any(name.endswith(ext) for ext in cls.EXTENSIONS) + return any(name.endswith('.' + ext) for ext in cls.EXTENSIONS) @classmethod @@ -63,43 +63,48 @@ class Extractor(Plugin): :param files_ids: List of filepathes :return: List of targets, id tuple list """ - targets = [] + targets = [] processed = [] - for fname, id, fout in files_ids: - if cls.isarchive(fname): - pname = re.sub(cls.re_multipart, "", fname) if cls.ismultipart(fname) else os.path.splitext(fname)[0] - if pname not in processed: - processed.append(pname) - targets.append((fname, id, fout)) + for id, fname, fout in files_ids: + if not cls.isarchive(fname): + continue + + if cls.ismultipart(fname): + pname = re.sub(cls._RE_PART, "", fname) + else: + pname = os.path.splitext(fname)[0] + + if pname in processed: + continue + + processed.append(pname) + targets.append((id, fname, fout)) return targets - def __init__(self, plugin, filename, out, + def __init__(self, pyfile, filename, out, fullpath=True, overwrite=False, excludefiles=[], priority=0, - keepbroken=False, - fid=None): + keepbroken=False): """ Initialize extractor for specific file """ - self._init(plugin.pyload) + self._init(pyfile.m.core) - self.plugin = plugin + self.pyfile = pyfile self.filename = filename + self.name = os.path.basename(filename) self.out = out self.fullpath = fullpath self.overwrite = overwrite self.excludefiles = excludefiles self.priority = priority self.keepbroken = keepbroken - self.files = [] #: Store extracted files here - - pyfile = self.pyload.files.getFile(fid) if fid else None - self.notify_progress = lambda x: pyfile.setProgress(x) if pyfile else lambda x: None + self.progress = lambda x: pyfile.setProgress(int(x)) self.init() @@ -109,9 +114,14 @@ class Extractor(Plugin): return encode(self.filename) + @property + def dest(self): + return encode(self.out) + + def _log(self, level, plugintype, pluginname, messages): messages = (self.__name__,) + messages - return self.plugin._log(level, plugintype, self.plugin.__name__, messages) + return self.pyfile.plugin._log(level, plugintype, self.pyfile.plugin.__name__, messages) def verify(self, password=None): @@ -134,7 +144,7 @@ class Extractor(Plugin): raise NotImplementedError - def items(self): + def chunks(self): """ Return list of archive parts """ @@ -143,6 +153,6 @@ class Extractor(Plugin): def list(self, password=None): """ - Populate self.files at some point while extracting + Return list of archive files """ - return self.files + raise NotImplementedError diff --git a/module/plugins/internal/Hoster.py b/module/plugins/internal/Hoster.py index f5ba13875..6d88732ea 100644 --- a/module/plugins/internal/Hoster.py +++ b/module/plugins/internal/Hoster.py @@ -2,14 +2,15 @@ from __future__ import with_statement +import hashlib import mimetypes import os import re from module.network.HTTPRequest import BadHeader -from module.plugins.internal.Base import Base, create_getInfo, parse_fileInfo +from module.plugins.internal.Base import Base from module.plugins.internal.Plugin import Fail, Retry -from module.plugins.internal.utils import encode, exists, fixurl, fs_join, parse_name +from module.plugins.internal.misc import compute_checksum, encode, exists, fixurl, fsjoin, parse_name, safejoin class Hoster(Base): @@ -19,16 +20,26 @@ class Hoster(Base): __status__ = "stable" __pattern__ = r'^unmatchable$' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("fallback" , "bool", "Fallback to free download if premium fails", True), - ("chk_filesize", "bool", "Check file size" , True)] + __config__ = [("activated" , "bool", "Activated" , True ), + ("use_premium", "bool", "Use premium account if available" , True ), + ("fallback" , "bool", "Fallback to free download if premium fails", True )] __description__ = """Base hoster plugin""" __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + @property + def last_download(self): + return self._last_download if exists(self._last_download) else "" + + + @last_download.setter + def last_download(self, value): + if exists(value): + self._last_download = value or "" + + def init_base(self): #: Enable simultaneous processing of multiple downloads self.limitDL = 0 #@TODO: Change to `limit_dl` in 0.4.10 @@ -40,7 +51,7 @@ class Hoster(Base): self.resume_download = False #: Location where the last call to download was saved - self.last_download = None + self._last_download = "" #: Re match of the last call to `checkDownload` self.last_check = None @@ -72,40 +83,66 @@ class Hoster(Base): def _process(self, thread): - self.log_debug("Plugin version: " + self.__version__) - self.log_debug("Plugin status: " + self.__status__) - - if self.__status__ is "broken": - self.fail(_("Plugin is temporarily unavailable")) - - elif self.__status__ is "testing": - self.log_warning(_("Plugin may be unstable")) - self.thread = thread + + self._initialize() self._setup() - # self.pyload.hookManager.downloadPreparing(self.pyfile) #@TODO: Recheck in 0.4.10 - self.check_status() + #@TODO: Enable in 0.4.10 + # self.pyload.hookManager.downloadPreparing(self.pyfile) + # self.check_status() + self.check_duplicates() self.pyfile.setStatus("starting") try: + self.log_info(_("Processing url: ") + self.pyfile.url) self.process(self.pyfile) self.check_status() - self.check_download() + + self._check_download() except Fail, e: #@TODO: Move to PluginThread in 0.4.10 - if self.get_config('fallback', True) and self.premium: + if self.config.get('fallback', True) and self.premium: self.log_warning(_("Premium download failed"), e) self.restart(premium=False) else: raise Fail(encode(e)) + finally: + self._finalize() + + + #@TODO: Remove in 0.4.10 + def _finalize(self): + pypack = self.pyfile.package() + + self.pyload.hookManager.dispatchEvent("download_processed", self.pyfile) + + try: + unfinished = any(fdata['status'] is 3 for fid, fdata in pypack.getChildren().items() + if fid is not self.pyfile.id) + if unfinished: + return + + self.pyload.hookManager.dispatchEvent("package_processed", pypack) + + failed = any(fdata['status'] in (1, 6, 8, 9, 14) + for fid, fdata in pypack.getChildren().items()) + + if not failed: + return + + self.pyload.hookManager.dispatchEvent("package_failed", pypack) + + finally: + self.check_status() + def isdownload(self, url, resume=None, redirect=True): link = False - maxredirs = 10 + maxredirs = 5 if resume is None: resume = self.resume_download @@ -114,7 +151,7 @@ class Hoster(Base): maxredirs = max(redirect, 1) elif redirect: - maxredirs = self.get_config("maxredirs", default=maxredirs, plugin="UserAgentSwitcher") + maxredirs = int(self.pyload.api.getConfigValue("UserAgentSwitcher", "maxredirs", "plugin")) or maxredirs #@TODO: Remove `int` in 0.4.10 for i in xrange(maxredirs): self.log_debug("Redirect #%d to: %s" % (i, url)) @@ -128,10 +165,10 @@ class Hoster(Base): location = self.fixurl(header.get('location'), url) code = header.get('code') - if code == 302: + if code is 302: link = location - elif code == 301: + elif code is 301: url = location if redirect: continue @@ -176,7 +213,8 @@ class Hoster(Base): if self.pyload.debug: self.log_debug("DOWNLOAD URL " + url, - *["%s=%s" % (key, val) for key, val in locals().items() if key not in ("self", "url", "_[1]")]) + *["%s=%s" % (key, value) for key, value in locals().items() + if key not in ("self", "url", "_[1]")]) dl_url = self.fixurl(url) dl_basename = parse_name(self.pyfile.name) @@ -184,15 +222,13 @@ class Hoster(Base): self.pyfile.name = dl_basename self.captcha.correct() - - if self.pyload.config.get("download", "skip_existing"): - self.check_filedupe() + self.check_duplicates() self.pyfile.setStatus("downloading") dl_folder = self.pyload.config.get("general", "download_folder") - dl_dirname = os.path.join(dl_folder, self.pyfile.package().folder) - dl_filename = os.path.join(dl_dirname, dl_basename) + dl_dirname = safejoin(dl_folder, self.pyfile.package().folder) + dl_filename = safejoin(dl_dirname, dl_basename) dl_dir = encode(dl_dirname) dl_file = encode(dl_filename) #@TODO: Move safe-filename check to HTTPDownload in 0.4.10 @@ -212,7 +248,7 @@ class Hoster(Base): dl_chunks = self.pyload.config.get("download", "chunks") chunk_limit = chunks or self.chunk_limit or -1 - if dl_chunks is -1 or chunk_limit is -1: + if -1 in (dl_chunks, chunk_limit): chunks = max(dl_chunks, chunk_limit) else: chunks = min(dl_chunks, chunk_limit) @@ -233,15 +269,11 @@ class Hoster(Base): self.pyfile.size = self.req.size if self.req.code in (404, 410): - bad_file = fs_join(dl_dirname, newname) - try: - os.remove(bad_file) - - except OSError, e: - self.log_debug(_("Error removing `%s`") % bad_file, e) - - else: + bad_file = fsjoin(dl_dirname, newname) + if self.remove(bad_file): return "" + else: + self.log_info(_("File saved")) #@TODO: Recheck in 0.4.10 if disposition and newname: @@ -249,8 +281,8 @@ class Hoster(Base): if safename != newname: try: - old_file = fs_join(dl_dirname, newname) - new_file = fs_join(dl_dirname, safename) + old_file = fsjoin(dl_dirname, newname) + new_file = fsjoin(dl_dirname, safename) os.rename(old_file, new_file) except OSError, e: @@ -272,158 +304,178 @@ class Hoster(Base): return dl_filename - def check_filesize(self, file_size, size_tolerance=1024): - """ - Checks the file size of the last downloaded file - - :param file_size: expected file size - :param size_tolerance: size check tolerance - """ - if not self.last_download: - return - - dl_location = encode(self.last_download) - dl_size = os.stat(dl_location).st_size - - if dl_size < 1: - self.fail(_("Empty file")) - - elif file_size > 0: - diff = abs(file_size - dl_size) - - if diff > size_tolerance: - self.fail(_("File size mismatch | Expected file size: %s | Downloaded file size: %s") - % (file_size, dl_size)) - - elif diff != 0: - self.log_warning(_("File size is not equal to expected size")) - - - def check_file(self, rules, delete=False, read_size=1048576, file_size=0, size_tolerance=1024): + def scan_download(self, rules, read_size=1048576): """ Checks the content of the last downloaded file, re match is saved to `last_check` :param rules: dict with names and rules to match (compiled regexp or strings) :param delete: delete if matched - :param file_size: expected file size - :param size_tolerance: size check tolerance - :param read_size: amount of bytes to read from files :return: dictionary key of the first rule that matched """ - do_delete = False - last_download = encode(self.last_download) #@TODO: Recheck in 0.4.10 + dl_file = encode(self.last_download) #@TODO: Recheck in 0.4.10 - if not self.last_download or not exists(last_download): - self.fail(self.pyfile.error or _("No file downloaded")) + if not self.last_download: + self.log_warning(_("No file to scan")) + return - try: - self.check_filesize(file_size, size_tolerance) - - with open(last_download, "rb") as f: - content = f.read(read_size) - - #: Produces encoding errors, better log to other file in the future? - # self.log_debug("Content: %s" % content) - for name, rule in rules.items(): - if isinstance(rule, basestring): - if rule in content: - do_delete = True - return name - - elif hasattr(rule, "search"): - m = rule.search(content) - if m is not None: - do_delete = True - self.last_check = m - return name - finally: - if delete and do_delete: - try: - os.remove(last_download) + with open(dl_file, "rb") as f: + content = f.read(read_size) - except OSError, e: - self.log_warning(_("Error removing `%s`") % last_download, e) + #: Produces encoding errors, better log to other file in the future? + # self.log_debug("Content: %s" % content) + for name, rule in rules.items(): + if isinstance(rule, basestring): + if rule in content: + return name - else: - self.log_info(_("File deleted: ") + self.last_download) - self.last_download = "" #: Recheck in 0.4.10 + elif hasattr(rule, "search"): + m = rule.search(content) + if m is not None: + self.last_check = m + return name - def check_download(self): - self.log_info(_("Checking downloaded file...")) + def _check_download(self): + self.log_info(_("Checking download...")) + self.pyfile.setCustomStatus(_("checking")) - if self.captcha.task and not self.last_download: - self.retry_captcha() + if not self.last_download: + if self.captcha.task: + self.retry_captcha() + else: + self.error(_("No file downloaded")) - elif self.check_file({'Empty file': re.compile(r'\A((.|)(\2|\s)*)\Z')}, - delete=True): + elif self.scan_download({'Empty file': re.compile(r'\A((.|)(\2|\s)*)\Z')}): + if self.remove(self.last_download): + self.last_download = "" self.error(_("Empty file")) - elif self.get_config('chk_filesize', False) and self.info.get('size'): - # 10485760 is 10MB, tolerance is used when comparing displayed size on the hoster website to real size - # For example displayed size can be 1.46GB for example, but real size can be 1.4649853GB - self.check_filesize(self.info['size'], size_tolerance=10485760) - else: - self.log_info(_("File is OK")) + self.pyload.hookManager.dispatchEvent("download_check", self.pyfile) + self.check_status() + self.log_info(_("File is OK")) - def check_traffic(self): + + def out_of_traffic(self): if not self.account: - return True + return traffic = self.account.get_data('trafficleft') if traffic is None: - return False + return True elif traffic is -1: - return True + return False else: #@TODO: Rewrite in 0.4.10 size = self.pyfile.size / 1024 self.log_info(_("Filesize: %s KiB") % size, _("Traffic left for user `%s`: %d KiB") % (self.account.user, traffic)) - return size <= traffic + return size > traffic - def check_filedupe(self): - """ - Checks if same file was/is downloaded within same package + # def check_size(self, file_size, size_tolerance=1024, delete=False): + # """ + # Checks the file size of the last downloaded file - :param starting: indicates that the current download is going to start - :raises Skip: - """ - pack = self.pyfile.package() + # :param file_size: expected file size + # :param size_tolerance: size check tolerance + # """ + # self.log_info(_("Checking file size...")) + + # if not self.last_download: + # self.log_warning(_("No file to check")) + # return - for pyfile in self.pyload.files.cache.values(): - if pyfile is self.pyfile: - continue + # dl_file = encode(self.last_download) + # dl_size = os.stat(dl_file).st_size - if pyfile.name != self.pyfile.name or pyfile.package().folder != pack.folder: - continue + # try: + # if dl_size == 0: + # delete = True + # self.fail(_("Empty file")) - if pyfile.status in (0, 5, 7, 12): #: (finished, waiting, starting, downloading) - self.skip(pyfile.pluginname) + # elif file_size > 0: + # diff = abs(file_size - dl_size) - dl_folder = self.pyload.config.get("general", "download_folder") - package_folder = pack.folder if self.pyload.config.get("general", "folder_per_package") else "" - dl_location = fs_join(dl_folder, package_folder, self.pyfile.name) + # if diff > size_tolerance: + # self.fail(_("File size mismatch | Expected file size: %s bytes | Downloaded file size: %s bytes") + # % (file_size, dl_size)) - if not exists(dl_location): + # elif diff != 0: + # self.log_warning(_("File size is not equal to expected download size, but does not exceed the tolerance threshold")) + # self.log_debug("Expected file size: %s bytes" % file_size, + # "Downloaded file size: %s bytes" % dl_size, + # "Tolerance threshold: %s bytes" % size_tolerance) + # else: + # delete = False + # self.log_info(_("File size match")) + + # finally: + # if delete: + # self.remove(dl_file, trash=False) + + + # def check_hash(self, type, digest, delete=False): + # hashtype = type.strip('-').upper() + + # self.log_info(_("Checking file hashsum %s...") % hashtype) + + # if not self.last_download: + # self.log_warning(_("No file to check")) + # return + + # dl_file = encode(self.last_download) + + # try: + # dl_hash = digest + # file_hash = compute_checksum(dl_file, hashtype) + + # if not file_hash: + # self.fail(_("Unsupported hashing algorithm: ") + hashtype) + + # elif dl_hash == file_hash: + # delete = False + # self.log_info(_("File hashsum %s match") % hashtype) + + # else: + # self.fail(_("File hashsum %s mismatch | Expected file hashsum: %s | Downloaded file hashsum: %s") + # % (hashtype, dl_hash, file_hash)) + # finally: + # if delete: + # self.remove(dl_file, trash=False) + + + def check_duplicates(self): + """ + Checks if same file was downloaded within same package + + :raises Skip: + """ + pack_folder = self.pyfile.package().folder if self.pyload.config.get("general", "folder_per_package") else "" + dl_folder = self.pyload.config.get("general", "download_folder") + dl_file = fsjoin(dl_folder, pack_folder, self.pyfile.name) + + if not exists(dl_file): return - pyfile = self.pyload.db.findDuplicates(self.pyfile.id, package_folder, self.pyfile.name) - if pyfile: - self.skip(pyfile[0]) + if os.stat(dl_file).st_size == 0: + if self.remove(self.last_download): + self.last_download = "" + return - size = os.stat(dl_location).st_size - if size >= self.pyfile.size: - self.skip(_("File exists")) + if self.pyload.config.get("download", "skip_existing"): + plugin = self.pyload.db.findDuplicates(self.pyfile.id, pack_folder, self.pyfile.name) + msg = plugin[0] if plugin else _("File exists") + self.skip(msg) + else: + dl_n = int(re.match(r'.+(\(\d+\)|)$', self.pyfile.name).group(1).strip("()") or 1) + self.pyfile.name += " (%s)" % (dl_n + 1) - #: Deprecated method, use `check_filedupe` instead (Remove in 0.4.10) + #: Deprecated method (Recheck in 0.4.10) def checkForSameFiles(self, *args, **kwargs): - if self.pyload.config.get("download", "skip_existing"): - return self.check_filedupe() + pass diff --git a/module/plugins/internal/MultiAccount.py b/module/plugins/internal/MultiAccount.py index f9252cc10..90cb0e748 100644 --- a/module/plugins/internal/MultiAccount.py +++ b/module/plugins/internal/MultiAccount.py @@ -1,16 +1,12 @@ # -*- coding: utf-8 -*- -import re -import time - from module.plugins.internal.Account import Account -from module.plugins.internal.utils import decode, remove_chars, uniqify class MultiAccount(Account): __name__ = "MultiAccount" __type__ = "account" - __version__ = "0.04" + __version__ = "0.05" __status__ = "broken" __config__ = [("activated" , "bool" , "Activated" , True ), @@ -22,248 +18,3 @@ class MultiAccount(Account): __description__ = """Multi-hoster account plugin""" __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - # PERIODICAL_INTERVAL = 1 * 60 * 60 #: 1 hour - PERIODICAL_LOGIN = False - - DOMAIN_REPLACEMENTS = [(r'180upload\.com' , "hundredeightyupload.com"), - (r'bayfiles\.net' , "bayfiles.com" ), - (r'cloudnator\.com' , "shragle.com" ), - (r'dfiles\.eu' , "depositfiles.com" ), - (r'easy-share\.com' , "crocko.com" ), - (r'freakshare\.net' , "freakshare.com" ), - (r'hellshare\.com' , "hellshare.cz" ), - (r'ifile\.it' , "filecloud.io" ), - (r'nowdownload\.\w+', "nowdownload.sx" ), - (r'nowvideo\.\w+' , "nowvideo.sx" ), - (r'putlocker\.com' , "firedrive.com" ), - (r'share-?rapid\.cz', "multishare.cz" ), - (r'ul\.to' , "uploaded.to" ), - (r'uploaded\.net' , "uploaded.to" ), - (r'uploadhero\.co' , "uploadhero.com" ), - (r'zshares\.net' , "zshare.net" ), - (r'^1' , "one" ), - (r'^2' , "two" ), - (r'^3' , "three" ), - (r'^4' , "four" ), - (r'^5' , "five" ), - (r'^6' , "six" ), - (r'^7' , "seven" ), - (r'^8' , "eight" ), - (r'^9' , "nine" ), - (r'^0' , "zero" )] - - - def init(self): - self.plugins = [] - self.supported = [] - self.newsupported = [] - - self.pluginclass = None - self.pluginmodule = None - self.plugintype = None - - self.init_plugin() - - - def init_plugin(self): - plugin, self.plugintype = self.pyload.pluginManager.findPlugin(self.classname) - - if plugin: - self.pluginmodule = self.pyload.pluginManager.loadModule(self.plugintype, self.classname) - self.pluginclass = self.pyload.pluginManager.loadClass(self.plugintype, self.classname) - else: - self.log_warning(_("Multi-hoster feature will be deactivated due missing plugin reference")) - self.set_config('multi', False) - - - def activate(self): - interval = self.get_config('multi_interval') * 60 * 60 - self.start_periodical(interval, threaded=True) - - - def replace_domains(self, list): - for r in self.DOMAIN_REPLACEMENTS: - pattern, repl = r - regex = re.compile(pattern, re.I | re.U) - domains = [regex.sub(repl, domain) if regex.match(domain) else domain for domain in list] - - return domains - - - def parse_domains(self, list): - regexp = re.compile(r'^(?:https?://)?(?:www\.)?(?:\w+\.)*((?:[\d.]+|[\w\-^_]{3,63}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)', - re.I | re.U) - - r'^(?:https?://)?(?:www\.)?(?:\w+\.)*((?:[\d.]+|[\w\-^_]{3,63}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)' - - domains = [decode(domain).strip().lower() for url in list for domain in regexp.findall(url)] - return self.replace_domains(uniqify(domains)) - - - def _grab_hosters(self): - try: - hosterlist = self.grab_hosters(self.user, self.info['login']['password'], self.info['data']) - - if hosterlist and isinstance(hosterlist, list): - domains = self.parse_domains(hosterlist) - self.info['data']['hosters'] = sorted(domains) - - except Exception, e: - self.log_warning(_("Error loading hoster list for user `%s`") % self.user, e, trace=True) - - finally: - return self.info['data']['hosters'] - - - def grab_hosters(self, user, password, data): - """ - Load list of supported hoster - :return: List of domain names - """ - raise NotImplementedError - - - def periodical(self): - if not self.info['data'].get('hosters'): - self.log_info(_("Loading hoster list for user `%s`...") % self.user) - else: - self.log_info(_("Reloading hoster list for user `%s`...") % self.user) - - if self.PERIODICAL_LOGIN and not self.logged: - self.relogin() - - hosters = self._grab_hosters() - - self.log_debug("Hoster list for user `%s`: %s" % (self.user, hosters)) - - old_supported = self.supported - - self.supported = [] - self.newsupported = [] - self.plugins = [] - - self._override() - - old_supported = [plugin for plugin in old_supported if plugin not in self.supported] - - if old_supported: - self.log_debug("Unload: %s" % ", ".join(old_supported)) - for plugin in old_supported: - self.unload_plugin(plugin) - - self.set_interval(self.get_config('multi_interval') * 60 * 60) - - - def _override(self): - excludedList = [] - - if self.plugintype == "hoster": - pluginMap = dict((name.lower(), name) for name in self.pyload.pluginManager.hosterPlugins.keys()) - accountList = [account.type.lower() for account in self.pyload.api.getAccounts(False) if account.valid and account.premium] - else: - pluginMap = {} - accountList = [name[::-1].replace("Folder"[::-1], "", 1).lower()[::-1] for name in self.pyload.pluginManager.crypterPlugins.keys()] - - for plugin in self.plugins_cached(): - name = remove_chars(plugin, "-.") - - if name in accountList: - excludedList.append(plugin) - else: - if name in pluginMap: - self.supported.append(pluginMap[name]) - else: - self.newsupported.append(plugin) - - if not self.supported and not self.newsupported: - self.log_error(_("No %s loaded") % self.plugintype) - return - - #: Inject plugin plugin - self.log_debug("Overwritten %ss: %s" % (self.plugintype, ", ".join(sorted(self.supported)))) - - for plugin in self.supported: - hdict = self.pyload.pluginManager.plugins[self.plugintype][plugin] - hdict['new_module'] = self.pluginmodule - hdict['new_name'] = self.classname - - if excludedList: - self.log_info(_("%ss not overwritten: %s") % (self.plugintype.capitalize(), ", ".join(sorted(excludedList)))) - - if self.newsupported: - plugins = sorted(self.newsupported) - - self.log_debug("New %ss: %s" % (self.plugintype, ", ".join(plugins))) - - #: Create new regexp - regexp = r'.*(?P<DOMAIN>%s).*' % "|".join(x.replace('.', '\.') for x in plugins) - if hasattr(self.pluginclass, "__pattern__") and isinstance(self.pluginclass.__pattern__, basestring) and "://" in self.pluginclass.__pattern__: - regexp = r'%s|%s' % (self.pluginclass.__pattern__, regexp) - - self.log_debug("Regexp: %s" % regexp) - - hdict = self.pyload.pluginManager.plugins[self.plugintype][self.classname] - hdict['pattern'] = regexp - hdict['re'] = re.compile(regexp) - - - def plugins_cached(self): - if self.plugins: - return self.plugins - - for _i in xrange(5): - try: - pluginset = self._plugin_set(self.grab_hosters()) - break - - except Exception, e: - self.log_warning(e, _("Waiting 1 minute and retry"), trace=True) - time.sleep(60) - else: - self.log_warning(_("No hoster list retrieved")) - self.interval = self.PERIODICAL_INTERVAL - return list() - - try: - configmode = self.get_config('pluginmode', 'all') - if configmode in ("listed", "unlisted"): - pluginlist = self.get_config('pluginlist', '').replace('|', ',').replace(';', ',').split(',') - configset = self._plugin_set(pluginlist) - - if configmode == "listed": - pluginset &= configset - else: - pluginset -= configset - - except Exception, e: - self.log_error(e) - - self.plugins = list(pluginset) - - return self.plugins - - - # def unload_plugin(self, plugin): - # hdict = self.pyload.pluginManager.plugins[self.plugintype][plugin] - # if "module" in hdict: - # hdict.pop('module', None) - - # if "new_module" in hdict: - # hdict.pop('new_module', None) - # hdict.pop('new_name', None) - - - # def deactivate(self): - # """ - # Remove override for all plugins. Scheduler job is removed by hookmanager - # """ - # for plugin in self.supported: - # self.unload_plugin(plugin) - - #: Reset pattern - # hdict = self.pyload.pluginManager.plugins[self.plugintype][self.classname] - - # hdict['pattern'] = getattr(self.pluginclass, "__pattern__", r'^unmatchable$') - # hdict['re'] = re.compile(hdict['pattern']) diff --git a/module/plugins/internal/MultiCrypter.py b/module/plugins/internal/MultiCrypter.py index 576d6d4b4..c924ee916 100644 --- a/module/plugins/internal/MultiCrypter.py +++ b/module/plugins/internal/MultiCrypter.py @@ -6,14 +6,13 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter class MultiCrypter(SimpleCrypter): __name__ = "MultiCrypter" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.07" __status__ = "stable" __pattern__ = r'^unmatchable$' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available", True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default")] __description__ = """Multi decrypter plugin""" __license__ = "GPLv3" diff --git a/module/plugins/internal/MultiHoster.py b/module/plugins/internal/MultiHoster.py index cbbfcd6dc..5bd4527ae 100644 --- a/module/plugins/internal/MultiHoster.py +++ b/module/plugins/internal/MultiHoster.py @@ -3,14 +3,14 @@ import re from module.plugins.internal.Plugin import Fail -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -from module.plugins.internal.utils import encode, replace_patterns, set_cookie, set_cookies +from module.plugins.internal.SimpleHoster import SimpleHoster +from module.plugins.internal.misc import encode, replace_patterns, set_cookie, set_cookies class MultiHoster(SimpleHoster): __name__ = "MultiHoster" __type__ = "hoster" - __version__ = "0.58" + __version__ = "0.59" __status__ = "stable" __pattern__ = r'^unmatchable$' @@ -68,7 +68,7 @@ class MultiHoster(SimpleHoster): super(MultiHoster, self)._process(thread) except Fail, e: - if self.get_config("revertfailed", True) and \ + if self.config.get("revertfailed", True) and \ self.pyload.pluginManager.hosterPlugins[self.classname].get('new_module'): hdict = self.pyload.pluginManager.hosterPlugins[self.classname] diff --git a/module/plugins/internal/Notifier.py b/module/plugins/internal/Notifier.py index d0fd28906..e9f1fab74 100644 --- a/module/plugins/internal/Notifier.py +++ b/module/plugins/internal/Notifier.py @@ -3,24 +3,27 @@ import time from module.plugins.internal.Addon import Addon, Expose -from module.plugins.internal.utils import isiterable +from module.plugins.internal.misc import encode, isiterable class Notifier(Addon): __name__ = "Notifier" __type__ = "hook" - __version__ = "0.04" + __version__ = "0.07" __status__ = "testing" - __config__ = [("activated" , "bool", "Activated" , False), - ("notifycaptcha" , "bool", "Notify captcha request" , True ), - ("notifypackage" , "bool", "Notify package finished" , True ), - ("notifyprocessed", "bool", "Notify packages processed" , True ), - ("notifyupdate" , "bool", "Notify plugin updates" , True ), - ("notifyexit" , "bool", "Notify pyLoad shutdown" , True ), - ("sendtimewait" , "int" , "Timewait in seconds between notifications", 5 ), - ("sendpermin" , "int" , "Max notifications per minute" , 12 ), - ("ignoreclient" , "bool", "Send notifications if client is connected", False)] + __config__ = [("activated" , "bool", "Activated" , False), + ("captcha" , "bool", "Notify captcha request" , True ), + ("reconnection" , "bool", "Notify reconnection request" , False), + ("downloadfinished", "bool", "Notify download finished" , True ), + ("downloadfailed" , "bool", "Notify download failed" , True ), + ("packagefinished" , "bool", "Notify package finished" , True ), + ("packagefailed" , "bool", "Notify package failed" , True ), + ("update" , "bool", "Notify pyLoad update" , False), + ("exit" , "bool", "Notify pyLoad shutdown/restart" , False), + ("sendinterval" , "int" , "Interval in seconds between notifications", 1 ), + ("sendpermin" , "int" , "Max notifications per minute" , 60 ), + ("ignoreclient" , "bool", "Send notifications if client is connected", True )] __description__ = """Base notifier plugin""" __license__ = "GPLv3" @@ -29,21 +32,29 @@ class Notifier(Addon): def init(self): self.event_map = {'allDownloadsProcessed': "all_downloads_processed", - 'plugin_updated' : "plugin_updated" } + 'pyload_updated' : "pyload_updated" } self.last_notify = 0 self.notifications = 0 - def plugin_updated(self, type_plugins): - if not self.get_config('notifyupdate'): + def get_key(self): + raise NotImplementedError + + + def send(self, event, msg, key): + raise NotImplementedError + + + def pyload_updated(self, etag): + if not self.config.get('update', True): return - self.notify(_("Plugins updated"), str(type_plugins)) + self.notify(_("pyLoad updated"), etag) def exit(self): - if not self.get_config('notifyexit'): + if not self.config.get('exit', True): return if self.pyload.do_restart: @@ -53,65 +64,98 @@ class Notifier(Addon): def captcha_task(self, task): - if not self.get_config('notifycaptcha'): + if not self.config.get('captcha', True): return self.notify(_("Captcha"), _("New request waiting user input")) + def before_reconnect(self, ip): + if not self.config.get('reconnection', False): + return + + self.notify(_("Waiting reconnection"), _("Current IP: %s") % ip) + + + def after_reconnect(self, ip, oldip): + if not self.config.get('reconnection', False): + return + + self.notify(_("Reconnection failed"), _("Current IP: %s") % ip) + + def package_finished(self, pypack): - if self.get_config('notifypackage'): - self.notify(_("Package finished"), pypack.name) + if not self.config.get('packagefinished', True): + return + self.notify(_("Package finished"), pypack.name) - def all_downloads_processed(self): - if not self.get_config('notifyprocessed'): + + def package_failed(self, pypack): + if not self.config.get('packagefailed', True): return - if any(True for pdata in self.pyload.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")) + self.notify(_("Package failed"), pypack.name) - def get_key(self): - raise NotImplementedError + def download_finished(self, pyfile): + if not self.config.get('downloadfinished', False): + return + self.notify(_("Download finished"), pyfile.name) - def send(self, event, msg, key): - raise NotImplementedError + + def download_failed(self, pyfile): + if self.config.get('downloadfailed', True): + return + + self.notify(_("Download failed"), pyfile.name) + + + def all_downloads_processed(self): + self.notify(_("All downloads processed")) + + + def all_downloads_finished(self): + self.notify(_("All downloads finished")) @Expose - def notify(self, event, msg="", key=None): + def notify(self, event, msg=None, key=None): key = key or self.get_key() if not key or isiterable(key) and not all(key): return - if self.pyload.isClientConnected() and not self.get_config('ignoreclient'): + if isiterable(msg): + msg = " | ".join(encode(a).strip() for a in msg if a) + else: + msg = encode(msg) + + if self.pyload.isClientConnected() and not self.config.get('ignoreclient', False): return elapsed_time = time.time() - self.last_notify - if elapsed_time < self.get_config("sendtimewait"): + if elapsed_time < self.config.get("sendinterval", 1): return elif elapsed_time > 60: self.notifications = 0 - elif self.notifications >= self.get_config("sendpermin"): + elif self.notifications >= self.config.get("sendpermin", 60): return - self.log_info(_("Sending notification...")) + self.log_debug("Sending notification...") try: - resp = self.send(event, msg, key) + self.send(event, msg, key) except Exception, e: self.log_error(_("Error sending notification"), e) return False else: + self.log_debug("Notification sent") return True finally: diff --git a/module/plugins/internal/OCR.py b/module/plugins/internal/OCR.py index b4e28ca0f..217305459 100644 --- a/module/plugins/internal/OCR.py +++ b/module/plugins/internal/OCR.py @@ -14,13 +14,13 @@ import subprocess # import tempfile from module.plugins.internal.Plugin import Plugin -from module.plugins.internal.utils import fs_join +from module.plugins.internal.misc import encode, fsjoin class OCR(Plugin): __name__ = "OCR" __type__ = "ocr" - __version__ = "0.21" + __version__ = "0.22" __status__ = "stable" __description__ = """OCR base plugin""" @@ -28,20 +28,20 @@ class OCR(Plugin): __authors__ = [("pyLoad Team", "admin@pyload.org")] - def __init__(self, plugin): - self._init(plugin.pyload) - self.plugin = plugin + def __init__(self, pyfile): + self._init(pyfile.m.core) + self.pyfile = pyfile self.init() def _log(self, level, plugintype, pluginname, messages): messages = (self.__name__,) + messages - return self.plugin._log(level, plugintype, self.plugin.__name__, messages) + return self.pyfile.plugin._log(level, plugintype, self.pyfile.plugin.__name__, messages) def load_image(self, image): - self.image = Image.open(image) - self.pixels = self.image.load() + self.img = Image.open(image) + self.pixels = self.img.load() self.result_captcha = "" @@ -53,29 +53,36 @@ class OCR(Plugin): def threshold(self, value): - self.image = self.image.point(lambda a: a * value + 10) + self.img = self.img.point(lambda a: a * value + 10) - def run(self, command): + def call_cmd(self, command, *args, **kwargs): """ Run a command """ - popen = subprocess.Popen(command, bufsize=-1, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + call = [command] + args + self.log_debug("EXECUTE " + " ".join(call)) + + call = map(encode, call) + popen = subprocess.Popen(call, bufsize=-1, stdout=subprocess.PIPE, stderr=subprocess.PIPE) popen.wait() + output = popen.stdout.read() + " | " + popen.stderr.read() + popen.stdout.close() popen.stderr.close() + self.log_debug("Tesseract ReturnCode %d" % popen.returncode, "Output: %s" % output) def run_tesser(self, subset=False, digits=True, lowercase=True, uppercase=True, pagesegmode=None): # tmpTif = tempfile.NamedTemporaryFile(suffix=".tif") try: - tmpTif = open(fs_join("tmp", "tmpTif_%s.tif" % self.classname), "wb") + tmpTif = open(fsjoin("tmp", "tmpTif_%s.tif" % self.classname), "wb") tmpTif.close() # tmpTxt = tempfile.NamedTemporaryFile(suffix=".txt") - tmpTxt = open(fs_join("tmp", "tmpTxt_%s.txt" % self.classname), "wb") + tmpTxt = open(fsjoin("tmp", "tmpTxt_%s.txt" % self.classname), "wb") tmpTxt.close() except IOError, e: @@ -83,21 +90,21 @@ class OCR(Plugin): return self.log_debug("Saving tiff...") - self.image.save(tmpTif.name, 'TIFF') + self.img.save(tmpTif.name, 'TIFF') if os.name is "nt": - tessparams = [os.path.join(pypath, "tesseract", "tesseract.exe")] + command = os.path.join(pypath, "tesseract", "tesseract.exe") else: - tessparams = ["tesseract"] + command = "tesseract" - tessparams.extend([os.path.abspath(tmpTif.name), os.path.abspath(tmpTxt.name).replace(".txt", "")]) + args = [os.path.abspath(tmpTif.name), os.path.abspath(tmpTxt.name).replace(".txt", "")] if pagesegmode: - tessparams.extend(["-psm", str(pagesegmode)]) + args.extend(["-psm", str(pagesegmode)]) if subset and (digits or lowercase or uppercase): # tmpSub = tempfile.NamedTemporaryFile(suffix=".subset") - with open(fs_join("tmp", "tmpSub_%s.subset" % self.classname), "wb") as tmpSub: + with open(fsjoin("tmp", "tmpSub_%s.subset" % self.classname), "wb") as tmpSub: tmpSub.write("tessedit_char_whitelist ") if digits: @@ -108,11 +115,11 @@ class OCR(Plugin): tmpSub.write("ABCDEFGHIJKLMNOPQRSTUVWXYZ") tmpSub.write("\n") - tessparams.append("nobatch") - tessparams.append(os.path.abspath(tmpSub.name)) + args.append("nobatch") + args.append(os.path.abspath(tmpSub.name)) self.log_debug("Running tesseract...") - self.run(tessparams) + self.call_cmd(command, *args) self.log_debug("Reading txt...") try: @@ -123,30 +130,28 @@ class OCR(Plugin): self.result_captcha = "" self.log_info(_("OCR result: ") + self.result_captcha) - try: - os.remove(tmpTif.name) - os.remove(tmpTxt.name) - if subset and (digits or lowercase or uppercase): - os.remove(tmpSub.name) - except OSError, e: - self.log_warning(e) + self.remove(tmpTif.name, trash=False) + self.remove(tmpTxt.name, trash=False) + + if subset and (digits or lowercase or uppercase): + self.remove(tmpSub.name, trash=False) - def recognize(self, name): + def recognize(self, image): raise NotImplementedError def to_greyscale(self): - if self.image.mode != 'L': - self.image = self.image.convert('L') + if self.img.mode != 'L': + self.img = self.img.convert('L') - self.pixels = self.image.load() + self.pixels = self.img.load() def eval_black_white(self, limit): - self.pixels = self.image.load() - w, h = self.image.size + self.pixels = self.img.load() + w, h = self.img.size for x in xrange(w): for y in xrange(h): if self.pixels[x, y] > limit: @@ -158,38 +163,38 @@ class OCR(Plugin): def clean(self, allowed): pixels = self.pixels - w, h = self.image.size + w, h = self.img.size for x in xrange(w): for y in xrange(h): - if pixels[x, y] == 255: + if pixels[x, y] is 255: continue #: No point in processing white pixels since we only want to remove black pixel count = 0 try: - if pixels[x - 1, y - 1] != 255: + if pixels[x - 1, y - 1] is not 255: count += 1 - if pixels[x - 1, y] != 255: + if pixels[x - 1, y] is not 255: count += 1 - if pixels[x - 1, y + 1] != 255: + if pixels[x - 1, y + 1] is not 255: count += 1 - if pixels[x, y + 1] != 255: + if pixels[x, y + 1] is not 255: count += 1 - if pixels[x + 1, y + 1] != 255: + if pixels[x + 1, y + 1] is not 255: count += 1 - if pixels[x + 1, y] != 255: + if pixels[x + 1, y] is not 255: count += 1 - if pixels[x + 1, y - 1] != 255: + if pixels[x + 1, y - 1] is not 255: count += 1 - if pixels[x, y - 1] != 255: + if pixels[x, y - 1] is not 255: count += 1 except Exception: @@ -203,7 +208,7 @@ class OCR(Plugin): #: Second pass: this time set all 1's to 255 (white) for x in xrange(w): for y in xrange(h): - if pixels[x, y] == 1: + if pixels[x, y] is 1: pixels[x, y] = 255 self.pixels = pixels @@ -213,12 +218,12 @@ class OCR(Plugin): """ Rotate by checking each angle and guess most suitable """ - w, h = self.image.size + w, h = self.img.size pixels = self.pixels for x in xrange(w): for y in xrange(h): - if pixels[x, y] == 0: + if pixels[x, y] is 0: pixels[x, y] = 155 highest = {} @@ -226,15 +231,15 @@ class OCR(Plugin): for angle in xrange(-45, 45): - tmpimage = self.image.rotate(angle) + tmpimage = self.img.rotate(angle) pixels = tmpimage.load() - w, h = self.image.size + w, h = self.img.size for x in xrange(w): for y in xrange(h): - if pixels[x, y] == 0: + if pixels[x, y] is 0: pixels[x, y] = 255 count = {} @@ -242,14 +247,14 @@ class OCR(Plugin): for x in xrange(w): count[x] = 0 for y in xrange(h): - if pixels[x, y] == 155: + if pixels[x, y] is 155: count[x] += 1 sum = 0 cnt = 0 for x in count.values(): - if x != 0: + if x is not 0: sum += x cnt += 1 @@ -270,22 +275,22 @@ class OCR(Plugin): hkey = key hvalue = value - self.image = self.image.rotate(hkey) - pixels = self.image.load() + self.img = self.img.rotate(hkey) + pixels = self.img.load() for x in xrange(w): for y in xrange(h): - if pixels[x, y] == 0: + if pixels[x, y] is 0: pixels[x, y] = 255 - if pixels[x, y] == 155: + if pixels[x, y] is 155: pixels[x, y] = 0 self.pixels = pixels def split_captcha_letters(self): - captcha = self.image + captcha = self.img started = False letters = [] width, height = captcha.size @@ -295,7 +300,7 @@ class OCR(Plugin): for x in xrange(width): black_pixel_in_col = False for y in xrange(height): - if pixels[x, y] != 255: + if pixels[x, y] is not 255: if not started: started = True firstX = x diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py index bf591d482..71137e496 100644 --- a/module/plugins/internal/Plugin.py +++ b/module/plugins/internal/Plugin.py @@ -4,23 +4,30 @@ from __future__ import with_statement import inspect import os +import re if os.name is not "nt": import grp import pwd import pycurl +try: + import send2trash +except ImportError: + pass -import module.plugins.internal.utils as utils +import module.plugins.internal.misc as utils +from module.network.RequestFactory import getRequest as get_request from module.plugins.Plugin import Abort, Fail, Reconnect, Retry, SkipDownload as Skip #@TODO: Remove in 0.4.10 -from module.plugins.internal.utils import * +from module.plugins.internal.misc import (Config, DB, decode, encode, exists, fixurl, fsjoin, + format_exc, html_unescape, parse_html_header) class Plugin(object): __name__ = "Plugin" __type__ = "plugin" - __version__ = "0.61" + __version__ = "0.62" __status__ = "stable" __config__ = [] #: [("name", "type", "desc", "default")] @@ -46,10 +53,20 @@ class Plugin(object): def _init(self, core): - self.pyload = core - self.info = {} #: Provide information in dict here - self.req = None #: Browser instance, see `network.Browser` - self.last_html = None + #: Internal modules + self.pyload = core + self.db = DB(self) + self.config = Config(self) + + #: Provide information in dict here + self.info = {} + + #: Browser instance, see `network.Browser` + self.req = self.pyload.requestFactory.getRequest(self.classname) + + #: Last loaded html + self.last_html = "" + self.last_header = {} def init(self): @@ -71,124 +88,70 @@ class Plugin(object): def log_debug(self, *args, **kwargs): self._log("debug", self.__type__, self.__name__, args) if self.pyload.debug and kwargs.get('trace'): - self.print_exc() + self._print_exc() def log_info(self, *args, **kwargs): self._log("info", self.__type__, self.__name__, args) if self.pyload.debug and kwargs.get('trace'): - self.print_exc() + self._print_exc() def log_warning(self, *args, **kwargs): self._log("warning", self.__type__, self.__name__, args) if self.pyload.debug and kwargs.get('trace'): - self.print_exc() + self._print_exc() def log_error(self, *args, **kwargs): self._log("error", self.__type__, self.__name__, args) if self.pyload.debug and kwargs.get('trace', True): - self.print_exc() + self._print_exc() def log_critical(self, *args, **kwargs): self._log("critical", self.__type__, self.__name__, args) if kwargs.get('trace', True): - self.print_exc() + self._print_exc() - def print_exc(self): + def _print_exc(self): frame = inspect.currentframe() print format_exc(frame.f_back) del frame - def set_permissions(self, path): - if not os.path.exists(path): - return - - try: - if self.pyload.config.get("permission", "change_file"): - if os.path.isfile(path): - os.chmod(path, int(self.pyload.config.get("permission", "file"), 8)) - - elif os.path.isdir(path): - os.chmod(path, int(self.pyload.config.get("permission", "folder"), 8)) - - except OSError, e: - self.log_warning(_("Setting path mode failed"), e) - - try: - if os.name is not "nt" and self.pyload.config.get("permission", "change_dl"): - uid = pwd.getpwnam(self.pyload.config.get("permission", "user"))[2] - gid = grp.getgrnam(self.pyload.config.get("permission", "group"))[2] - os.chown(path, uid, gid) - - except OSError, e: - self.log_warning(_("Setting owner and group failed"), e) - - - def set_config(self, option, value, plugin=None): - """ - Set config value for current plugin - - :param option: - :param value: - :return: - """ - self.pyload.api.setConfigValue(plugin or self.classname, option, value, section="plugin") - - - def get_config(self, option, default="", plugin=None): - """ - Returns config value for current plugin - - :param option: - :return: - """ + def remove(self, path, trash=False): #@TODO: Change to `trash=True` in 0.4.10 try: - return self.pyload.config.getPlugin(plugin or self.classname, option) + remove(path, trash) - except KeyError: - self.log_debug("Config option `%s` not found, use default `%s`" % (option, default or None)) #@TODO: Restore to `log_warning` in 0.4.10 - return default + except (NameError, OSError), e: + self.log_warning(_("Error removing `%s`") % os.path.abspath(path), e) + return False - - def store(self, key, value): - """ - Saves a value persistently to the database - """ - value = map(decode, value) if isiterable(value) else decode(value) - entry = json.dumps(value).encode('base64') - self.pyload.db.setStorage(self.classname, key, entry) + else: + self.log_info(_("Path deleted: ") + os.path.abspath(path)) + return True - def retrieve(self, key=None, default=None): - """ - Retrieves saved value or dict of all saved entries if key is None - """ - entry = self.pyload.db.getStorage(self.classname, key) + def set_permissions(self, path): + path = encode(path) - if key: - if entry is None: - value = default - else: - value = json.loads(entry.decode('base64')) - else: - if not entry: - value = default - else: - value = dict((k, json.loads(v.decode('base64'))) for k, v in value.items()) + if not exists(path): + return - return value + file_perms = False + dl_perms = False + if self.pyload.config.get("permission", "change_file"): + permission = self.pyload.config.get("permission", "folder" if os.path.isdir(path) else "file") + mode = int(permission, 8) + os.chmod(path, mode) - def delete(self, key): - """ - Delete entry in db - """ - self.pyload.db.delStorage(self.classname, key) + if os.name is not "nt" and self.pyload.config.get("permission", "change_dl"): + uid = pwd.getpwnam(self.pyload.config.get("permission", "user"))[2] + gid = grp.getgrnam(self.pyload.config.get("permission", "group"))[2] + os.chown(path, uid, gid) def fail(self, msg): @@ -214,13 +177,16 @@ class Plugin(object): """ if self.pyload.debug: self.log_debug("LOAD URL " + url, - *["%s=%s" % (key, safe_format(val, self.info['login']['password']) if self.__type__ == "account" else val) - for key, val in locals().items() if key not in ("self", "url", "_[1]")]) + *["%s=%s" % (key, value) for key, value in locals().items() + if key not in ("self", "url", "_[1]")]) url = fixurl(url, unquote=True) #: Recheck in 0.4.10 - if req is None: - req = self.req or self.pyload.requestFactory.getRequest(self.classname) + if req is False: + req = get_request() + + elif not req: + req = self.req #@TODO: Move to network in 0.4.10 if isinstance(cookies, list): @@ -240,7 +206,7 @@ class Plugin(object): req.http.c.setopt(pycurl.FOLLOWLOCATION, 1) elif type(redirect) is int: - maxredirs = self.get_config("maxredirs", default=5, plugin="UserAgentSwitcher") + maxredirs = int(self.pyload.api.getConfigValue("UserAgentSwitcher", "maxredirs", "plugin")) or 5 #@TODO: Remove `int` in 0.4.10 req.http.c.setopt(pycurl.MAXREDIRS, maxredirs) #@TODO: Move to network in 0.4.10 @@ -257,8 +223,8 @@ class Plugin(object): frame = inspect.currentframe() try: - framefile = fs_join("tmp", self.classname, "%s_line%s.dump.html" % - (frame.f_back.f_code.co_name, frame.f_back.f_lineno)) + framefile = fsjoin("tmp", self.classname, "%s_line%s.dump.html" + % (frame.f_back.f_code.co_name, frame.f_back.f_lineno)) if not exists(os.path.join("tmp", self.classname)): os.makedirs(os.path.join("tmp", self.classname)) @@ -272,33 +238,16 @@ class Plugin(object): finally: del frame #: Delete the frame or it wont be cleaned - if not just_header: - return html - - else: - #@TODO: Move to network in 0.4.10 - header = {'code': req.code} - - for line in html.splitlines(): - line = line.strip() - if not line or ":" not in line: - continue - - key, none, value = line.partition(":") - - key = key.strip().lower() - value = value.strip() + #@TODO: Move to network in 0.4.10 + header = {'code': req.code} + header.update(parse_html_header(req.http.header)) - if key in header: - header_key = header.get(key) - if type(header_key) is list: - header_key.append(value) - else: - header[key] = [header_key, value] - else: - header[key] = value + self.last_header = header + if just_header: return header + else: + return html def clean(self): diff --git a/module/plugins/internal/SevenZip.py b/module/plugins/internal/SevenZip.py index bf33332ea..a8306f393 100644 --- a/module/plugins/internal/SevenZip.py +++ b/module/plugins/internal/SevenZip.py @@ -5,13 +5,13 @@ import re import subprocess from module.plugins.internal.UnRar import UnRar, ArchiveError, CRCError, PasswordError -from module.plugins.internal.utils import fs_join, renice +from module.plugins.internal.misc import encode, fsjoin, renice class SevenZip(UnRar): __name__ = "SevenZip" __type__ = "extractor" - __version__ = "0.18" + __version__ = "0.19" __status__ = "testing" __description__ = """7-Zip extractor plugin""" @@ -20,19 +20,18 @@ class SevenZip(UnRar): ("Michael Nowak" , None )] - CMD = "7z" - EXTENSIONS = [".7z", ".xz", ".zip", ".gz", ".gzip", ".tgz", ".bz2", ".bzip2", - ".tbz2", ".tbz", ".tar", ".wim", ".swm", ".lzma", ".rar", ".cab", - ".arj", ".z", ".taz", ".cpio", ".rpm", ".deb", ".lzh", ".lha", - ".chm", ".chw", ".hxs", ".iso", ".msi", ".doc", ".xls", ".ppt", - ".dmg", ".xar", ".hfs", ".exe", ".ntfs", ".fat", ".vhd", ".mbr", - ".squashfs", ".cramfs", ".scap"] + CMD = "7z" + EXTENSIONS = ["7z", "xz", "zip", "gz", "gzip", "tgz", "bz2", "bzip2", "tbz2", + "tbz", "tar", "wim", "swm", "lzma", "rar", "cab", "arj", "z", + "taz", "cpio", "rpm", "deb", "lzh", "lha", "chm", "chw", "hxs", + "iso", "msi", "doc", "xls", "ppt", "dmg", "xar", "hfs", "exe", + "ntfs", "fat", "vhd", "mbr", "squashfs", "cramfs", "scap"] #@NOTE: there are some more uncovered 7z formats - re_filelist = re.compile(r'([\d\:]+)\s+([\d\:]+)\s+([\w\.]+)\s+(\d+)\s+(\d+)\s+(.+)') - re_wrongpwd = re.compile(r'(Can not open encrypted archive|Wrong password|Encrypted\s+\=\s+\+)', re.I) - re_wrongcrc = re.compile(r'CRC Failed|Can not open file', re.I) - re_version = re.compile(r'7-Zip\s(?:\[64\]\s)?(\d+\.\d+)', re.I) + _RE_FILES = re.compile(r'([\d\:]+)\s+([\d\:]+)\s+([\w\.]+)\s+(\d+)\s+(\d+)\s+(.+)') + _RE_BADPWD = re.compile(r'(Can not open encrypted archive|Wrong password|Encrypted\s+\=\s+\+)', re.I) + _RE_BADCRC = re.compile(r'CRC Failed|Can not open file', re.I) + _RE_VERSION = re.compile(r'7-Zip\s(?:\[64\]\s)?(\d+\.\d+)', re.I) @classmethod @@ -48,7 +47,7 @@ class SevenZip(UnRar): return False else: - m = cls.re_version.search(out) + m = cls._RE_VERSION.search(out) if m is not None: cls.VERSION = m.group(1) @@ -60,33 +59,33 @@ class SevenZip(UnRar): p = self.call_cmd("l", "-slt", self.target) out, err = p.communicate() - if self.re_wrongpwd.search(out): + if self._RE_BADPWD.search(out): raise PasswordError - elif self.re_wrongpwd.search(err): + elif self._RE_BADPWD.search(err): raise PasswordError - elif self.re_wrongcrc.search(out): + elif self._RE_BADCRC.search(out): raise CRCError(_("Header protected")) - elif self.re_wrongcrc.search(err): + elif self._RE_BADCRC.search(err): raise CRCError(err) def extract(self, password=None): command = "x" if self.fullpath else "e" - p = self.call_cmd(command, '-o' + self.out, self.target, password=password) + p = self.call_cmd(command, '-o' + self.dest, self.target, password=password) #: Communicate and retrieve stderr - self._progress(p) + self.progress(p) err = p.stderr.read().strip() if err: - if self.re_wrongpwd.search(err): + if self._RE_BADPWD.search(err): raise PasswordError - elif self.re_wrongcrc.search(err): + elif self._RE_BADCRC.search(err): raise CRCError(err) else: #: Raise error if anything is on stderr @@ -95,8 +94,6 @@ class SevenZip(UnRar): if p.returncode > 1: raise ArchiveError(_("Process return code: %d") % p.returncode) - self.files = self.list(password) - def list(self, password=None): command = "l" if self.fullpath else "l" @@ -111,9 +108,9 @@ class SevenZip(UnRar): raise ArchiveError(_("Process return code: %d") % p.returncode) result = set() - for groups in self.re_filelist.findall(out): + for groups in self._RE_FILES.findall(out): f = groups[-1].strip() - result.add(fs_join(self.out, f)) + result.add(fsjoin(self.dest, f)) return list(result) @@ -133,9 +130,9 @@ class SevenZip(UnRar): #@NOTE: return codes are not reliable, some kind of threading, cleanup whatever issue call = [self.CMD, command] + args + list(xargs) + self.log_debug("EXECUTE " + " ".join(call)) - self.log_debug(" ".join(call)) - + call = map(encode, call) p = subprocess.Popen(call, stdout=subprocess.PIPE, stderr=subprocess.PIPE) renice(p.pid, self.priority) diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index 5a9bd5c84..97d7a660a 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -4,8 +4,8 @@ import re from module.network.HTTPRequest import BadHeader from module.network.RequestFactory import getURL as get_url -from module.plugins.internal.Crypter import Crypter, create_getInfo, parse_fileInfo -from module.plugins.internal.utils import parse_name, replace_patterns, set_cookie, set_cookies +from module.plugins.internal.Crypter import Crypter +from module.plugins.internal.misc import parse_name, replace_patterns, set_cookie, set_cookies class SimpleCrypter(Crypter): @@ -15,11 +15,10 @@ class SimpleCrypter(Crypter): __status__ = "testing" __pattern__ = r'^unmatchable$' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """Simple decrypter plugin""" __license__ = "GPLv3" @@ -70,8 +69,8 @@ class SimpleCrypter(Crypter): PAGES_PATTERN = None NAME_PATTERN = None - OFFLINE_PATTERN = None - TEMP_OFFLINE_PATTERN = None + OFFLINE_PATTERN = r'[^\w](404\s|[Ii]nvalid|[Oo]ffline|[Dd]elet|[Rr]emov|([Nn]o(t|thing)?|sn\'t) (found|(longer )?(available|exist)))' + TEMP_OFFLINE_PATTERN = r'[^\w](503\s|[Mm]aint(e|ai)nance|[Tt]emp([.-]|orarily)|[Mm]irror)' WAIT_PATTERN = None PREMIUM_ONLY_PATTERN = None @@ -132,7 +131,7 @@ class SimpleCrypter(Crypter): if self.account: self.req = self.pyload.requestFactory.getRequest(account_name, self.account.user) - self.premium = self.account.info['data']['premium'] #@NOTE: Avoid one unnecessary get_info call by `self.account.premium` here + self.premium = self.account.info['data']['premium'] #@NOTE: Don't call get_info here to reduce overhead else: self.req = self.pyload.requestFactory.getRequest(account_name) self.premium = False @@ -149,26 +148,24 @@ class SimpleCrypter(Crypter): def handle_direct(self, pyfile): - redirect = None - maxredirs = self.get_config("maxredirs", default=10, plugin="UserAgentSwitcher") + maxredirs = int(self.pyload.api.getConfigValue("UserAgentSwitcher", "maxredirs", "plugin")) or 5 #@TODO: Remove `int` in 0.4.10 + redirect = None for i in xrange(maxredirs): redirect = redirect or pyfile.url self.log_debug("Redirect #%d to: %s" % (i, redirect)) - data = self.load(redirect) - header = dict(re.findall(r"(?P<name>.+?): (?P<value>.+?)\r?\n", self.req.http.header)) - #Ugly, but there is no direct way to fetch headers AND data - location = header.get('location') + html = self.load(redirect) + location = self.last_header.get('location') if location: redirect = location else: - self.data = data + self.data = html self.links.extend(self.get_links()) return else: - self.log_error(_("Too many redirects")) + self.log_warning(_("Too many redirects")) def preload(self): @@ -282,8 +279,10 @@ class SimpleCrypter(Crypter): def check_errors(self): + self.log_info(_("Checking for link errors...")) + if not self.data: - self.log_debug("No data to check") + self.log_warning(_("No data to check")) return if self.IP_BLOCKED_PATTERN and re.search(self.IP_BLOCKED_PATTERN, self.data): @@ -311,33 +310,40 @@ class SimpleCrypter(Crypter): self.info['error'] = errmsg self.log_warning(errmsg) - if re.search('limit|wait|slot', errmsg, re.I): + if re.search(self.TEMP_OFFLINE_PATTERN, errmsg): + self.temp_offline() + + elif re.search(self.OFFLINE_PATTERN, errmsg): + self.offline() + + elif re.search(r'limit|wait|slot', errmsg, re.I): wait_time = parse_time(errmsg) - self.wait(wait_time, reconnect=wait_time > self.get_config("max_wait", 10) * 60) + self.wait(wait_time, reconnect=wait_time > self.config.get("max_wait", 10) * 60) self.restart(_("Download limit exceeded")) - elif re.search('country|ip|region|nation', errmsg, re.I): + elif re.search(r'country|ip|region|nation', errmsg, re.I): self.fail(_("Connection from your current IP address is not allowed")) - elif re.search('captcha|code', errmsg, re.I): + elif re.search(r'captcha|code', errmsg, re.I): self.retry_captcha() - elif re.search('countdown|expired', errmsg, re.I): + elif re.search(r'countdown|expired', errmsg, re.I): self.retry(10, 60, _("Link expired")) - elif re.search('maint(e|ai)nance|temp', errmsg, re.I): + elif re.search(r'503|maint(e|ai)nance|temp|mirror', errmsg, re.I): self.temp_offline() - elif re.search('up to|size', errmsg, re.I): + elif re.search(r'up to|size', errmsg, re.I): self.fail(_("Link list too large for free decrypt")) - elif re.search('offline|delet|remov|not? (found|(longer)? available)', errmsg, re.I): + elif re.search(r'404|sorry|offline|delet|remov|(no(t|thing)?|sn\'t) (found|(longer )?(available|exist))', + errmsg, re.I): self.offline() - elif re.search('filename', errmsg, re.I): + elif re.search(r'filename', errmsg, re.I): self.fail(_("Invalid url")) - elif re.search('premium', errmsg, re.I): + elif re.search(r'premium', errmsg, re.I): self.fail(_("Link can be decrypted by premium users only")) else: @@ -354,6 +360,7 @@ class SimpleCrypter(Crypter): waitmsg = m.group(0).strip() wait_time = parse_time(waitmsg) - self.wait(wait_time, reconnect=wait_time > self.get_config("max_wait", 10) * 60) + self.wait(wait_time, reconnect=wait_time > self.config.get("max_wait", 10) * 60) + self.log_info(_("No errors found")) self.info.pop('error', None) diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 4d7697d57..c6e915cc4 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -7,9 +7,9 @@ import time from module.network.HTTPRequest import BadHeader from module.network.RequestFactory import getURL as get_url -from module.plugins.internal.Hoster import Hoster, create_getInfo, parse_fileInfo +from module.plugins.internal.Hoster import Hoster from module.plugins.internal.Plugin import Fail -from module.plugins.internal.utils import (encode, parse_name, parse_size, +from module.plugins.internal.misc import (encode, parse_name, parse_size, parse_time, replace_patterns) @@ -43,7 +43,7 @@ class SimpleHoster(Hoster): example: SIZE_PATTERN = r'(?P<S>file_size) (?P<U>size_unit)' HASHSUM_PATTERN: (optional) Hash code and type of the file - example: HASHSUM_PATTERN = r'(?P<H>hash_code) (?P<T>MD5)' + example: HASHSUM_PATTERN = r'(?P<D>hash_digest) (?P<H>MD5)' OFFLINE_PATTERN: (mandatory) Check if the page is unreachable example: OFFLINE_PATTERN = r'File (deleted|not found)' @@ -101,6 +101,7 @@ class SimpleHoster(Hoster): LOGIN_PREMIUM = False #: Set to True to require premium account login LEECH_HOSTER = False #: Set to True to leech other hoster link (as defined in handle_multi method) TEXT_ENCODING = True #: Set to encoding name if encoding value in http header is not correct + # TRANSLATE_ERROR = True LINK_PATTERN = None LINK_FREE_PATTERN = None @@ -109,9 +110,9 @@ class SimpleHoster(Hoster): INFO_PATTERN = None NAME_PATTERN = None SIZE_PATTERN = None - HASHSUM_PATTERN = None - OFFLINE_PATTERN = None - TEMP_OFFLINE_PATTERN = None + HASHSUM_PATTERN = r'[^\w](?P<H>(CRC|crc)(-?32)?|(MD|md)-?5|(SHA|sha)-?(1|224|256|384|512)).*(:|=|>)[ ]*(?P<D>(?:[a-z0-9]|[A-Z0-9]){8,})' + OFFLINE_PATTERN = r'[^\w](404\s|[Ii]nvalid|[Oo]ffline|[Dd]elet|[Rr]emov|([Nn]o(t|thing)?|sn\'t) (found|(longer )?(available|exist)))' + TEMP_OFFLINE_PATTERN = r'[^\w](503\s|[Mm]aint(e|ai)nance|[Tt]emp([.-]|orarily)|[Mm]irror)' WAIT_PATTERN = None PREMIUM_ONLY_PATTERN = None @@ -187,8 +188,8 @@ class SimpleHoster(Hoster): info['size'] = parse_size(info['size'], unit) if 'H' in info['pattern']: - hashtype = info['pattern']['T'] if 'T' in info['pattern'] else "hash" - info[hashtype] = info['pattern']['H'] + type = info['pattern']['H'].strip('-').upper() + info['hash'][type] = info['pattern']['D'] return info @@ -246,51 +247,54 @@ class SimpleHoster(Hoster): def process(self, pyfile): self.prepare() + #@TODO: Remove `handle_multi`, use MultiHoster instead if self.leech_dl: self.log_info(_("Processing as debrid download...")) self.handle_multi(pyfile) - if not self.link and not was_downloaded(): - self.log_info(_("Failed to leech url")) - else: - if not self.link and self.direct_dl and not self.last_download: + if not self.link and self.direct_dl: self.log_info(_("Looking for direct download link...")) self.handle_direct(pyfile) - if self.link or self.last_download: + if self.link: self.log_info(_("Direct download link detected")) else: self.log_info(_("Direct download link not found")) - if not self.link and not self.last_download: + if not self.link: self.preload() + self.check_errors() if self.info.get('status', 3) is not 2: self.grab_info() + self.check_status() + self.check_duplicates() - if self.premium and (not self.CHECK_TRAFFIC or self.check_traffic()): + if self.premium and (not self.CHECK_TRAFFIC or not self.out_of_traffic()): self.log_info(_("Processing as premium download...")) self.handle_premium(pyfile) - elif not self.LOGIN_ACCOUNT or (not self.CHECK_TRAFFIC or self.check_traffic()): + elif not self.LOGIN_ACCOUNT or (not self.CHECK_TRAFFIC or not self.out_of_traffic()): self.log_info(_("Processing as free download...")) self.handle_free(pyfile) - if not self.link and not self.last_download: - self.error(_("%s download link not found") % ("Premium" if self.premium else "Free")) - - if not self.last_download: + if self.link and not self.last_download: self.log_info(_("Downloading file...")) self.download(self.link, disposition=self.DISPOSITION) + def _check_download(self): + super(SimpleHoster, self)._check_download() + self.check_download() + + def check_download(self): super(SimpleHoster, self).check_download() - self.log_info(_("Checking downloaded file with built-in rules...")) + self.log_info(_("Checking file (with built-in rules)...")) for r, p in self.FILE_ERRORS: - errmsg = self.check_file({r: re.compile(p)}) + errmsg = self.scan_download({r: re.compile(p)}) if errmsg is not None: errmsg = errmsg.strip().capitalize() @@ -305,19 +309,21 @@ class SimpleHoster(Hoster): self.restart(errmsg) else: if self.CHECK_FILE: - self.log_info(_("Checking downloaded file with custom rules...")) + self.log_info(_("Checking file (with custom rules)...")) with open(encode(self.last_download), "rb") as f: self.data = f.read(1048576) #@TODO: Recheck in 0.4.10 self.check_errors() - self.log_info(_("File is OK")) + self.log_info(_("No errors found")) def check_errors(self): + self.log_info(_("Checking for link errors...")) + if not self.data: - self.log_debug("No data to check") + self.log_warning(_("No data to check")) return if self.IP_BLOCKED_PATTERN and re.search(self.IP_BLOCKED_PATTERN, self.data): @@ -345,7 +351,7 @@ class SimpleHoster(Hoster): self.log_warning(errmsg) wait_time = parse_time(errmsg) - self.wait(wait_time, reconnect=wait_time > self.get_config("max_wait", 10) * 60) + self.wait(wait_time, reconnect=wait_time > self.config.get("max_wait", 10) * 60) self.restart(_("Download limit exceeded")) if self.HAPPY_HOUR_PATTERN and re.search(self.HAPPY_HOUR_PATTERN, self.data): @@ -366,33 +372,40 @@ class SimpleHoster(Hoster): self.info['error'] = errmsg self.log_warning(errmsg) - if re.search('limit|wait|slot', errmsg, re.I): + if re.search(self.TEMP_OFFLINE_PATTERN, errmsg): + self.temp_offline() + + elif re.search(self.OFFLINE_PATTERN, errmsg): + self.offline() + + elif re.search(r'limit|wait|slot', errmsg, re.I): wait_time = parse_time(errmsg) - self.wait(wait_time, reconnect=wait_time > self.get_config("max_wait", 10) * 60) + self.wait(wait_time, reconnect=wait_time > self.config.get("max_wait", 10) * 60) self.restart(_("Download limit exceeded")) - elif re.search('country|ip|region|nation', errmsg, re.I): + elif re.search(r'country|ip|region|nation', errmsg, re.I): self.fail(_("Connection from your current IP address is not allowed")) - elif re.search('captcha|code', errmsg, re.I): + elif re.search(r'captcha|code', errmsg, re.I): self.retry_captcha() - elif re.search('countdown|expired', errmsg, re.I): + elif re.search(r'countdown|expired', errmsg, re.I): self.retry(10, 60, _("Link expired")) - elif re.search('maint(e|ai)nance|temp', errmsg, re.I): + elif re.search(r'503|maint(e|ai)nance|temp|mirror', errmsg, re.I): self.temp_offline() - elif re.search('up to|size', errmsg, re.I): + elif re.search(r'up to|size', errmsg, re.I): self.fail(_("File too large for free download")) - elif re.search('offline|delet|remov|not? (found|(longer)? available)', errmsg, re.I): + elif re.search(r'404|sorry|offline|delet|remov|(no(t|thing)?|sn\'t) (found|(longer )?(available|exist))', + errmsg, re.I): self.offline() - elif re.search('filename', errmsg, re.I): + elif re.search(r'filename', errmsg, re.I): self.fail(_("Invalid url")) - elif re.search('premium', errmsg, re.I): + elif re.search(r'premium', errmsg, re.I): self.fail(_("File can be downloaded by premium users only")) else: @@ -409,8 +422,9 @@ class SimpleHoster(Hoster): waitmsg = m.group(0).strip() wait_time = parse_time(waitmsg) - self.wait(wait_time, reconnect=wait_time > self.get_config("max_wait", 10) * 60) + self.wait(wait_time, reconnect=wait_time > self.config.get("max_wait", 10) * 60) + self.log_info(_("No errors found")) self.info.pop('error', None) @@ -431,10 +445,12 @@ class SimpleHoster(Hoster): def handle_free(self, pyfile): if not self.LINK_FREE_PATTERN: - self.error(_("Free download not implemented")) + self.fail(_("Free download not implemented")) m = re.search(self.LINK_FREE_PATTERN, self.data) - if m is not None: + if m is None: + self.error(_("Free download link not found")) + else: self.link = m.group(1) @@ -444,5 +460,7 @@ class SimpleHoster(Hoster): self.restart(premium=False) m = re.search(self.LINK_PREMIUM_PATTERN, self.data) - if m is not None: + if m is None: + self.error(_("Premium download link not found")) + else: self.link = m.group(1) diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 963ca2a2e..b9c91bce8 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -6,34 +6,32 @@ import string import subprocess from module.plugins.internal.Extractor import Extractor, ArchiveError, CRCError, PasswordError -from module.plugins.internal.utils import decode, fs_join, renice +from module.plugins.internal.misc import decode, encode, fsjoin, renice class UnRar(Extractor): __name__ = "UnRar" __type__ = "extractor" - __version__ = "1.29" + __version__ = "1.30" __status__ = "testing" - __description__ = """Rar extractor plugin""" + __description__ = """RAR extractor plugin""" __license__ = "GPLv3" __authors__ = [("RaNaN" , "RaNaN@pyload.org" ), ("Walter Purcaro", "vuolter@gmail.com"), ("Immenz" , "immenz@gmx.net" )] - CMD = "unrar" - EXTENSIONS = [".rar"] + CMD = "unrar" + EXTENSIONS = ["rar", "zip", "cab", "arj", "lzh", "tar", "gz", "ace", "uue", + "bz2", "jar", "iso", "7z", "xz", "z"] - re_multipart = re.compile(r'\.(part|r)(\d+)(?:\.rar)?(\.rev|\.bad)?', re.I) - - re_filefixed = re.compile(r'Building (.+)') - re_filelist = re.compile(r'^(.)(\s*[\w\-.]+)\s+(\d+\s+)+(?:\d+\%\s+)?[\d\-]{8}\s+[\d\:]{5}', re.I | re.M) - - re_wrongpwd = re.compile(r'password', re.I) - re_wrongcrc = re.compile(r'encrypted|damaged|CRC failed|checksum error|corrupt', re.I) - - re_version = re.compile(r'(?:UN)?RAR\s(\d+\.\d+)', re.I) + _RE_PART = re.compile(r'\.(part|r)\d+(\.rar|\.rev)?(\.bad)?', re.I) + _RE_FIXNAME = re.compile(r'Building (.+)') + _RE_FILES = re.compile(r'^(.)(\s*[\w\-.]+)\s+(\d+\s+)+(?:\d+\%\s+)?[\d\-]{8}\s+[\d\:]{5}', re.I | re.M) + _RE_BADPWD = re.compile(r'password', re.I) + _RE_BADCRC = re.compile(r'encrypted|damaged|CRC failed|checksum error|corrupt', re.I) + _RE_VERSION = re.compile(r'(?:UN)?RAR\s(\d+\.\d+)', re.I) @classmethod @@ -62,7 +60,7 @@ class UnRar(Extractor): except OSError: return False - m = cls.re_version.search(out) + m = cls._RE_VERSION.search(out) if m is not None: cls.VERSION = m.group(1) @@ -71,21 +69,21 @@ class UnRar(Extractor): @classmethod def ismultipart(cls, filename): - return True if cls.re_multipart.search(filename) else False + return True if cls._RE_PART.search(filename) else False def verify(self, password=None): p = self.call_cmd("l", "-v", self.target, password=password) out, err = p.communicate() - if self.re_wrongpwd.search(err): + if self._RE_BADPWD.search(err): raise PasswordError - if self.re_wrongcrc.search(err): + if self._RE_BADCRC.search(err): raise CRCError(err) #: Output only used to check if passworded files are present - for attr in self.re_filelist.findall(out): + for attr in self._RE_FILES.findall(out): if attr[0].startswith("*"): raise PasswordError @@ -94,14 +92,14 @@ class UnRar(Extractor): p = self.call_cmd("rc", self.target) #: Communicate and retrieve stderr - self._progress(p) + self.progress(p) err = p.stderr.read().strip() if err or p.returncode: p = self.call_cmd("r", self.target) # communicate and retrieve stderr - self._progress(p) + self.progress(p) err = p.stderr.read().strip() if err or p.returncode: @@ -109,14 +107,14 @@ class UnRar(Extractor): else: dir = os.path.dirname(filename) - name = re_filefixed.search(out).group(1) + name = _RE_FIXNAME.search(out).group(1) self.filename = os.path.join(dir, name) return True - def _progress(self, process): + def progress(self, process): s = "" while True: c = process.stdout.read(1) @@ -125,7 +123,7 @@ class UnRar(Extractor): break #: Reading a percentage sign -> set progress and restart if c == "%": - self.notify_progress(int(s)) + self.notifyprogress(int(s)) s = "" #: Not reading a digit -> therefore restart elif c not in string.digits: @@ -138,17 +136,17 @@ class UnRar(Extractor): def extract(self, password=None): command = "x" if self.fullpath else "e" - p = self.call_cmd(command, self.target, self.out, password=password) + p = self.call_cmd(command, self.target, self.dest, password=password) #: Communicate and retrieve stderr - self._progress(p) + self.progress(p) err = p.stderr.read().strip() if err: - if self.re_wrongpwd.search(err): + if self._RE_BADPWD.search(err): raise PasswordError - elif self.re_wrongcrc.search(err): + elif self._RE_BADCRC.search(err): raise CRCError(err) else: #: Raise error if anything is on stderr @@ -157,18 +155,16 @@ class UnRar(Extractor): if p.returncode: raise ArchiveError(_("Process return code: %d") % p.returncode) - self.files = self.list(password) - - def items(self): + def chunks(self): dir, name = os.path.split(self.filename) #: Actually extracted file files = [self.filename] #: eventually Multipart Files - files.extend(fs_join(dir, os.path.basename(file)) for file in filter(self.ismultipart, os.listdir(dir)) - if re.sub(self.re_multipart, ".rar", name) == re.sub(self.re_multipart, ".rar", file)) + files.extend(fsjoin(dir, os.path.basename(file)) for file in filter(self.ismultipart, os.listdir(dir)) + if re.sub(self._RE_PART, "", name) == re.sub(self._RE_PART, "", file)) return files @@ -189,12 +185,12 @@ class UnRar(Extractor): if not self.fullpath and self.VERSION.startswith('5'): #@NOTE: Unrar 5 always list full path for f in decode(out).splitlines(): - f = fs_join(self.out, os.path.basename(f.strip())) + f = fsjoin(self.dest, os.path.basename(f.strip())) if os.path.isfile(f): - result.add(fs_join(self.out, os.path.basename(f))) + result.add(fsjoin(self.dest, os.path.basename(f))) else: for f in decode(out).splitlines(): - result.add(fs_join(self.out, f.strip())) + result.add(fsjoin(self.dest, f.strip())) return list(result) @@ -226,9 +222,9 @@ class UnRar(Extractor): #@NOTE: return codes are not reliable, some kind of threading, cleanup whatever issue call = [self.CMD, command] + args + list(xargs) + self.log_debug("EXECUTE " + " ".join(call)) - self.log_debug(" ".join(call)) - + call = map(encode, call) p = subprocess.Popen(call, stdout=subprocess.PIPE, stderr=subprocess.PIPE) renice(p.pid, self.priority) diff --git a/module/plugins/internal/UnTar.py b/module/plugins/internal/UnTar.py new file mode 100644 index 000000000..f2a140ca7 --- /dev/null +++ b/module/plugins/internal/UnTar.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- + +from __future__ import with_statement + +import sys +import tarfile + +from module.plugins.internal.Extractor import Extractor, ArchiveError, CRCError +from module.plugins.internal.misc import encode + + +class UnTar(Extractor): + __name__ = "UnTar" + __type__ = "extractor" + __version__ = "0.01" + __status__ = "stable" + + __description__ = """TAR extractor plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + VERSION = "%s.%s.%s" % (sys.version_info[0], sys.version_info[1], sys.version_info[2]) + + + @classmethod + def isarchive(cls, filename): + return tarfile.is_tarfile(encode(filename)) + + + @classmethod + def find(cls): + return sys.version_info[:2] >= (2, 5) + + + def list(self, password=None): + with tarfile.open(self.target) as t: + return t.getnames() + + + def verify(self, password=None): + try: + t = tarfile.open(self.target, errorlevel=1) + + except tarfile.CompressionError, e: + raise CRCError(e) + + except (OSError, tarfile.TarError), e: + raise ArchiveError(e) + + else: + t.close() + + + def extract(self, password=None): + self.verify() + + try: + with tarfile.open(self.target, errorlevel=2) as t: + t.extractall(self.dest) + + except tarfile.ExtractError, e: + self.log_warning(e) + + except tarfile.CompressionError, e: + raise CRCError(e) + + except (OSError, tarfile.TarError), e: + raise ArchiveError(e) diff --git a/module/plugins/internal/UnZip.py b/module/plugins/internal/UnZip.py index ff929ae00..50ab80da3 100644 --- a/module/plugins/internal/UnZip.py +++ b/module/plugins/internal/UnZip.py @@ -2,26 +2,30 @@ from __future__ import with_statement -import os import sys import zipfile from module.plugins.internal.Extractor import Extractor, ArchiveError, CRCError, PasswordError +from module.plugins.internal.misc import encode class UnZip(Extractor): __name__ = "UnZip" __type__ = "extractor" - __version__ = "1.20" + __version__ = "1.21" __status__ = "stable" - __description__ = """Zip extractor plugin""" + __description__ = """ZIP extractor plugin""" __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - VERSION = "%s.%s.%s" % (sys.version_info[0], sys.version_info[1], sys.version_info[2]) - EXTENSIONS = [".zip", ".zip64"] + VERSION = "%s.%s.%s" % (sys.version_info[0], sys.version_info[1], sys.version_info[2]) + + + @classmethod + def isarchive(cls, filename): + return zipfile.is_zipfile(encode(filename)) @classmethod @@ -30,49 +34,35 @@ class UnZip(Extractor): def list(self, password=None): - with zipfile.ZipFile(self.target, 'r', allowZip64=True) as z: + with zipfile.ZipFile(self.target, 'r') as z: z.setpassword(password) return z.namelist() def verify(self, password=None): - with zipfile.ZipFile(self.target, 'r', allowZip64=True) as z: - z.setpassword(password) - - try: - badfile = z.testzip() - - except RuntimeError, e: - if "encrypted" in e.args[0] or "Bad password" in e.args[0]: - raise PasswordError - else: - raise CRCError("Archive damaged") - - else: - if badfile: - raise CRCError(badfile) - - - - def extract(self, password=None): try: - with zipfile.ZipFile(self.target, 'r', allowZip64=True) as z: + with zipfile.ZipFile(self.target, 'r') as z: z.setpassword(password) - - badfile = z.testzip() - - if badfile: + if z.testzip(): raise CRCError(badfile) - else: - z.extractall(self.out) except (zipfile.BadZipfile, zipfile.LargeZipFile), e: raise ArchiveError(e) except RuntimeError, e: if "encrypted" in e.args[0] or "Bad password" in e.args[0]: - raise PasswordError + raise PasswordError(e) else: - raise ArchiveError(e) - else: - self.files = z.namelist() + raise CRCError(e) + + + def extract(self, password=None): + self.verify(password) + + try: + with zipfile.ZipFile(self.target, 'r') as z: + z.setpassword(password) + z.extractall(self.dest) + + except RuntimeError, e: + raise ArchiveError(e) diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py index 5e93f3fe4..f5aa37c81 100644 --- a/module/plugins/internal/XFSAccount.py +++ b/module/plugins/internal/XFSAccount.py @@ -5,13 +5,13 @@ import time import urlparse from module.plugins.internal.MultiAccount import MultiAccount -from module.plugins.internal.utils import parse_html_form, parse_time, set_cookie +from module.plugins.internal.misc import parse_html_form, parse_time, set_cookie class XFSAccount(MultiAccount): __name__ = "XFSAccount" __type__ = "account" - __version__ = "0.56" + __version__ = "0.57" __status__ = "stable" __config__ = [("activated" , "bool" , "Activated" , True ), @@ -197,8 +197,10 @@ class XFSAccount(MultiAccount): def check_errors(self): + self.log_info(_("Checking for link errors...")) + if not self.data: - self.log_debug("No data to check") + self.log_warning(_("No data to check")) return m = re.search(self.LOGIN_BAN_PATTERN, self.data) @@ -231,3 +233,5 @@ class XFSAccount(MultiAccount): self.timeout = self.LOGIN_TIMEOUT self.fail_login(errmsg) + + self.log_info(_("No errors found")) diff --git a/module/plugins/internal/XFSCrypter.py b/module/plugins/internal/XFSCrypter.py index 7e0c14fe1..d80276cfb 100644 --- a/module/plugins/internal/XFSCrypter.py +++ b/module/plugins/internal/XFSCrypter.py @@ -1,21 +1,20 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo -from module.plugins.internal.utils import set_cookie +from module.plugins.internal.SimpleCrypter import SimpleCrypter +from module.plugins.internal.misc import set_cookie class XFSCrypter(SimpleCrypter): __name__ = "XFSCrypter" __type__ = "crypter" - __version__ = "0.22" + __version__ = "0.23" __status__ = "stable" __pattern__ = r'^unmatchable$' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("use_subfolder" , "bool", "Save package to subfolder" , True), - ("subfolder_per_package", "bool", "Create a subfolder for each package" , True), - ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("use_premium" , "bool" , "Use premium account if available" , True ), + ("folder_per_package", "Default;Yes;No", "Create folder for each package" , "Default"), + ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )] __description__ = """XFileSharing decrypter plugin""" __license__ = "GPLv3" diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py index e8c2073bd..dabf1457a 100644 --- a/module/plugins/internal/XFSHoster.py +++ b/module/plugins/internal/XFSHoster.py @@ -1,18 +1,19 @@ # -*- coding: utf-8 -*- +import operator import random import re from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.captcha.SolveMedia import SolveMedia -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -from module.plugins.internal.utils import html_unescape, seconds_to_midnight, set_cookie +from module.plugins.internal.SimpleHoster import SimpleHoster +from module.plugins.internal.misc import html_unescape, seconds_to_midnight, set_cookie class XFSHoster(SimpleHoster): __name__ = "XFSHoster" __type__ = "hoster" - __version__ = "0.71" + __version__ = "0.72" __status__ = "stable" __pattern__ = r'^unmatchable$' @@ -230,12 +231,12 @@ class XFSHoster(SimpleHoster): self.log_debug(captcha_div) - inputs['code'] = "".join(a[1] for a in sorted(numerals, key=lambda num: int(num[0]))) + inputs['code'] = "".join(a[1] for a in sorted(numerals, key=operator.itemgetter(0))) self.log_debug("Captcha code: %s" % inputs['code'], numerals) return - recaptcha = ReCaptcha(self) + recaptcha = ReCaptcha(self.pyfile) try: captcha_key = re.search(self.RECAPTCHA_PATTERN, self.data).group(1) @@ -246,10 +247,11 @@ class XFSHoster(SimpleHoster): self.log_debug("ReCaptcha key: %s" % captcha_key) if captcha_key: + self.captcha = recaptcha inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge(captcha_key) return - solvemedia = SolveMedia(self) + solvemedia = SolveMedia(self.pyfile) try: captcha_key = re.search(self.SOLVEMEDIA_PATTERN, self.data).group(1) @@ -260,4 +262,5 @@ class XFSHoster(SimpleHoster): self.log_debug("SolveMedia key: %s" % captcha_key) if captcha_key: + self.captcha = solvemedia inputs['adcopy_response'], inputs['adcopy_challenge'] = solvemedia.challenge(captcha_key) diff --git a/module/plugins/internal/misc.py b/module/plugins/internal/misc.py new file mode 100644 index 000000000..2cd843109 --- /dev/null +++ b/module/plugins/internal/misc.py @@ -0,0 +1,892 @@ +# -*- coding: utf-8 -*- +# +#@TODO: Move to misc directory in 0.4.10 + +from __future__ import with_statement + +# import HTMLParser #@TODO: Use in 0.4.10 +import datetime +import hashlib +import htmlentitydefs +import itertools +import os +import re +import shutil +import string +import sys +import time +import traceback +import urllib +import urlparse +import xml.sax.saxutils #@TODO: Remove in 0.4.10 +import zlib + +try: + import simplejson as json + +except ImportError: + import json + + +#@TODO: Remove in 0.4.10 +class misc(object): + __name__ = "misc" + __type__ = "plugin" + __version__ = "0.11" + __status__ = "stable" + + __pattern__ = r'^unmatchable$' + __config__ = [] + + __description__ = """Dummy utils class""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + +class Config(object): + + def __init__(self, plugin): + self.plugin = plugin + + + def set(self, option, value): + """ + Set config value for current plugin + + :param option: + :param value: + :return: + """ + self.plugin.pyload.api.setConfigValue(self.plugin.classname, option, value, section="plugin") + + + def get(self, option, default=None): + """ + Returns config value for current plugin + + :param option: + :return: + """ + try: + return self.plugin.pyload.config.getPlugin(self.plugin.classname, option) + + except KeyError: + self.plugin.log_debug("Config option `%s` not found, use default `%s`" % (option, default)) #@TODO: Restore to `log_warning` in 0.4.10 + return default + + +class DB(object): + + def __init__(self, plugin): + self.plugin = plugin + + + def store(self, key, value): + """ + Saves a value persistently to the database + """ + value = map(decode, value) if isiterable(value) else decode(value) + entry = json.dumps(value).encode('base64') + self.plugin.pyload.db.setStorage(self.plugin.classname, key, entry) + + + def retrieve(self, key=None, default=None): + """ + Retrieves saved value or dict of all saved entries if key is None + """ + entry = self.plugin.pyload.db.getStorage(self.plugin.classname, key) + + if key: + if entry is None: + value = default + else: + value = json.loads(entry.decode('base64')) + else: + if not entry: + value = default + else: + value = dict((k, json.loads(v.decode('base64'))) for k, v in value.items()) + + return value + + + def delete(self, key): + """ + Delete entry in db + """ + self.plugin.pyload.db.delStorage(self.plugin.classname, key) + + +class Periodical(object): + + def __init__(self, plugin, task=lambda x: x, interval=None): + self.plugin = plugin + self.task = task + self.cb = None + self.interval = interval + + + def set_interval(self, value): + newinterval = max(0, value) + + if newinterval != value: + return False + + if newinterval != self.interval: + self.interval = newinterval + + return True + + + def start(self, interval=None, threaded=False, delay=0): + if interval is not None and self.set_interval(interval) is False: + return False + else: + self.cb = self.plugin.pyload.scheduler.addJob(max(1, delay), self._task, [threaded], threaded=threaded) + return True + + + def restart(self, *args, **kwargs): + self.stop() + return self.start(*args, **kwargs) + + + def stop(self): + try: + return self.plugin.pyload.scheduler.removeJob(self.cb) + + except Exception: + return False + + finally: + self.cb = None + + + def _task(self, threaded): + try: + self.task() + + except Exception, e: + self.log_error(_("Error performing periodical task"), e) + + self.restart(threaded=threaded, delay=self.interval) + + +class SimpleQueue(object): + + def __init__(self, plugin, storage="queue"): + self.plugin = plugin + self.storage = storage + + + def get(self): + return self.plugin.db.retrieve(self.storage, default=[]) + + + def set(self, value): + return self.plugin.db.store(self.storage, value) + + + def delete(self): + return self.plugin.db.delete(self.storage) + + + 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() + try: + queue.remove(item) + + except ValueError: + pass + + if isinstance(queue, list): + return self.delete() + + return self.set(queue) + + +def lock(fn): + def new(*args): + args[0].lock.acquire() + try: + return fn(*args) + + finally: + args[0].lock.release() + + return new + + +def format_time(value): + dt = datetime.datetime(1, 1, 1) + datetime.timedelta(seconds=abs(int(value))) + days = ("%d days and " % (dt.day - 1)) if dt.day > 1 else "" + return days + ", ".join("%d %ss" % (getattr(dt, attr), attr) + for attr in ("hour", "minute", "second") + if getattr(dt, attr)) + + +def format_size(value): + for unit in ('B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB'): + if abs(value) < 1024.0: + return "%3.2f %s" % (value, unit) + else: + value /= 1024.0 + + return "%.2f %s" % (value, 'EiB') + + +def compare_time(start, end): + start = map(int, start) + end = map(int, end) + + if start == end: + return True + + now = list(time.localtime()[3:5]) + + if start < end: + if now < end: + return True + + elif now > start or now < end: + return True + + return False + + +def free_space(folder): + if os.name is "nt": + import ctypes + + free_bytes = ctypes.c_ulonglong(0) + ctypes.windll.kernel32.GetDiskFreeSpaceExW(ctypes.c_wchar_p(folder), + None, + None, + ctypes.pointer(free_bytes)) + return free_bytes.value + + else: + s = os.statvfs(folder) + return s.f_frsize * s.f_bavail + + +def fsbsize(path): + """ + Get optimal file system buffer size (in bytes) for I/O calls + """ + path = encode(path) + + if os.name is "nt": + import ctypes + + drive = "%s\\" % os.path.splitdrive(path)[0] + cluster_sectors, sector_size = ctypes.c_longlong(0) + + ctypes.windll.kernel32.GetDiskFreeSpaceW(ctypes.c_wchar_p(drive), + ctypes.pointer(cluster_sectors), + ctypes.pointer(sector_size), + None, + None) + return cluster_sectors * sector_size + + else: + return os.statvfs(path).f_frsize + + +def uniqify(seq): + """ + Remove duplicates from list preserving order + Originally by Dave Kirby + """ + seen = set() + seen_add = seen.add + return [x for x in seq if x not in seen and not seen_add(x)] + + +def has_method(obj, name): + """ + Check if name was defined in obj (return false if inhereted) + """ + return hasattr(obj, '__dict__') and name in obj.__dict__ + + +def html_unescape(text): + """ + Removes HTML or XML character references and entities from a text string + """ + return xml.sax.saxutils.unescape(text) + #@TODO: Replace in 0.4.10 with: + # h = HTMLParser.HTMLParser() + # return h.unescape(text) + + +def isiterable(obj): + """ + Check if object is iterable (string excluded) + """ + return hasattr(obj, "__iter__") + + +def get_console_encoding(enc): + if os.name is "nt": + if enc is "cp65001": #: aka UTF-8 + enc = "cp850" + # print "WARNING: Windows codepage 65001 (UTF-8) is not supported, used `%s` instead" % enc + else: + enc = "utf8" + + return enc + + +#@NOTE: Revert to `decode` in Python 3 +def decode(value, encoding=None, errors='strict'): + """ + Encoded string (default to own system encoding) -> unicode string + """ + if type(value) is str: + res = unicode(value, encoding or get_console_encoding(sys.stdout.encoding), errors) + + elif type(value) is unicode: + res = value + + else: + res = unicode(value) + + return res + + +def transcode(value, decoding, encoding): + return value.decode(decoding).encode(encoding) + + +def encode(value, encoding='utf-8', errors='backslashreplace'): + """ + Unicode string -> encoded string (default to UTF-8) + """ + if type(value) is unicode: + res = value.encode(encoding, errors) + + elif type(value) is str: + decoding = get_console_encoding(sys.stdin.encoding) + if encoding == decoding: + res = value + else: + res = transcode(value, decoding, encoding) + + else: + res = str(value) + + return res + + +def exists(path): + path = encode(path) + + if os.path.exists(path): + if os.name is "nt": + dir, name = os.path.split(path.rstrip(os.sep)) + return name in os.listdir(dir) + else: + return True + else: + return False + + +def remove(self, path, trash=True): + path = encode(path) + + if not exists(path): + return + + if trash: + send2trash.send2trash(path) + + elif os.path.isdir(path): + shutil.rmtree(path, ignore_errors=True) + + else: + os.remove(path) + + +def fsjoin(*args): + """ + Like os.path.join, but encoding aware + (for safe-joining see `safejoin`) + """ + return encode(os.path.join(args)) + + +def remove_chars(value, repl): + """ + Remove all chars in repl from string + """ + if type(repl) is unicode: + for badc in list(repl): + value = value.replace(badc, "") + return value + + elif type(value) is unicode: + return value.translate(dict((ord(s), None) for s in repl)) + + elif type(value) is str: + return value.translate(string.maketrans("", ""), repl) + + +def fixurl(url, unquote=None): + old = url + url = urllib.unquote(url) + + if unquote is None: + unquote = url is old + + url = html_unescape(decode(url).decode('unicode-escape')) + url = re.sub(r'(?<!:)/{2,}', '/', url).strip().lstrip('.') + + if not unquote: + url = urllib.quote(url) + + return url + + +def truncate(name, length): + max_trunc = len(name) / 2 + if length > max_trunc: + raise OSError("File name too long") + + trunc = int((len(name) - length) / 3) + return "%s~%s" % (name[:trunc * 2], name[-trunc:]) + + +#@TODO: Recheck in 0.4.10 +def safepath(value): + """ + Remove invalid characters and truncate the path if needed + """ + drive, filename = os.path.splitdrive(value) + filename = os.path.join(*map(safename, filename.split(os.sep))) + path = os.path.abspath(drive + filename) + + try: + if os.name is not "nt": + return + + length = len(path) - 259 + if length < 1: + return + + dirname, basename = os.path.split(filename) + name, ext = os.path.splitext(basename) + path = drive + dirname + truncate(name, length) + ext + + finally: + return path + + +def safejoin(*args): + """ + os.path.join + safepath + """ + return safepath(os.path.join(*args)) + + +def safename(value): + """ + Remove invalid characters + """ + repl = '<>:"/\\|?*' if os.name is "nt" else '\0/\\"' + name = remove_chars(value, repl) + return name + + +def parse_name(value, safechar=True): + path = fixurl(decode(value), unquote=False) + url_p = urlparse.urlparse(path.rstrip('/')) + name = (url_p.path.split('/')[-1] or + url_p.query.split('=', 1)[::-1][0].split('&', 1)[0] or + url_p.netloc.split('.', 1)[0]) + + name = urllib.unquote(name) + return safename(name) if safechar else name + + +def parse_size(value, unit=""): #: returns bytes + m = re.match(r"([\d.,]+)\s*([\w^_]*)", str(value).lower()) + + if m is None: + return 0 + + size = float(m.group(1).replace(',', '.')) + unit = (unit.strip().lower() or m.group(2) or "byte")[0] + + if unit is "b": + return int(size) + + sizeunits = ['b', 'k', 'm', 'g', 't', 'p', 'e'] + sizemap = dict((u, i * 10) for i, u in enumerate(sizeunits)) + magnitude = sizemap[unit] + + i, d = divmod(size, 1) + integer = int(i) << magnitude + decimal = int(d * (1024 ** (magnitude / 10))) + + return integer + decimal + + +def str2int(value): + try: + return int(value) + except: + pass + + ones = ("zero", "one", "two", "three", "four", "five", "six", "seven", "eight", + "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", + "sixteen", "seventeen", "eighteen", "nineteen") + tens = ("", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", + "eighty", "ninety") + + o_tuple = [(w, i) for i, w in enumerate(ones)] + t_tuple = [(w, i * 10) for i, w in enumerate(tens)] + + numwords = dict(o_tuple + t_tuple) + tokens = re.split(r"[\s\-]+", value.lower()) + + try: + return sum(numwords[word] for word in tokens) + except: + return 0 + + +def parse_time(value): + if re.search("da(il)?y|today", value): + seconds = seconds_to_midnight() + + else: + regex = re.compile(r'(\d+| (?:this|an?) )\s*(hr|hour|min|sec|)', re.I) + seconds = sum((int(v) if v.strip() not in ("this", "a", "an") else 1) * + {'hr': 3600, 'hour': 3600, 'min': 60, 'sec': 1, '': 1}[u.lower()] + for v, u in regex.findall(value)) + return seconds + + +def timestamp(): + return int(time.time() * 1000) + + +def check_module(module): + try: + __import__(module) + + except Exception: + return False + + else: + return True + + +def check_prog(command): + pipe = subprocess.PIPE + try: + subprocess.call(command, stdout=pipe, stderr=pipe) + + except Exception: + return False + + else: + return True + + +def isexecutable(filename): + file = encode(filename) + return os.path.isfile(file) and os.access(file, os.X_OK) + + +def which(filename): + """ + Works exactly like the unix command which + Courtesy of http://stackoverflow.com/a/377028/675646 + """ + dirname, basename = os.path.split(filename) + + if dirname: + return filename if isexecutable(filename) else None + + else: + for path in os.environ['PATH'].split(os.pathsep): + filename = os.path.join(path.strip('"'), filename) + if isexecutable(filename): + return filename + + +def format_exc(frame=None): + """ + Format call-stack and display exception information (if availible) + """ + exc_info = sys.exc_info() + exc_desc = "" + + callstack = traceback.extract_stack(frame) + callstack = callstack[:-1] + + if exc_info[0] is not None: + exception_callstack = traceback.extract_tb(exc_info[2]) + + if callstack[-1][0] == exception_callstack[0][0]: #@NOTE: Does this exception belongs to us? + callstack = callstack[:-1] + callstack.extend(exception_callstack) + exc_desc = "".join(traceback.format_exception_only(exc_info[0], exc_info[1])) + + msg = "Traceback (most recent call last):\n" + msg += "".join(traceback.format_list(callstack)) + msg += exc_desc + + return msg + + +def seconds_to_nexthour(strict=False): + now = datetime.datetime.today() + nexthour = now.replace(minute=0 if strict else 1, second=0, microsecond=0) + datetime.timedelta(hours=1) + return (nexthour - now).seconds + + +def seconds_to_midnight(utc=None, strict=False): + if utc is None: + now = datetime.datetime.today() + else: + now = datetime.datetime.utcnow() + datetime.timedelta(hours=utc) + + midnight = now.replace(hour=0, minute=0 if strict else 1, second=0, microsecond=0) + datetime.timedelta(days=1) + + return (midnight - now).seconds + + +def replace_patterns(value, rules): + for r in rules: + try: + pattern, repl, flags = r + + except ValueError: + pattern, repl = r + flags = 0 + + value = re.sub(pattern, repl, value, flags) + + return value + + +#@TODO: Remove in 0.4.10 and fix exp in CookieJar.setCookie +def set_cookie(cj, domain, name, value, path='/', exp=time.time() + 180 * 24 * 3600): + args = map(encode, [domain, name, value, path]) + [int(exp)] + return cj.setCookie(*args) + + +def set_cookies(cj, cookies): + for cookie in cookies: + if not isinstance(cookie, tuple): + continue + + if len(cookie) is not 3: + continue + + set_cookie(cj, *cookie) + + +def parse_html_header(header): + hdict = {} + regexp = r'[ ]*(?P<key>.+?)[ ]*:[ ]*(?P<value>.+?)[ ]*\r?\n' + + for key, value in re.findall(regexp, header.lower()): + if key in hdict: + header_key = hdict.get(key) + if type(header_key) is list: + header_key.append(value) + else: + hdict[key] = [header_key, value] + else: + hdict[key] = value + + return hdict + + +def parse_html_tag_attr_value(attr_name, tag): + m = re.search(r"%s\s*=\s*([\"']?)((?<=\")[^\"]+|(?<=')[^']+|[^>\s\"'][^>\s]*)\1" % attr_name, tag, re.I) + return m.group(2) if m else None + + +def parse_html_form(attr_str, html, input_names={}): + for form in re.finditer(r"(?P<TAG><form[^>]*%s[^>]*>)(?P<CONTENT>.*?)</?(form|body|html)[^>]*>" % attr_str, + html, re.I | re.S): + inputs = {} + action = parse_html_tag_attr_value("action", form.group('TAG')) + + for inputtag in re.finditer(r'(<(input|textarea)[^>]*>)([^<]*(?=</\2)|)', form.group('CONTENT'), re.I | re.S): + name = parse_html_tag_attr_value("name", inputtag.group(1)) + if name: + value = parse_html_tag_attr_value("value", inputtag.group(1)) + if not value: + inputs[name] = inputtag.group(3) or "" + else: + inputs[name] = value + + if not input_names: + #: No attribute check + return action, inputs + else: + #: Check input attributes + for key, value in input_names.items(): + if key in inputs: + if isinstance(value, basestring) and inputs[key] is value: + continue + elif isinstance(value, tuple) and inputs[key] in value: + continue + elif hasattr(value, "search") and re.match(value, inputs[key]): + continue + else: + break #: Attibute value does not match + else: + break #: Attibute name does not match + else: + return action, inputs #: Passed attribute check + + return {}, None #: No matching form found + + +def chunks(iterable, size): + it = iter(iterable) + item = list(itertools.islice(it, size)) + while item: + yield item + item = list(itertools.islice(it, size)) + + +def renice(pid, value): + if not value or os.name is "nt": + return + + try: + subprocess.Popen(["renice", str(value), str(pid)], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + bufsize=-1) + except Exception: + pass + + +def forward(source, destination): + try: + bufsize = 1024 + bufdata = source.recv(bufsize) + while bufdata: + destination.sendall(bufdata) + bufdata = source.recv(bufsize) + finally: + destination.shutdown(socket.SHUT_WR) + + +def compute_checksum(filename, hashtype): + file = encode(filename) + + if not exists(file): + return None + + buf = fsbsize() + + if hashtype in ("adler32", "crc32"): + hf = getattr(zlib, hashtype) + last = 0 + + with open(file, "rb") as f: + for chunk in iter(lambda: f.read(buf), b''): + last = hf(chunk, last) + + return "%x" % last + + elif hashtype in hashlib.algorithms_available: + h = hashlib.new(hashtype) + + with open(file, "rb") as f: + for chunk in iter(lambda: f.read(buf * h.block_size), b''): + h.update(chunk) + + return h.hexdigest() + + else: + return None + + +def copy_tree(src, dst, overwrite=False, preserve_metadata=False): + pmode = preserve_metadata or overwrite is None + mtime = os.path.getmtime + copy = shutil.copy2 if pmode else shutil.copy + + if preserve_metadata and not exists(dst): + return shutil.copytree(src, dst) + + for src_dir, dirs, files in os.walk(src, topdown=False): + dst_dir = src_dir.replace(src, dst, 1) + + if not exists(dst_dir): + os.makedirs(dst_dir) + if pmode: + shutil.copystat(src_dir, dst_dir) + + elif pmode: + if overwrite or overwrite is None and mtime(src_dir) > mtime(dst_dir): + shutil.copystat(src_dir, dst_dir) + + for filename in files: + src_file = fsjoin(src_dir, filename) + dst_file = fsjoin(dst_dir, filename) + + if exists(dst_file): + if overwrite or overwrite is None and mtime(src_file) > mtime(dst_file): + os.remove(dst_file) + else: + continue + + copy(src_file, dst_dir) + + +def move_tree(src, dst, overwrite=False): + mtime = os.path.getmtime + + for src_dir, dirs, files in os.walk(src, topdown=False): + dst_dir = src_dir.replace(src, dst, 1) + del_dir = True + + if not exists(dst_dir): + os.makedirs(dst_dir) + shutil.copystat(src_dir, dst_dir) + + elif overwrite or overwrite is None and mtime(src_dir) > mtime(dst_dir): + shutil.copystat(src_dir, dst_dir) + + else: + del_dir = False + + for filename in files: + src_file = fsjoin(src_dir, filename) + dst_file = fsjoin(dst_dir, filename) + + if exists(dst_file): + if overwrite or overwrite is None and mtime(src_file) > mtime(dst_file): + os.remove(dst_file) + else: + continue + + shutil.move(src_file, dst_dir) + + if not del_dir: + continue + + try: + os.rmdir(src_dir) + except OSError: + pass diff --git a/module/plugins/internal/utils.py b/module/plugins/internal/utils.py deleted file mode 100644 index 02077cffd..000000000 --- a/module/plugins/internal/utils.py +++ /dev/null @@ -1,482 +0,0 @@ -# -*- coding: utf-8 -*- -# -#@TODO: Move to utils directory 0.4.10 - -import datetime -import htmlentitydefs -import itertools -import os -import re -import string -import sys -import time -import traceback -import urllib -import urlparse - -try: - import HTMLParser - -except ImportError: #@TODO: Remove in 0.4.10 - import xml.sax.saxutils - -try: - import simplejson as json - -except ImportError: - import json - - -class utils(object): - __name__ = "utils" - __type__ = "plugin" - __version__ = "0.09" - __status__ = "stable" - - __pattern__ = r'^unmatchable$' - __config__ = [] - - __description__ = """Dummy utils class""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - -def lock(fn): - def new(*args): - # print "Handler: %s args: %s" % (fn, args[1:]) - args[0].lock.acquire() - try: - return fn(*args) - - finally: - args[0].lock.release() - - return new - - -def format_time(value): - dt = datetime.datetime(1, 1, 1) + datetime.timedelta(seconds=abs(int(value))) - days = ("%d days and " % (dt.day - 1)) if dt.day > 1 else "" - return days + ", ".join("%d %ss" % (getattr(dt, attr), attr) for attr in ("hour", "minute", "second") - if getattr(dt, attr)) - - -def format_size(value): - size = int(value) - steps = 0 - sizes = ('B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB') - while size > 1000: - size /= 1024.0 - steps += 1 - return "%.2f %s" % (size, sizes[steps]) - - -def safe_format(value, unsafe): - """ - Returns the content of value omitting sensitive information - - Args: - value: value to format - unsafe: string or list: sensitive word(s) to remove - """ - if isinstance(value, basestring): - if isinstance(unsafe, basestring): - return "'%s'" % ("**********" if value == unsafe else value) - - elif isinstance(unsafe, list): - return "'%s'" % ("**********" if value in unsafe else value) - - elif isinstance(value, dict): - return "{%s}" % ", ".join("'%s': %s" % (k, safe_format(v, unsafe)) for k, v in value.iteritems()) - - elif isinstance(value, list): - return "[%s]" % ", ".join("%s" % safe_format(v, unsafe) for v in value) - - elif isinstance(value, tuple): - return "(%s)" % ", ".join("%s" % safe_format(v, unsafe) for v in value) - - elif isinstance(value, set): - return "set([%s])" % ", ".join("%s" % safe_format(v, unsafe) for v in value) - - return repr(value) - - -def compare_time(start, end): - start = map(int, start) - end = map(int, end) - - if start == end: - return True - - now = list(time.localtime()[3:5]) - - if start < end: - if now < end: - return True - - elif now > start or now < end: - return True - - return False - - -def uniqify(seq): - """ - Remove duplicates from list preserving order - Originally by Dave Kirby - """ - seen = set() - seen_add = seen.add - return [x for x in seq if x not in seen and not seen_add(x)] - - -def has_method(obj, name): - """ - Check if name was defined in obj (return false if inhereted) - """ - return hasattr(obj, '__dict__') and name in obj.__dict__ - - -def html_unescape(text): - """ - Removes HTML or XML character references and entities from a text string - """ - try: - h = HTMLParser.HTMLParser() - return h.unescape(text) - - except NameError: #@TODO: Remove in 0.4.10 - return xml.sax.saxutils.unescape(text) - - -def isiterable(obj): - return hasattr(obj, "__iter__") - - -def get_console_encoding(enc): - if os.name is "nt": - if enc is "cp65001": #: aka UTF-8 - enc = "cp850" - print "WARNING: Windows codepage 65001 (UTF-8) is not supported, used `%s` instead" % enc - else: - enc = "utf8" - - return enc - - -#@NOTE: Revert to `decode` in Python 3 -def decode(value, encoding=None): - """ - Encoded string (default to UTF-8) -> unicode string - """ - if type(value) is str: - try: - # res = value.decode(encoding or 'utf-8') - res = unicode(value, encoding or 'utf-8') - - except UnicodeDecodeError, e: - if encoding: - raise UnicodeDecodeError(e) - - encoding = get_console_encoding(sys.stdout.encoding) - # res = value.decode(encoding) - res = unicode(value, encoding) - - elif type(value) is unicode: - res = value - - else: - res = unicode(value) - - return res - - -def encode(value, encoding=None, decoding=None): - """ - Unicode or decoded string -> encoded string (default to UTF-8) - """ - if type(value) is unicode: - res = value.encode(encoding or "utf-8") - - # elif type(value) is str: - # res = encode(decode(value, decoding), encoding) - - else: - res = str(value) - - return res - - -def fs_join(*args): - """ - Like os.path.join, but encoding aware - """ - return os.path.join(*map(encode, args)) - - -def exists(path): - if os.path.exists(path): - if os.name is "nt": - dir, name = os.path.split(path.rstrip(os.sep)) - return name in os.listdir(dir) - else: - return True - else: - return False - - -def remove_chars(value, repl): - """ - Remove all chars in repl from string - """ - if type(repl) is unicode: - for badc in list(repl): - value = value.replace(badc, "") - return value - - elif type(value) is unicode: - return value.translate(dict((ord(s), None) for s in repl)) - - elif type(value) is str: - return value.translate(string.maketrans("", ""), repl) - - -def fixurl(url, unquote=None): - old = url - url = urllib.unquote(url) - - if unquote is None: - unquote = url is old - - url = html_unescape(decode(url).decode('unicode-escape')) - url = re.sub(r'(?<!:)/{2,}', '/', url).strip().lstrip('.') - - if not unquote: - url = urllib.quote(url) - - return url - - -def fixname(value): - repl = '<>:"/\\|?*' if os.name is "nt" else '\0/\\"' - return remove_chars(value, repl) - - -def parse_name(value, safechar=True): - path = fixurl(decode(value), unquote=False) - url_p = urlparse.urlparse(path.rstrip('/')) - name = (url_p.path.split('/')[-1] or - url_p.query.split('=', 1)[::-1][0].split('&', 1)[0] or - url_p.netloc.split('.', 1)[0]) - - name = urllib.unquote(name) - return fixname(name) if safechar else name - - -def parse_size(value, unit=""): #: returns bytes - m = re.match(r"([\d.,]+)\s*([\w^_]*)", str(value).lower()) - - if m is None: - return 0 - - traffic = float(m.group(1).replace(',', '.')) - unit = (unit.strip().lower() or m.group(2) or "byte")[0] - - if unit is "b": - return int(traffic) - - sizes = ['b', 'k', 'm', 'g', 't', 'p', 'e'] - sizemap = dict((u, i * 10) for i, u in enumerate(sizes)) - - increment = sizemap[unit] - integer, decimal = map(int, ("%.3f" % traffic).split('.')) - - return (integer << increment) + (decimal << increment - 10) - - -def str2int(value): - try: - return int(value) - except: - pass - - ones = ("zero", "one", "two", "three", "four", "five", "six", "seven", "eight", - "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", - "sixteen", "seventeen", "eighteen", "nineteen") - tens = ("", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", - "eighty", "ninety") - - o_tuple = [(w, i) for i, w in enumerate(ones)] - t_tuple = [(w, i * 10) for i, w in enumerate(tens)] - - numwords = dict(o_tuple + t_tuple) - tokens = re.split(r"[\s\-]+", value.lower()) - - try: - return sum(numwords[word] for word in tokens) - except: - return 0 - - -def parse_time(value): - if re.search("da(il)?y|today", value): - seconds = seconds_to_midnight() - - else: - regex = re.compile(r'(\d+| (?:this|an?) )\s*(hr|hour|min|sec|)', re.I) - seconds = sum((int(v) if v.strip() not in ("this", "a", "an") else 1) * - {'hr': 3600, 'hour': 3600, 'min': 60, 'sec': 1, '': 1}[u.lower()] - for v, u in regex.findall(value)) - return seconds - - -def timestamp(): - return int(time.time() * 1000) - - -def which(program): - """ - Works exactly like the unix command which - Courtesy of http://stackoverflow.com/a/377028/675646 - """ - isExe = lambda x: os.path.isfile(x) and os.access(x, os.X_OK) - - fpath, fname = os.path.split(program) - - if fpath: - if isExe(program): - return program - else: - for path in os.environ['PATH'].split(os.pathsep): - exe_file = os.path.join(path.strip('"'), program) - if isExe(exe_file): - return exe_file - - -def format_exc(frame=None): - """ - Format call-stack and display exception information (if availible) - """ - exception_info = sys.exc_info() - callstack_list = traceback.extract_stack(frame) - callstack_list = callstack_list[:-1] - - exception_desc = "" - if exception_info[0] is not None: - exception_callstack_list = traceback.extract_tb(exception_info[2]) - if callstack_list[-1][0] == exception_callstack_list[0][0]: #Does this exception belongs to us? - callstack_list = callstack_list[:-1] - callstack_list.extend(exception_callstack_list) - exception_desc = "".join(traceback.format_exception_only(exception_info[0], exception_info[1])) - - traceback_str = "Traceback (most recent call last):\n" - traceback_str += "".join(traceback.format_list(callstack_list)) - traceback_str += exception_desc - - return traceback_str - - -def seconds_to_nexthour(strict=False): - now = datetime.datetime.today() - nexthour = now.replace(minute=0 if strict else 1, second=0, microsecond=0) + datetime.timedelta(hours=1) - return (nexthour - now).seconds - - -def seconds_to_midnight(utc=None, strict=False): - if utc is None: - now = datetime.datetime.today() - else: - now = datetime.datetime.utcnow() + datetime.timedelta(hours=utc) - - midnight = now.replace(hour=0, minute=0 if strict else 1, second=0, microsecond=0) + datetime.timedelta(days=1) - - return (midnight - now).seconds - - -def replace_patterns(value, rules): - for r in rules: - try: - pattern, repl, flags = r - - except ValueError: - pattern, repl = r - flags = 0 - - value = re.sub(pattern, repl, value, flags) - - return value - - -#@TODO: Remove in 0.4.10 and fix exp in CookieJar.setCookie -def set_cookie(cj, domain, name, value, path='/', exp=time.time() + 180 * 24 * 3600): - return cj.setCookie(encode(domain), encode(name), encode(value), encode(path), int(exp)) - - -def set_cookies(cj, cookies): - for cookie in cookies: - if isinstance(cookie, tuple) and len(cookie) == 3: - set_cookie(cj, *cookie) - - -def parse_html_tag_attr_value(attr_name, tag): - m = re.search(r"%s\s*=\s*([\"']?)((?<=\")[^\"]+|(?<=')[^']+|[^>\s\"'][^>\s]*)\1" % attr_name, tag, re.I) - return m.group(2) if m else None - - -def parse_html_form(attr_str, html, input_names={}): - for form in re.finditer(r"(?P<TAG><form[^>]*%s[^>]*>)(?P<CONTENT>.*?)</?(form|body|html)[^>]*>" % attr_str, - html, re.I | re.S): - inputs = {} - action = parse_html_tag_attr_value("action", form.group('TAG')) - - for inputtag in re.finditer(r'(<(input|textarea)[^>]*>)([^<]*(?=</\2)|)', form.group('CONTENT'), re.I | re.S): - name = parse_html_tag_attr_value("name", inputtag.group(1)) - if name: - value = parse_html_tag_attr_value("value", inputtag.group(1)) - if not value: - inputs[name] = inputtag.group(3) or "" - else: - inputs[name] = value - - if not input_names: - #: No attribute check - return action, inputs - else: - #: Check input attributes - for key, val in input_names.items(): - if key in inputs: - if isinstance(val, basestring) and inputs[key] is val: - continue - elif isinstance(val, tuple) and inputs[key] in val: - continue - elif hasattr(val, "search") and re.match(val, inputs[key]): - continue - else: - break #: Attibute value does not match - else: - break #: Attibute name does not match - else: - return action, inputs #: Passed attribute check - - return {}, None #: No matching form found - - -def chunks(iterable, size): - it = iter(iterable) - item = list(itertools.islice(it, size)) - while item: - yield item - item = list(itertools.islice(it, size)) - - -def renice(pid, value): - if not value or os.name is "nt": - return - - try: - subprocess.Popen(["renice", str(value), str(pid)], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - bufsize=-1) - except Exception: - pass |