From 834a315649a0090812118f34618e48aff160c162 Mon Sep 17 00:00:00 2001 From: Ivo Buff Date: Fri, 12 Jul 2013 00:45:36 +0200 Subject: SimplydebridCOM plugin added SimplydebridCOM plugin added --- module/plugins/accounts/SimplydebridCOM.py | 39 ++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 module/plugins/accounts/SimplydebridCOM.py (limited to 'module/plugins/accounts') 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 -- cgit v1.2.3 From 88f6fcac584da7e822d9ac4084553972c521f044 Mon Sep 17 00:00:00 2001 From: Ivo Buff Date: Fri, 12 Jul 2013 11:28:40 +0200 Subject: Cleanup Some cleanup and changed tabs to 4 spaces --- module/plugins/accounts/SimplydebridCOM.py | 56 +++++++++++++----------------- 1 file changed, 25 insertions(+), 31 deletions(-) (limited to 'module/plugins/accounts') 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 -- cgit v1.2.3 From abac8315248b6a72b0b4906548d9372f459cdd2e Mon Sep 17 00:00:00 2001 From: Stefano Date: Sat, 20 Jul 2013 18:14:08 +0200 Subject: Code optimized --- module/plugins/accounts/SimplydebridCOM.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'module/plugins/accounts') diff --git a/module/plugins/accounts/SimplydebridCOM.py b/module/plugins/accounts/SimplydebridCOM.py index 53d707877..faa6091c5 100644 --- a/module/plugins/accounts/SimplydebridCOM.py +++ b/module/plugins/accounts/SimplydebridCOM.py @@ -10,24 +10,24 @@ class SimplydebridCOM(Account): __type__ = "account" __description__ = """Simply-Debrid.com account plugin""" __author_name__ = ("Kagenoshin") - __author_mail__ = ("kagenoshin@gmx.ch") + __author_mail__ = ("kagenoshin@gmx.ch") 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) + get_data = {'login': 2, 'u': self.loginname, 'p': self.password} + response = req.load("http://simply-debrid.com/api.php, get=get_data, decode=True) data = [x.strip() for x in response.split(";")] if str(data[0]) != "1": - account_info = {"trafficleft": 0, "validuntil": 0, "premium": False} + return {"premium": False} else: - account_info = { + return { "trafficleft": -1, - "validuntil": mktime(strptime(str(data[2]),"%d/%m/%Y")), - "premium": True + "validuntil": mktime(strptime(str(data[2]),"%d/%m/%Y")) } - 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) + get_data = {'login': 1, 'u': self.loginname, 'p': self.password} + response = req.load("http://simply-debrid.com/api.php, get=get_data, decode=True) if response != "02: loggin success": - self.wrongPassword() \ No newline at end of file + self.wrongPassword() -- cgit v1.2.3 From 3964f4231fa5ff68b07a50d23d3b233a0735612d Mon Sep 17 00:00:00 2001 From: Stefano Date: Sat, 20 Jul 2013 20:35:18 +0200 Subject: Simplydebrid: fixed syntax error + code reformatted + removed unused imports --- module/plugins/accounts/SimplydebridCOM.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'module/plugins/accounts') diff --git a/module/plugins/accounts/SimplydebridCOM.py b/module/plugins/accounts/SimplydebridCOM.py index faa6091c5..2b14a37c2 100644 --- a/module/plugins/accounts/SimplydebridCOM.py +++ b/module/plugins/accounts/SimplydebridCOM.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- +from time import mktime, strptime + from module.plugins.Account import Account -import re -from time import mktime, strptime class SimplydebridCOM(Account): __name__ = "SimplydebridCOM" @@ -14,20 +14,17 @@ class SimplydebridCOM(Account): def loadAccountInfo(self, user, req): get_data = {'login': 2, 'u': self.loginname, 'p': self.password} - response = req.load("http://simply-debrid.com/api.php, get=get_data, decode=True) + response = req.load("http://simply-debrid.com/api.php", get=get_data, decode=True) data = [x.strip() for x in response.split(";")] if str(data[0]) != "1": return {"premium": False} else: - return { - "trafficleft": -1, - "validuntil": mktime(strptime(str(data[2]),"%d/%m/%Y")) - } + return {"trafficleft": -1, "validuntil": mktime(strptime(str(data[2]), "%d/%m/%Y"))} def login(self, user, data, req): self.loginname = user self.password = data["password"] get_data = {'login': 1, 'u': self.loginname, 'p': self.password} - response = req.load("http://simply-debrid.com/api.php, get=get_data, decode=True) + response = req.load("http://simply-debrid.com/api.php", get=get_data, decode=True) if response != "02: loggin success": self.wrongPassword() -- cgit v1.2.3 From 4d6f805c40f48cda9c57bc2e4a8f09bc37e046ec Mon Sep 17 00:00:00 2001 From: Stefano Date: Sat, 20 Jul 2013 20:43:35 +0200 Subject: Simplydebrid: renamed to standard --- module/plugins/accounts/SimplydebridCOM.py | 30 ------------------------------ module/plugins/accounts/SimplydebridCom.py | 30 ++++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 30 deletions(-) delete mode 100644 module/plugins/accounts/SimplydebridCOM.py create mode 100644 module/plugins/accounts/SimplydebridCom.py (limited to 'module/plugins/accounts') diff --git a/module/plugins/accounts/SimplydebridCOM.py b/module/plugins/accounts/SimplydebridCOM.py deleted file mode 100644 index 2b14a37c2..000000000 --- a/module/plugins/accounts/SimplydebridCOM.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- -from time import mktime, strptime - -from module.plugins.Account import Account - - -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 = {'login': 2, 'u': self.loginname, 'p': self.password} - response = req.load("http://simply-debrid.com/api.php", get=get_data, decode=True) - data = [x.strip() for x in response.split(";")] - if str(data[0]) != "1": - return {"premium": False} - else: - return {"trafficleft": -1, "validuntil": mktime(strptime(str(data[2]), "%d/%m/%Y"))} - - def login(self, user, data, req): - self.loginname = user - self.password = data["password"] - get_data = {'login': 1, 'u': self.loginname, 'p': self.password} - response = req.load("http://simply-debrid.com/api.php", get=get_data, decode=True) - if response != "02: loggin success": - self.wrongPassword() diff --git a/module/plugins/accounts/SimplydebridCom.py b/module/plugins/accounts/SimplydebridCom.py new file mode 100644 index 000000000..82b499bbd --- /dev/null +++ b/module/plugins/accounts/SimplydebridCom.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +from time import mktime, strptime + +from module.plugins.Account import Account + + +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 = {'login': 2, 'u': self.loginname, 'p': self.password} + response = req.load("http://simply-debrid.com/api.php", get=get_data, decode=True) + data = [x.strip() for x in response.split(";")] + if str(data[0]) != "1": + return {"premium": False} + else: + return {"trafficleft": -1, "validuntil": mktime(strptime(str(data[2]), "%d/%m/%Y"))} + + def login(self, user, data, req): + self.loginname = user + self.password = data["password"] + get_data = {'login': 1, 'u': self.loginname, 'p': self.password} + response = req.load("http://simply-debrid.com/api.php", get=get_data, decode=True) + if response != "02: loggin success": + self.wrongPassword() -- cgit v1.2.3