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/UploadingCom.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'module/plugins/accounts/UploadingCom.py') diff --git a/module/plugins/accounts/UploadingCom.py b/module/plugins/accounts/UploadingCom.py index f0395c13a..98a5fcbc5 100644 --- a/module/plugins/accounts/UploadingCom.py +++ b/module/plugins/accounts/UploadingCom.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: mkaay """ from time import time, strptime, mktime -- 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/UploadingCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/accounts/UploadingCom.py') diff --git a/module/plugins/accounts/UploadingCom.py b/module/plugins/accounts/UploadingCom.py index 98a5fcbc5..c9f5a9ede 100644 --- a/module/plugins/accounts/UploadingCom.py +++ b/module/plugins/accounts/UploadingCom.py @@ -50,4 +50,4 @@ class UploadingCom(Account): req.cj.setCookie("uploading.com", "_lang", "en") req.load("http://uploading.com/") req.load("http://uploading.com/general/login_form/?JsHttpRequest=%s-xml" % long(time() * 1000), - post={"email": user, "password": data["password"], "remember": "on"}) + post={"email": user, "password": data['password'], "remember": "on"}) -- 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/UploadingCom.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'module/plugins/accounts/UploadingCom.py') diff --git a/module/plugins/accounts/UploadingCom.py b/module/plugins/accounts/UploadingCom.py index c9f5a9ede..f07c2941a 100644 --- a/module/plugins/accounts/UploadingCom.py +++ b/module/plugins/accounts/UploadingCom.py @@ -25,10 +25,12 @@ class UploadingCom(Account): __name__ = "UploadingCom" __version__ = "0.1" __type__ = "account" + __description__ = """Uploading.com account plugin""" __author_name__ = "mkaay" __author_mail__ = "mkaay@mkaay.de" + def loadAccountInfo(self, user, req): src = req.load("http://uploading.com/") premium = True -- 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/UploadingCom.py | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'module/plugins/accounts/UploadingCom.py') diff --git a/module/plugins/accounts/UploadingCom.py b/module/plugins/accounts/UploadingCom.py index f07c2941a..416a29b1e 100644 --- a/module/plugins/accounts/UploadingCom.py +++ b/module/plugins/accounts/UploadingCom.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 time, strptime, mktime import re @@ -23,8 +8,8 @@ from module.plugins.Account import Account class UploadingCom(Account): __name__ = "UploadingCom" - __version__ = "0.1" __type__ = "account" + __version__ = "0.1" __description__ = """Uploading.com account plugin""" __author_name__ = "mkaay" -- 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/UploadingCom.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'module/plugins/accounts/UploadingCom.py') diff --git a/module/plugins/accounts/UploadingCom.py b/module/plugins/accounts/UploadingCom.py index 416a29b1e..04f0a58fb 100644 --- a/module/plugins/accounts/UploadingCom.py +++ b/module/plugins/accounts/UploadingCom.py @@ -12,8 +12,7 @@ class UploadingCom(Account): __version__ = "0.1" __description__ = """Uploading.com account plugin""" - __author_name__ = "mkaay" - __author_mail__ = "mkaay@mkaay.de" + __authors__ = [("mkaay", "mkaay@mkaay.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/UploadingCom.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/accounts/UploadingCom.py') diff --git a/module/plugins/accounts/UploadingCom.py b/module/plugins/accounts/UploadingCom.py index 04f0a58fb..544391ea3 100644 --- a/module/plugins/accounts/UploadingCom.py +++ b/module/plugins/accounts/UploadingCom.py @@ -12,6 +12,7 @@ class UploadingCom(Account): __version__ = "0.1" __description__ = """Uploading.com account plugin""" + __license__ = "GPLv3" __authors__ = [("mkaay", "mkaay@mkaay.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/UploadingCom.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/accounts/UploadingCom.py') diff --git a/module/plugins/accounts/UploadingCom.py b/module/plugins/accounts/UploadingCom.py index 544391ea3..5ade435d4 100644 --- a/module/plugins/accounts/UploadingCom.py +++ b/module/plugins/accounts/UploadingCom.py @@ -30,6 +30,7 @@ class UploadingCom(Account): return {"validuntil": validuntil, "trafficleft": -1, "premium": True} + def login(self, user, data, req): req.cj.setCookie("uploading.com", "lang", "1") req.cj.setCookie("uploading.com", "language", "1") -- 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/UploadingCom.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/accounts/UploadingCom.py') diff --git a/module/plugins/accounts/UploadingCom.py b/module/plugins/accounts/UploadingCom.py index 5ade435d4..77229ef8d 100644 --- a/module/plugins/accounts/UploadingCom.py +++ b/module/plugins/accounts/UploadingCom.py @@ -7,13 +7,13 @@ from module.plugins.Account import Account class UploadingCom(Account): - __name__ = "UploadingCom" - __type__ = "account" + __name__ = "UploadingCom" + __type__ = "account" __version__ = "0.1" __description__ = """Uploading.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("mkaay", "mkaay@mkaay.de")] + __license__ = "GPLv3" + __authors__ = [("mkaay", "mkaay@mkaay.de")] def loadAccountInfo(self, user, req): -- cgit v1.2.3 From 2680006e2819803031405fc1a7b41fe50be2bd55 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 9 Nov 2014 03:29:41 +0100 Subject: [UploadingCom] Update account --- module/plugins/accounts/UploadingCom.py | 54 +++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 16 deletions(-) (limited to 'module/plugins/accounts/UploadingCom.py') diff --git a/module/plugins/accounts/UploadingCom.py b/module/plugins/accounts/UploadingCom.py index 77229ef8d..e9e233a95 100644 --- a/module/plugins/accounts/UploadingCom.py +++ b/module/plugins/accounts/UploadingCom.py @@ -1,41 +1,63 @@ # -*- coding: utf-8 -*- -from time import time, strptime, mktime import re +from time import time, strptime, mktime + from module.plugins.Account import Account +from module.plugins.internal.SimpleHoster import set_cookies class UploadingCom(Account): __name__ = "UploadingCom" __type__ = "account" - __version__ = "0.1" + __version__ = "0.11" __description__ = """Uploading.com account plugin""" __license__ = "GPLv3" __authors__ = [("mkaay", "mkaay@mkaay.de")] + PREMIUM_PATTERN = r'UPGRADE TO PREMIUM' + VALID_UNTIL_PATTERN = r'Valid Until:(.+?)<' + + def loadAccountInfo(self, user, req): - src = req.load("http://uploading.com/") - premium = True - if "UPGRADE TO PREMIUM" in src: - return {"validuntil": -1, "trafficleft": -1, "premium": False} + validuntil = None + trafficleft = None + premium = None + + html = req.load("http://uploading.com/") - m = re.search("Valid Until:(.*?)<", src) + premium = False if re.search(self.PREMIUM_PATTERN, html) else True + + m = re.search(self.VALID_UNTIL_PATTERN, html) if m: - validuntil = int(mktime(strptime(m.group(1).strip(), "%b %d, %Y"))) - else: - validuntil = -1 + expiredate = m.group(1).strip() + self.logDebug("Expire date: " + expiredate) + + try: + validuntil = mktime(strptime(expiredate, "%b %d, %Y")) + + except Exception, e: + self.logError(str(e)) - return {"validuntil": validuntil, "trafficleft": -1, "premium": True} + else: + if validuntil > mktime(gmtime()): + premium = True + else: + premium = False + validuntil = None + + return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} def login(self, user, data, req): - req.cj.setCookie("uploading.com", "lang", "1") - req.cj.setCookie("uploading.com", "language", "1") - req.cj.setCookie("uploading.com", "setlang", "en") - req.cj.setCookie("uploading.com", "_lang", "en") + set_cookies([("uploading.com", "lang", "1"), + ("uploading.com", "language", "1"), + ("uploading.com", "setlang", "en"), + ("uploading.com", "_lang", "en")] + req.load("http://uploading.com/") req.load("http://uploading.com/general/login_form/?JsHttpRequest=%s-xml" % long(time() * 1000), - post={"email": user, "password": data['password'], "remember": "on"}) + post={'email': user, 'password': data['password'], 'remember': "on"}) -- 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/UploadingCom.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'module/plugins/accounts/UploadingCom.py') diff --git a/module/plugins/accounts/UploadingCom.py b/module/plugins/accounts/UploadingCom.py index e9e233a95..8747af133 100644 --- a/module/plugins/accounts/UploadingCom.py +++ b/module/plugins/accounts/UploadingCom.py @@ -40,7 +40,7 @@ class UploadingCom(Account): validuntil = mktime(strptime(expiredate, "%b %d, %Y")) except Exception, e: - self.logError(str(e)) + self.logError(e) else: if validuntil > mktime(gmtime()): @@ -53,10 +53,10 @@ class UploadingCom(Account): def login(self, user, data, req): - set_cookies([("uploading.com", "lang", "1"), - ("uploading.com", "language", "1"), - ("uploading.com", "setlang", "en"), - ("uploading.com", "_lang", "en")] + set_cookies([(".uploading.com", "lang", "1"), + (".uploading.com", "language", "1"), + (".uploading.com", "setlang", "en"), + (".uploading.com", "_lang", "en")] req.load("http://uploading.com/") req.load("http://uploading.com/general/login_form/?JsHttpRequest=%s-xml" % long(time() * 1000), -- 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/UploadingCom.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/accounts/UploadingCom.py') diff --git a/module/plugins/accounts/UploadingCom.py b/module/plugins/accounts/UploadingCom.py index 8747af133..c70d2ec11 100644 --- a/module/plugins/accounts/UploadingCom.py +++ b/module/plugins/accounts/UploadingCom.py @@ -53,10 +53,10 @@ class UploadingCom(Account): def login(self, user, data, req): - set_cookies([(".uploading.com", "lang", "1"), - (".uploading.com", "language", "1"), - (".uploading.com", "setlang", "en"), - (".uploading.com", "_lang", "en")] + set_cookies([("uploading.com", "lang", "1"), + ("uploading.com", "language", "1"), + ("uploading.com", "setlang", "en"), + ("uploading.com", "_lang", "en")] req.load("http://uploading.com/") req.load("http://uploading.com/general/login_form/?JsHttpRequest=%s-xml" % long(time() * 1000), -- cgit v1.2.3