summaryrefslogtreecommitdiffstats
path: root/module/plugins/accounts
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-06-06 02:30:23 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-06-06 02:30:23 +0200
commit7f371349f8178b569c38a4c55ad01fdad4122c62 (patch)
tree124fb6773c3141f1f6fbf4bc2ce1460744f2962e /module/plugins/accounts
parentFix https://github.com/pyload/pyload/issues/1452 (diff)
parentAdded Comment (diff)
downloadpyload-7f371349f8178b569c38a4c55ad01fdad4122c62.tar.xz
Merge pull request #1455 from EvolutionClip/stable
Added High-Way.Me
Diffstat (limited to 'module/plugins/accounts')
-rw-r--r--module/plugins/accounts/HighWayMe.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/module/plugins/accounts/HighWayMe.py b/module/plugins/accounts/HighWayMe.py
new file mode 100644
index 000000000..76330a3d1
--- /dev/null
+++ b/module/plugins/accounts/HighWayMe.py
@@ -0,0 +1,47 @@
+# -*- coding: utf-8 -*-
+
+from module.common.json_layer import json_loads
+from module.plugins.Account import Account
+
+
+class HighWayMe.py(Account):
+ __name__ = "HighWayMe.py"
+ __type__ = "account"
+ __version__ = "0.01"
+
+ __description__ = """High-Way.Me account plugin"""
+ __license__ = "GPLv3"
+ __authors__ = [("EvolutionClip", "evolutionclip@live.de")]
+
+
+ def loadAccountInfo(self, user, req):
+ premium = False
+ validuntil = -1
+ trafficleft = None
+
+ json_data = req.load('https://high-way.me/api.php?user')
+
+ self.logDebug("JSON data: %s" % json_data)
+
+ json_data = json_loads(json_data)
+
+ if 'premium' in json_data['user'] and json_data['user']['premium']:
+ premium = True
+
+ if 'premium_bis' in json_data['user'] and json_data['user']['premium_bis']:
+ validuntil = float(json_data['user']['premium_bis'])
+
+ if 'premium_traffic' in json_data['user'] and json_data['user']['premium_traffic']:
+ trafficleft = float(json_data['user']['premium_traffic']) / 1024 #@TODO: Remove `/ 1024` in 0.4.10
+
+ return {"premium": premium, "validuntil": validuntil, "trafficleft": trafficleft}
+
+
+ def login(self, user, data, req):
+
+ html = req.load("https://high-way.me/api.php?login",
+ post={'login': '1', 'user': user, 'pass': data['password']},
+ decode=True)
+
+ if 'UserOrPassInvalid' in html:
+ self.wrongPassword()