From 5060e4c6374a5116d0d8b02528f910f8c5f8bcf9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 15 Jul 2014 16:25:41 +0200 Subject: Fix code indentation, some bad whitespaces and missing authors + use 'not' instead 'is None' + replace __pattern__'s r" with r' + other minor cosmetics --- module/plugins/accounts/SimplyPremiumCom.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'module/plugins/accounts/SimplyPremiumCom.py') diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py index 1e6d66806..6ae8396db 100644 --- a/module/plugins/accounts/SimplyPremiumCom.py +++ b/module/plugins/accounts/SimplyPremiumCom.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - ############################################################################ # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU Affero General Public License as # @@ -15,17 +14,17 @@ # along with this program. If not, see . # ############################################################################ -from module.plugins.Account import Account from module.common.json_layer import json_loads +from module.plugins.Account import Account class SimplyPremiumCom(Account): __name__ = "SimplyPremiumCom" __version__ = "0.01" __type__ = "account" - __description__ = """Simply-Premium.Com account plugin""" - __author_name__ = ("EvolutionClip") - __author_mail__ = ("evolutionclip@live.de") + __description__ = """Simply-Premium.com account plugin""" + __author_name__ = "EvolutionClip" + __author_mail__ = "evolutionclip@live.de" def loadAccountInfo(self, user, req): json_data = req.load('http://www.simply-premium.com/api/user.php?format=json') -- cgit v1.2.3 From 7b8c458cca7d21a029620f98e453f746fce69cd1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 14 Jul 2014 16:10:01 +0200 Subject: Prefer single quote for dict key name --- module/plugins/accounts/SimplyPremiumCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/accounts/SimplyPremiumCom.py') diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py index 6ae8396db..5706bb5cd 100644 --- a/module/plugins/accounts/SimplyPremiumCom.py +++ b/module/plugins/accounts/SimplyPremiumCom.py @@ -49,7 +49,7 @@ class SimplyPremiumCom(Account): if data['password'] == '' or data['password'] == '0': post_data = {"key": user} else: - post_data = {"login_name": user, "login_pass": data["password"]} + post_data = {"login_name": user, "login_pass": data['password']} self.html = req.load("http://www.simply-premium.com/login.php", post=post_data) -- cgit v1.2.3 From 8e47b0de30a25d0fd5dfb518bfe4e1e7beff93fd Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 15 Jul 2014 16:27:44 +0200 Subject: Key attributes cleanup for account, container and crypter plugins --- module/plugins/accounts/SimplyPremiumCom.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'module/plugins/accounts/SimplyPremiumCom.py') diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py index 5706bb5cd..37aff09b3 100644 --- a/module/plugins/accounts/SimplyPremiumCom.py +++ b/module/plugins/accounts/SimplyPremiumCom.py @@ -22,10 +22,12 @@ class SimplyPremiumCom(Account): __name__ = "SimplyPremiumCom" __version__ = "0.01" __type__ = "account" + __description__ = """Simply-Premium.com account plugin""" __author_name__ = "EvolutionClip" __author_mail__ = "evolutionclip@live.de" + def loadAccountInfo(self, user, req): json_data = req.load('http://www.simply-premium.com/api/user.php?format=json') self.logDebug("JSON data: " + json_data) -- cgit v1.2.3 From 9762ac2fe94e3c6709fc46b6e9bde99e10cb3681 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 20 Jul 2014 02:25:53 +0200 Subject: [account] self.html -> html (where was possible) --- module/plugins/accounts/SimplyPremiumCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/accounts/SimplyPremiumCom.py') diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py index 37aff09b3..6eace8838 100644 --- a/module/plugins/accounts/SimplyPremiumCom.py +++ b/module/plugins/accounts/SimplyPremiumCom.py @@ -53,7 +53,7 @@ class SimplyPremiumCom(Account): else: post_data = {"login_name": user, "login_pass": data['password']} - self.html = req.load("http://www.simply-premium.com/login.php", post=post_data) + html = req.load("http://www.simply-premium.com/login.php", post=post_data) - if 'logout' not in self.html: + if 'logout' not in html: self.wrongPassword() -- cgit v1.2.3 From ba916633f2bedb04c7358000b91aed69f52e8e43 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 1 Aug 2014 19:35:59 +0200 Subject: Remove trailing whitespaces + remove license headers + import urllib methods directly + sort and fix key attributes + use save_join instead join + sort some import declarations + other minor code cosmetics --- module/plugins/accounts/SimplyPremiumCom.py | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'module/plugins/accounts/SimplyPremiumCom.py') diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py index 6eace8838..b0a62f83b 100644 --- a/module/plugins/accounts/SimplyPremiumCom.py +++ b/module/plugins/accounts/SimplyPremiumCom.py @@ -1,18 +1,4 @@ # -*- coding: utf-8 -*- -############################################################################ -# This program is free software: you can redistribute it and/or modify # -# it under the terms of the GNU Affero General Public License as # -# published by the Free Software Foundation, either version 3 of the # -# License, or (at your option) any later version. # -# # -# This program is distributed in the hope that it will be useful, # -# but WITHOUT ANY WARRANTY; without even the implied warranty of # -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # -# GNU Affero General Public License for more details. # -# # -# You should have received a copy of the GNU Affero General Public License # -# along with this program. If not, see . # -############################################################################ from module.common.json_layer import json_loads from module.plugins.Account import Account @@ -20,8 +6,8 @@ from module.plugins.Account import Account class SimplyPremiumCom(Account): __name__ = "SimplyPremiumCom" - __version__ = "0.01" __type__ = "account" + __version__ = "0.01" __description__ = """Simply-Premium.com account plugin""" __author_name__ = "EvolutionClip" -- cgit v1.2.3 From b0868ae6446078bacf1635dde5e4ab316b4a94cb Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Oct 2014 18:57:59 +0200 Subject: New __authors__ key replaces __author_name__ and __author_mail__ + Whitespaces and EOF fixup --- module/plugins/accounts/SimplyPremiumCom.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'module/plugins/accounts/SimplyPremiumCom.py') diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py index b0a62f83b..fd825a616 100644 --- a/module/plugins/accounts/SimplyPremiumCom.py +++ b/module/plugins/accounts/SimplyPremiumCom.py @@ -10,8 +10,7 @@ class SimplyPremiumCom(Account): __version__ = "0.01" __description__ = """Simply-Premium.com account plugin""" - __author_name__ = "EvolutionClip" - __author_mail__ = "evolutionclip@live.de" + __authors__ = [("EvolutionClip", "evolutionclip@live.de")] def loadAccountInfo(self, user, req): -- cgit v1.2.3 From ae7a7e66981456e5bbe2b54006d79b6f907be7a4 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 8 Oct 2014 20:18:13 +0200 Subject: Add __license__ key attribute to plugins --- module/plugins/accounts/SimplyPremiumCom.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/accounts/SimplyPremiumCom.py') diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py index fd825a616..8f65fa677 100644 --- a/module/plugins/accounts/SimplyPremiumCom.py +++ b/module/plugins/accounts/SimplyPremiumCom.py @@ -10,6 +10,7 @@ class SimplyPremiumCom(Account): __version__ = "0.01" __description__ = """Simply-Premium.com account plugin""" + __license__ = "GPLv3" __authors__ = [("EvolutionClip", "evolutionclip@live.de")] -- cgit v1.2.3 From 6a0fb7fdd4ea2749be44625225d8a235a78f032f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 11 Oct 2014 15:42:39 +0200 Subject: [accounts] Code cosmetics --- module/plugins/accounts/SimplyPremiumCom.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/accounts/SimplyPremiumCom.py') diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py index 8f65fa677..442aaa9f3 100644 --- a/module/plugins/accounts/SimplyPremiumCom.py +++ b/module/plugins/accounts/SimplyPremiumCom.py @@ -31,6 +31,7 @@ class SimplyPremiumCom(Account): #return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} return {"premium": True, "validuntil": validuntil} + def login(self, user, data, req): req.cj.setCookie("simply-premium.com", "lang", "EN") -- cgit v1.2.3 From 5d26b3f5c3b18d916b2ea24a22770cf62e207a50 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 16 Oct 2014 12:12:14 +0200 Subject: Fix trafficleft size in some account plugins --- module/plugins/accounts/SimplyPremiumCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/accounts/SimplyPremiumCom.py') diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py index 442aaa9f3..2fe41abef 100644 --- a/module/plugins/accounts/SimplyPremiumCom.py +++ b/module/plugins/accounts/SimplyPremiumCom.py @@ -25,8 +25,8 @@ class SimplyPremiumCom(Account): #Time package validuntil = float(json_data['result']['timeend']) #Traffic package - # {"trafficleft": int(traffic) / 1024, "validuntil": -1} - #trafficleft = int(json_data['result']['traffic'] / 1024) + # {"trafficleft": int(traffic), "validuntil": -1} + #trafficleft = int(json_data['result']['traffic']) #return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} return {"premium": True, "validuntil": validuntil} -- cgit v1.2.3 From 34984dae733c3f3d47b41a0acfba3724d53c65a1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 28 Oct 2014 16:52:10 +0100 Subject: Code cosmetics: plugin class attributes --- module/plugins/accounts/SimplyPremiumCom.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/accounts/SimplyPremiumCom.py') diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py index 2fe41abef..979ce73aa 100644 --- a/module/plugins/accounts/SimplyPremiumCom.py +++ b/module/plugins/accounts/SimplyPremiumCom.py @@ -5,13 +5,13 @@ from module.plugins.Account import Account class SimplyPremiumCom(Account): - __name__ = "SimplyPremiumCom" - __type__ = "account" + __name__ = "SimplyPremiumCom" + __type__ = "account" __version__ = "0.01" __description__ = """Simply-Premium.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("EvolutionClip", "evolutionclip@live.de")] + __license__ = "GPLv3" + __authors__ = [("EvolutionClip", "evolutionclip@live.de")] def loadAccountInfo(self, user, req): -- cgit v1.2.3 From c9e31d875d32de31e54959b82bc35eff2b3e0f3f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 10 Nov 2014 00:19:51 +0100 Subject: Code cosmetics --- module/plugins/accounts/SimplyPremiumCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/accounts/SimplyPremiumCom.py') diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py index 979ce73aa..ab9474955 100644 --- a/module/plugins/accounts/SimplyPremiumCom.py +++ b/module/plugins/accounts/SimplyPremiumCom.py @@ -33,7 +33,7 @@ class SimplyPremiumCom(Account): def login(self, user, data, req): - req.cj.setCookie("simply-premium.com", "lang", "EN") + req.cj.setCookie(".simply-premium.com", "lang", "EN") if data['password'] == '' or data['password'] == '0': post_data = {"key": user} -- cgit v1.2.3 From e8246525f3106c152d6d1436c6a3111e0334520f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 15 Nov 2014 18:04:47 +0100 Subject: Fix cookie domain --- module/plugins/accounts/SimplyPremiumCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/accounts/SimplyPremiumCom.py') diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py index ab9474955..979ce73aa 100644 --- a/module/plugins/accounts/SimplyPremiumCom.py +++ b/module/plugins/accounts/SimplyPremiumCom.py @@ -33,7 +33,7 @@ class SimplyPremiumCom(Account): def login(self, user, data, req): - req.cj.setCookie(".simply-premium.com", "lang", "EN") + req.cj.setCookie("simply-premium.com", "lang", "EN") if data['password'] == '' or data['password'] == '0': post_data = {"key": user} -- cgit v1.2.3 From fb65d5354c3cc80c3f48c3a2745b8dc01105edfd Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 18 Dec 2014 16:02:29 +0100 Subject: Update account plugins --- module/plugins/accounts/SimplyPremiumCom.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'module/plugins/accounts/SimplyPremiumCom.py') diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py index 979ce73aa..465757457 100644 --- a/module/plugins/accounts/SimplyPremiumCom.py +++ b/module/plugins/accounts/SimplyPremiumCom.py @@ -7,7 +7,7 @@ from module.plugins.Account import Account class SimplyPremiumCom(Account): __name__ = "SimplyPremiumCom" __type__ = "account" - __version__ = "0.01" + __version__ = "0.02" __description__ = """Simply-Premium.com account plugin""" __license__ = "GPLv3" @@ -15,6 +15,9 @@ class SimplyPremiumCom(Account): def loadAccountInfo(self, user, req): + validuntil = -1 + trafficleft = None + json_data = req.load('http://www.simply-premium.com/api/user.php?format=json') self.logDebug("JSON data: " + json_data) json_data = json_loads(json_data) @@ -22,14 +25,13 @@ class SimplyPremiumCom(Account): if 'vip' in json_data['result'] and json_data['result']['vip'] == 0: return {"premium": False} - #Time package - validuntil = float(json_data['result']['timeend']) - #Traffic package - # {"trafficleft": int(traffic), "validuntil": -1} - #trafficleft = int(json_data['result']['traffic']) + if 'timeend' in json_data['result'] and json_data['result']['timeend']: + validuntil = float(json_data['result']['timeend']) + + if 'traffic' in json_data['result'] and json_data['result']['traffic']: + trafficleft = float(json_data['result']['traffic']) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 - #return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} - return {"premium": True, "validuntil": validuntil} + return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} def login(self, user, data, req): -- cgit v1.2.3