From 48c0c42fd6faffc56432d5f037cd575979f180cc Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 14 Jul 2014 02:23:37 +0200 Subject: Removed all @author flags + key attributes cleanup for internal & hooks plugins --- module/plugins/accounts/CzshareCom.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'module/plugins/accounts/CzshareCom.py') diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py index bdd2000c9..4a664b29e 100644 --- a/module/plugins/accounts/CzshareCom.py +++ b/module/plugins/accounts/CzshareCom.py @@ -13,8 +13,6 @@ You should have received a copy of the GNU General Public License along with this program; if not, see . - - @author: zoidberg """ from time import mktime, strptime -- 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/CzshareCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/accounts/CzshareCom.py') diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py index 4a664b29e..3545baa7e 100644 --- a/module/plugins/accounts/CzshareCom.py +++ b/module/plugins/accounts/CzshareCom.py @@ -46,7 +46,7 @@ class CzshareCom(Account): def login(self, user, data, req): html = req.load('https://sdilej.cz/index.php', post={ "Prihlasit": "Prihlasit", - "login-password": data["password"], + "login-password": data['password'], "login-name": user }) -- 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/CzshareCom.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'module/plugins/accounts/CzshareCom.py') diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py index 3545baa7e..92d0e61e8 100644 --- a/module/plugins/accounts/CzshareCom.py +++ b/module/plugins/accounts/CzshareCom.py @@ -25,12 +25,14 @@ class CzshareCom(Account): __name__ = "CzshareCom" __version__ = "0.14" __type__ = "account" + __description__ = """Czshare.com account plugin, now Sdilej.cz""" __author_name__ = ("zoidberg", "stickell") __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it") CREDIT_LEFT_PATTERN = r'\s*([0-9 ,]+) (KiB|MiB|GiB)\s*([^<]*)\s*' + def loadAccountInfo(self, user, req): html = req.load("http://sdilej.cz/prehled_kreditu/") -- cgit v1.2.3 From 05d258d98dd8c2faf0b769840fa1e3c4acccdce8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 20 Jul 2014 03:25:14 +0200 Subject: Fix and improve 5060e4c6374a5116d0d8b02528f910f8c5f8bcf9 --- module/plugins/accounts/CzshareCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/accounts/CzshareCom.py') diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py index 92d0e61e8..3b1989591 100644 --- a/module/plugins/accounts/CzshareCom.py +++ b/module/plugins/accounts/CzshareCom.py @@ -37,7 +37,7 @@ class CzshareCom(Account): html = req.load("http://sdilej.cz/prehled_kreditu/") found = re.search(self.CREDIT_LEFT_PATTERN, html) - if not found: + if found is None: return {"validuntil": 0, "trafficleft": 0} else: credits = float(found.group(1).replace(' ', '').replace(',', '.')) -- cgit v1.2.3 From 9395182da7afed55a29bde1c7cbefe4204e783f0 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 20 Jul 2014 03:02:09 +0200 Subject: Store all re.search/match object as "m" instead "found" --- module/plugins/accounts/CzshareCom.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'module/plugins/accounts/CzshareCom.py') diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py index 3b1989591..912b9328b 100644 --- a/module/plugins/accounts/CzshareCom.py +++ b/module/plugins/accounts/CzshareCom.py @@ -36,13 +36,13 @@ class CzshareCom(Account): def loadAccountInfo(self, user, req): html = req.load("http://sdilej.cz/prehled_kreditu/") - found = re.search(self.CREDIT_LEFT_PATTERN, html) - if found is None: + m = re.search(self.CREDIT_LEFT_PATTERN, html) + if m is None: return {"validuntil": 0, "trafficleft": 0} else: - credits = float(found.group(1).replace(' ', '').replace(',', '.')) - credits = credits * 1024 ** {'KiB': 0, 'MiB': 1, 'GiB': 2}[found.group(2)] - validuntil = mktime(strptime(found.group(3), '%d.%m.%y %H:%M')) + credits = float(m.group(1).replace(' ', '').replace(',', '.')) + credits = credits * 1024 ** {'KiB': 0, 'MiB': 1, 'GiB': 2}[m.group(2)] + validuntil = mktime(strptime(m.group(3), '%d.%m.%y %H:%M')) return {"validuntil": validuntil, "trafficleft": credits} def login(self, user, data, req): -- 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/CzshareCom.py | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'module/plugins/accounts/CzshareCom.py') diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py index 912b9328b..6f2ee641e 100644 --- a/module/plugins/accounts/CzshareCom.py +++ b/module/plugins/accounts/CzshareCom.py @@ -1,20 +1,5 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see . -""" - from time import mktime, strptime import re @@ -23,8 +8,8 @@ from module.plugins.Account import Account class CzshareCom(Account): __name__ = "CzshareCom" - __version__ = "0.14" __type__ = "account" + __version__ = "0.14" __description__ = """Czshare.com account plugin, now Sdilej.cz""" __author_name__ = ("zoidberg", "stickell") -- 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/CzshareCom.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'module/plugins/accounts/CzshareCom.py') diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py index 6f2ee641e..ffe1c8285 100644 --- a/module/plugins/accounts/CzshareCom.py +++ b/module/plugins/accounts/CzshareCom.py @@ -12,8 +12,9 @@ class CzshareCom(Account): __version__ = "0.14" __description__ = """Czshare.com account plugin, now Sdilej.cz""" - __author_name__ = ("zoidberg", "stickell") - __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it") + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] + CREDIT_LEFT_PATTERN = r'\s*([0-9 ,]+) (KiB|MiB|GiB)\s*([^<]*)\s*' -- 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/CzshareCom.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/accounts/CzshareCom.py') diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py index ffe1c8285..c3c1bbcc8 100644 --- a/module/plugins/accounts/CzshareCom.py +++ b/module/plugins/accounts/CzshareCom.py @@ -12,6 +12,7 @@ class CzshareCom(Account): __version__ = "0.14" __description__ = """Czshare.com account plugin, now Sdilej.cz""" + __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), ("stickell", "l.stickell@yahoo.it")] -- cgit v1.2.3 From f76e5c2336718dca9da8033ba22cd83c72c7b3b3 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 11 Oct 2014 15:14:28 +0200 Subject: Pattern update 1 --- module/plugins/accounts/CzshareCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/accounts/CzshareCom.py') diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py index c3c1bbcc8..ea24a4e71 100644 --- a/module/plugins/accounts/CzshareCom.py +++ b/module/plugins/accounts/CzshareCom.py @@ -17,7 +17,7 @@ class CzshareCom(Account): ("stickell", "l.stickell@yahoo.it")] - CREDIT_LEFT_PATTERN = r'\s*([0-9 ,]+) (KiB|MiB|GiB)\s*([^<]*)\s*' + CREDIT_LEFT_PATTERN = r'\s*([\d ,]+) (KiB|MiB|GiB)\s*([^<]*)\s*' def loadAccountInfo(self, user, req): -- 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/CzshareCom.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/accounts/CzshareCom.py') diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py index ea24a4e71..153b47073 100644 --- a/module/plugins/accounts/CzshareCom.py +++ b/module/plugins/accounts/CzshareCom.py @@ -32,6 +32,7 @@ class CzshareCom(Account): validuntil = mktime(strptime(m.group(3), '%d.%m.%y %H:%M')) return {"validuntil": validuntil, "trafficleft": credits} + def login(self, user, data, req): html = req.load('https://sdilej.cz/index.php', post={ "Prihlasit": "Prihlasit", -- 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/CzshareCom.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'module/plugins/accounts/CzshareCom.py') diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py index 153b47073..844ec9999 100644 --- a/module/plugins/accounts/CzshareCom.py +++ b/module/plugins/accounts/CzshareCom.py @@ -7,14 +7,14 @@ from module.plugins.Account import Account class CzshareCom(Account): - __name__ = "CzshareCom" - __type__ = "account" + __name__ = "CzshareCom" + __type__ = "account" __version__ = "0.14" __description__ = """Czshare.com account plugin, now Sdilej.cz""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] CREDIT_LEFT_PATTERN = r'\s*([\d ,]+) (KiB|MiB|GiB)\s*([^<]*)\s*' -- 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/CzshareCom.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'module/plugins/accounts/CzshareCom.py') diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py index 844ec9999..414883228 100644 --- a/module/plugins/accounts/CzshareCom.py +++ b/module/plugins/accounts/CzshareCom.py @@ -9,7 +9,7 @@ from module.plugins.Account import Account class CzshareCom(Account): __name__ = "CzshareCom" __type__ = "account" - __version__ = "0.14" + __version__ = "0.15" __description__ = """Czshare.com account plugin, now Sdilej.cz""" __license__ = "GPLv3" @@ -27,10 +27,9 @@ class CzshareCom(Account): if m is None: return {"validuntil": 0, "trafficleft": 0} else: - credits = float(m.group(1).replace(' ', '').replace(',', '.')) - credits = credits * 1024 ** {'KiB': 0, 'MiB': 1, 'GiB': 2}[m.group(2)] - validuntil = mktime(strptime(m.group(3), '%d.%m.%y %H:%M')) - return {"validuntil": validuntil, "trafficleft": credits} + trafficleft = self.parseTraffic(m.group(1).replace(' ', '').replace(',', '.')) + m.group(2)] + validuntil = mktime(strptime(m.group(3), '%d.%m.%y %H:%M')) + return {"validuntil": validuntil, "trafficleft": trafficleft} def login(self, user, data, req): -- cgit v1.2.3