diff options
author | Ivo Buff <kagenoshin@gmx.ch> | 2013-07-12 11:28:40 +0200 |
---|---|---|
committer | Ivo Buff <kagenoshin@gmx.ch> | 2013-07-12 11:28:40 +0200 |
commit | 88f6fcac584da7e822d9ac4084553972c521f044 (patch) | |
tree | 79d7c70e65564e65baebc24502d9461241ca3680 /module/plugins/accounts | |
parent | SimplydebridCOM plugin added (diff) | |
download | pyload-88f6fcac584da7e822d9ac4084553972c521f044.tar.xz |
Cleanup
Some cleanup and changed tabs to 4 spaces
Diffstat (limited to 'module/plugins/accounts')
-rw-r--r-- | module/plugins/accounts/SimplydebridCOM.py | 56 |
1 files changed, 25 insertions, 31 deletions
diff --git a/module/plugins/accounts/SimplydebridCOM.py b/module/plugins/accounts/SimplydebridCOM.py index 1679187f6..53d707877 100644 --- a/module/plugins/accounts/SimplydebridCOM.py +++ b/module/plugins/accounts/SimplydebridCOM.py @@ -5,35 +5,29 @@ 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 + __name__ = "SimplydebridCOM" + __version__ = "0.1" + __type__ = "account" + __description__ = """Simply-Debrid.com account plugin""" + __author_name__ = ("Kagenoshin") + __author_mail__ = ("kagenoshin@gmx.ch") - 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 + def loadAccountInfo(self, user, req): + response = req.load("http://simply-debrid.com/api.php?login=2&u="+self.loginname+"&p="+self.password, decode = True, just_header = False) + 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"] + response = req.load("http://simply-debrid.com/api.php?login=1&u="+self.loginname+"&p="+self.password, decode = True, just_header = False) + if response != "02: loggin success": + self.wrongPassword()
\ No newline at end of file |