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/FilerNet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/accounts/FilerNet.py') diff --git a/module/plugins/accounts/FilerNet.py b/module/plugins/accounts/FilerNet.py index 28ddf2e3f..747051e94 100644 --- a/module/plugins/accounts/FilerNet.py +++ b/module/plugins/accounts/FilerNet.py @@ -55,7 +55,7 @@ class FilerNet(Account): self.html = req.load("https://filer.net/login") token = re.search(self.TOKEN_PATTERN, self.html).group(1) self.html = req.load("https://filer.net/login_check", - post={"_username": user, "_password": data["password"], + post={"_username": user, "_password": data['password'], "_remember_me": "on", "_csrf_token": token, "_target_path": "https://filer.net/"}) if 'Logout' not in self.html: self.wrongPassword() -- 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/FilerNet.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'module/plugins/accounts/FilerNet.py') diff --git a/module/plugins/accounts/FilerNet.py b/module/plugins/accounts/FilerNet.py index 747051e94..475f01301 100644 --- a/module/plugins/accounts/FilerNet.py +++ b/module/plugins/accounts/FilerNet.py @@ -25,6 +25,7 @@ class FilerNet(Account): __name__ = "FilerNet" __version__ = "0.01" __type__ = "account" + __description__ = """Filer.net account plugin""" __author_name__ = "stickell" __author_mail__ = "l.stickell@yahoo.it" @@ -34,6 +35,7 @@ class FilerNet(Account): TRAFFIC_PATTERN = r'Traffic\s*([^<]+)' FREE_PATTERN = r'Account Status\s*\s*Free' + def loadAccountInfo(self, user, req): self.html = req.load("https://filer.net/profile") -- 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/FilerNet.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'module/plugins/accounts/FilerNet.py') diff --git a/module/plugins/accounts/FilerNet.py b/module/plugins/accounts/FilerNet.py index 475f01301..0eaa8f452 100644 --- a/module/plugins/accounts/FilerNet.py +++ b/module/plugins/accounts/FilerNet.py @@ -37,14 +37,14 @@ class FilerNet(Account): def loadAccountInfo(self, user, req): - self.html = req.load("https://filer.net/profile") + html = req.load("https://filer.net/profile") # Free user - if re.search(self.FREE_PATTERN, self.html): + if re.search(self.FREE_PATTERN, html): return {"premium": False, "validuntil": None, "trafficleft": None} - until = re.search(self.WALID_UNTIL_PATTERN, self.html) - traffic = re.search(self.TRAFFIC_PATTERN, self.html) + until = re.search(self.WALID_UNTIL_PATTERN, html) + traffic = re.search(self.TRAFFIC_PATTERN, html) if until and traffic: validuntil = int(time.mktime(time.strptime(until.group(1), "%d.%m.%Y %H:%M:%S"))) trafficleft = parseFileSize(traffic.group(1)) / 1024 @@ -54,10 +54,10 @@ class FilerNet(Account): return {"premium": False, "validuntil": None, "trafficleft": None} def login(self, user, data, req): - self.html = req.load("https://filer.net/login") - token = re.search(self.TOKEN_PATTERN, self.html).group(1) - self.html = req.load("https://filer.net/login_check", + html = req.load("https://filer.net/login") + token = re.search(self.TOKEN_PATTERN, html).group(1) + html = req.load("https://filer.net/login_check", post={"_username": user, "_password": data['password'], "_remember_me": "on", "_csrf_token": token, "_target_path": "https://filer.net/"}) - 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/FilerNet.py | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'module/plugins/accounts/FilerNet.py') diff --git a/module/plugins/accounts/FilerNet.py b/module/plugins/accounts/FilerNet.py index 0eaa8f452..2e50298d7 100644 --- a/module/plugins/accounts/FilerNet.py +++ b/module/plugins/accounts/FilerNet.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 . # -############################################################################ import re import time @@ -23,8 +9,8 @@ from module.utils import parseFileSize class FilerNet(Account): __name__ = "FilerNet" - __version__ = "0.01" __type__ = "account" + __version__ = "0.01" __description__ = """Filer.net account plugin""" __author_name__ = "stickell" -- cgit v1.2.3 From 0d220d634e512d89bda540f91c643b361c82ea8a Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 27 Sep 2014 01:38:32 +0200 Subject: Logging string cosmetics --- module/plugins/accounts/FilerNet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/accounts/FilerNet.py') diff --git a/module/plugins/accounts/FilerNet.py b/module/plugins/accounts/FilerNet.py index 2e50298d7..cc00411d6 100644 --- a/module/plugins/accounts/FilerNet.py +++ b/module/plugins/accounts/FilerNet.py @@ -36,7 +36,7 @@ class FilerNet(Account): trafficleft = parseFileSize(traffic.group(1)) / 1024 return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} else: - self.logError('Unable to retrieve account information - Plugin may be out of date') + self.logError("Unable to retrieve account information - Plugin may be out of date") return {"premium": False, "validuntil": None, "trafficleft": None} def login(self, user, data, req): -- 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/FilerNet.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/accounts/FilerNet.py') diff --git a/module/plugins/accounts/FilerNet.py b/module/plugins/accounts/FilerNet.py index cc00411d6..a26a45690 100644 --- a/module/plugins/accounts/FilerNet.py +++ b/module/plugins/accounts/FilerNet.py @@ -13,8 +13,8 @@ class FilerNet(Account): __version__ = "0.01" __description__ = """Filer.net account plugin""" - __author_name__ = "stickell" - __author_mail__ = "l.stickell@yahoo.it" + __authors__ = [("stickell", "l.stickell@yahoo.it")] + TOKEN_PATTERN = r'_csrf_token" value="([^"]+)" />' WALID_UNTIL_PATTERN = r"Der Premium-Zugang ist gültig bis (.+)\.\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/FilerNet.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/accounts/FilerNet.py') diff --git a/module/plugins/accounts/FilerNet.py b/module/plugins/accounts/FilerNet.py index a26a45690..811d7c8a1 100644 --- a/module/plugins/accounts/FilerNet.py +++ b/module/plugins/accounts/FilerNet.py @@ -13,6 +13,7 @@ class FilerNet(Account): __version__ = "0.01" __description__ = """Filer.net account plugin""" + __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] -- cgit v1.2.3 From 8939f015a688a07ec7d0bd14b6a3704f6a2cb4a0 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 11 Oct 2014 15:12:40 +0200 Subject: Pattern update 3 --- module/plugins/accounts/FilerNet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/accounts/FilerNet.py') diff --git a/module/plugins/accounts/FilerNet.py b/module/plugins/accounts/FilerNet.py index 811d7c8a1..a459f88f0 100644 --- a/module/plugins/accounts/FilerNet.py +++ b/module/plugins/accounts/FilerNet.py @@ -18,7 +18,7 @@ class FilerNet(Account): TOKEN_PATTERN = r'_csrf_token" value="([^"]+)" />' - WALID_UNTIL_PATTERN = r"Der Premium-Zugang ist gültig bis (.+)\.\s*" + WALID_UNTIL_PATTERN = r'Der Premium-Zugang ist gültig bis (.+)\.\s*' TRAFFIC_PATTERN = r'Traffic\s*([^<]+)' FREE_PATTERN = r'Account Status\s*\s*Free' -- 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/FilerNet.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/accounts/FilerNet.py') diff --git a/module/plugins/accounts/FilerNet.py b/module/plugins/accounts/FilerNet.py index a459f88f0..8bd66221f 100644 --- a/module/plugins/accounts/FilerNet.py +++ b/module/plugins/accounts/FilerNet.py @@ -40,6 +40,7 @@ class FilerNet(Account): self.logError("Unable to retrieve account information - Plugin may be out of date") return {"premium": False, "validuntil": None, "trafficleft": None} + def login(self, user, data, req): html = req.load("https://filer.net/login") token = re.search(self.TOKEN_PATTERN, html).group(1) -- 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/FilerNet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/accounts/FilerNet.py') diff --git a/module/plugins/accounts/FilerNet.py b/module/plugins/accounts/FilerNet.py index 8bd66221f..82f78ed0c 100644 --- a/module/plugins/accounts/FilerNet.py +++ b/module/plugins/accounts/FilerNet.py @@ -34,7 +34,7 @@ class FilerNet(Account): traffic = re.search(self.TRAFFIC_PATTERN, html) if until and traffic: validuntil = int(time.mktime(time.strptime(until.group(1), "%d.%m.%Y %H:%M:%S"))) - trafficleft = parseFileSize(traffic.group(1)) / 1024 + trafficleft = parseFileSize(traffic.group(1)) return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} else: self.logError("Unable to retrieve account information - Plugin may be out of date") -- cgit v1.2.3 From 1f48f481740863c7697064bde286a78e977e4a1b Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Oct 2014 15:12:06 +0200 Subject: Update other plugins to support self.error --- module/plugins/accounts/FilerNet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/accounts/FilerNet.py') diff --git a/module/plugins/accounts/FilerNet.py b/module/plugins/accounts/FilerNet.py index 82f78ed0c..f89d7be2f 100644 --- a/module/plugins/accounts/FilerNet.py +++ b/module/plugins/accounts/FilerNet.py @@ -37,7 +37,7 @@ class FilerNet(Account): trafficleft = parseFileSize(traffic.group(1)) return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} else: - self.logError("Unable to retrieve account information - Plugin may be out of date") + self.logError("Unable to retrieve account information") return {"premium": False, "validuntil": None, "trafficleft": None} -- cgit v1.2.3 From 29de13dc5098cc9214f3f8f111da140a22e3e2ff Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 25 Oct 2014 01:15:58 +0200 Subject: Use parseTraffic instead parseFileSize in accounts --- module/plugins/accounts/FilerNet.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'module/plugins/accounts/FilerNet.py') diff --git a/module/plugins/accounts/FilerNet.py b/module/plugins/accounts/FilerNet.py index f89d7be2f..8dcb20295 100644 --- a/module/plugins/accounts/FilerNet.py +++ b/module/plugins/accounts/FilerNet.py @@ -4,13 +4,12 @@ import re import time from module.plugins.Account import Account -from module.utils import parseFileSize class FilerNet(Account): __name__ = "FilerNet" __type__ = "account" - __version__ = "0.01" + __version__ = "0.02" __description__ = """Filer.net account plugin""" __license__ = "GPLv3" @@ -34,7 +33,7 @@ class FilerNet(Account): traffic = re.search(self.TRAFFIC_PATTERN, html) if until and traffic: validuntil = int(time.mktime(time.strptime(until.group(1), "%d.%m.%Y %H:%M:%S"))) - trafficleft = parseFileSize(traffic.group(1)) + trafficleft = self.parseTraffic(traffic.group(1)) return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} else: self.logError("Unable to retrieve account information") -- cgit v1.2.3 From 9f2ebe486a3e155fb6a60e07cccb77ab6a772eb2 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 26 Oct 2014 02:31:54 +0200 Subject: Extend translation support in plugins + a lot of code cosmetics and typo fixes --- module/plugins/accounts/FilerNet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/accounts/FilerNet.py') diff --git a/module/plugins/accounts/FilerNet.py b/module/plugins/accounts/FilerNet.py index 8dcb20295..f7720adcc 100644 --- a/module/plugins/accounts/FilerNet.py +++ b/module/plugins/accounts/FilerNet.py @@ -36,7 +36,7 @@ class FilerNet(Account): trafficleft = self.parseTraffic(traffic.group(1)) return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} else: - self.logError("Unable to retrieve account information") + self.logError(_("Unable to retrieve account information")) return {"premium": False, "validuntil": None, "trafficleft": None} -- 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/FilerNet.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/accounts/FilerNet.py') diff --git a/module/plugins/accounts/FilerNet.py b/module/plugins/accounts/FilerNet.py index f7720adcc..cb913a27e 100644 --- a/module/plugins/accounts/FilerNet.py +++ b/module/plugins/accounts/FilerNet.py @@ -7,13 +7,13 @@ from module.plugins.Account import Account class FilerNet(Account): - __name__ = "FilerNet" - __type__ = "account" + __name__ = "FilerNet" + __type__ = "account" __version__ = "0.02" __description__ = """Filer.net account plugin""" - __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __license__ = "GPLv3" + __authors__ = [("stickell", "l.stickell@yahoo.it")] TOKEN_PATTERN = r'_csrf_token" value="([^"]+)" />' -- 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/FilerNet.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'module/plugins/accounts/FilerNet.py') diff --git a/module/plugins/accounts/FilerNet.py b/module/plugins/accounts/FilerNet.py index cb913a27e..a845e7ba4 100644 --- a/module/plugins/accounts/FilerNet.py +++ b/module/plugins/accounts/FilerNet.py @@ -9,7 +9,7 @@ from module.plugins.Account import Account class FilerNet(Account): __name__ = "FilerNet" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" __description__ = """Filer.net account plugin""" __license__ = "GPLv3" @@ -29,12 +29,14 @@ class FilerNet(Account): if re.search(self.FREE_PATTERN, html): return {"premium": False, "validuntil": None, "trafficleft": None} - until = re.search(self.WALID_UNTIL_PATTERN, html) + until = re.search(self.WALID_UNTIL_PATTERN, html) traffic = re.search(self.TRAFFIC_PATTERN, html) + if until and traffic: - validuntil = int(time.mktime(time.strptime(until.group(1), "%d.%m.%Y %H:%M:%S"))) + validuntil = time.mktime(time.strptime(until.group(1), "%d.%m.%Y %H:%M:%S")) trafficleft = self.parseTraffic(traffic.group(1)) return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} + else: self.logError(_("Unable to retrieve account information")) return {"premium": False, "validuntil": None, "trafficleft": None} -- cgit v1.2.3