diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-03-24 17:16:34 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-03-24 17:16:34 +0100 |
commit | 3ae2fbb170ad0f2bfe1ebf7f59e76d3645861f0a (patch) | |
tree | b01e2c881aaf744aaab0af613a7a26e7129f2028 /module/plugins/hooks/ReloadCc.py | |
parent | enter captchas on webui (diff) | |
parent | Rapidgator: fixed bug #47 (diff) | |
download | pyload-3ae2fbb170ad0f2bfe1ebf7f59e76d3645861f0a.tar.xz |
Merge remote-tracking branch 'origin/stable'
Conflicts:
module/plugins/accounts/FilesonicCom.py
module/plugins/accounts/OronCom.py
module/plugins/accounts/ShareonlineBiz.py
module/plugins/addons/UpdateManager.py
module/plugins/crypter/FilesonicComFolder.py
module/plugins/hoster/BezvadataCz.py
module/plugins/hoster/EuroshareEu.py
module/plugins/hoster/FilesonicCom.py
module/plugins/hoster/MegauploadCom.py
module/plugins/hoster/Premium4Me.py
module/plugins/hoster/YoutubeCom.py
module/plugins/internal/MultiHoster.py
module/utils.py
Diffstat (limited to 'module/plugins/hooks/ReloadCc.py')
-rw-r--r-- | module/plugins/hooks/ReloadCc.py | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/module/plugins/hooks/ReloadCc.py b/module/plugins/hooks/ReloadCc.py new file mode 100644 index 000000000..dbd9d659b --- /dev/null +++ b/module/plugins/hooks/ReloadCc.py @@ -0,0 +1,65 @@ +from module.plugins.internal.MultiHoster import MultiHoster + +from module.common.json_layer import json_loads +from module.network.RequestFactory import getURL + +class ReloadCc(MultiHoster): + __name__ = "ReloadCc" + __version__ = "0.3" + __type__ = "hook" + __description__ = """Reload.cc hook plugin""" + + __config__ = [("activated", "bool", "Activated", "False"), + ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), + ("hosterList", "str", "Hoster list (comma separated)", "")] + + __author_name__ = ("Reload Team") + __author_mail__ = ("hello@reload.cc") + + interval = 0 # Disable periodic calls + + def getHoster(self): + # If no accounts are available there will be no hosters available + if not self.account or not self.account.canUse(): + print "ReloadCc: No accounts available" + return [] + + # Get account data + (user, data) = self.account.selectAccount() + + # Get supported hosters list from reload.cc using the json API v1 + query_params = dict( + via='pyload', + v=1, + get_supported='true', + get_traffic='true', + user=user + ) + + try: + query_params.update(dict(hash=self.account.infos[user]['pwdhash'])) + except Exception: + query_params.update(dict(pwd=data['password'])) + + answer = getURL("http://api.reload.cc/login", get=query_params) + data = json_loads(answer) + + + # If account is not valid thera are no hosters available + if data['status'] != "ok": + print "ReloadCc: Status is not ok: %s" % data['status'] + return [] + + # Extract hosters from json file + return data['msg']['supportedHosters'] + + def coreReady(self): + # Get account plugin and check if there is a valid account available + self.account = self.core.accountManager.getAccountPlugin("ReloadCc") + if not self.account.canUse(): + self.account = None + self.logError("Please add a valid reload.cc account first and restart pyLoad.") + return + + # Run the overwriten core ready which actually enables the multihoster hook + return MultiHoster.coreReady(self) |