summaryrefslogtreecommitdiffstats
path: root/module/plugins/accounts/SimplydebridCOM.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/accounts/SimplydebridCOM.py')
-rw-r--r--module/plugins/accounts/SimplydebridCOM.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/module/plugins/accounts/SimplydebridCOM.py b/module/plugins/accounts/SimplydebridCOM.py
new file mode 100644
index 000000000..1679187f6
--- /dev/null
+++ b/module/plugins/accounts/SimplydebridCOM.py
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+from module.plugins.Account import Account
+
+import re
+from time import mktime, strptime
+
+class SimplydebridCOM(Account):
+ __name__ = "SimplydebridCOM"
+ __version__ = "0.1"
+ __type__ = "account"
+ __description__ = """Simply-Debrid.com account plugin"""
+ __author_name__ = ("Kagenoshin")
+ __author_mail__ = ("kagenoshin@gmx.ch")
+
+ def loadAccountInfo(self, user, req):
+ get_data = {
+ }
+ response = req.load("http://simply-debrid.com/api.php?login=2&u="+self.loginname+"&p="+self.password, get = get_data, decode = True, just_header = False)
+ if(response[len(response)-1] == ";"): #remove ; if the v entry ends with ;
+ response = response[0:len(response)-1]
+ data = [x.strip() for x in response.split(";")]
+ if str(data[0]) != "1":
+ account_info = {"trafficleft": 0, "validuntil": 0, "premium": False}
+ else:
+ account_info = {
+ "trafficleft": -1,
+ "validuntil": mktime(strptime(str(data[2]),"%d/%m/%Y")),
+ "premium": True
+ }
+ return account_info
+
+ def login(self, user, data, req):
+ self.loginname = user
+ self.password = data["password"]
+ get_data = {
+ }
+ response = req.load("http://simply-debrid.com/api.php?login=1&u="+self.loginname+"&p="+self.password, get = get_data, decode = True, just_header = False)
+ if response != "02: loggin success":
+ self.wrongPassword() \ No newline at end of file