summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/plugins/accounts/UploadedTo.py61
1 files changed, 33 insertions, 28 deletions
diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py
index 50c03041d..7e2468459 100644
--- a/module/plugins/accounts/UploadedTo.py
+++ b/module/plugins/accounts/UploadedTo.py
@@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account
class UploadedTo(Account):
__name__ = "UploadedTo"
__type__ = "account"
- __version__ = "0.42"
+ __version__ = "0.43"
__status__ = "testing"
__description__ = """Uploaded.to account plugin"""
@@ -25,37 +25,42 @@ class UploadedTo(Account):
def grab_info(self, user, password, data):
- validuntil = None
- trafficleft = None
- premium = None
-
html = self.load("http://uploaded.net/me")
premium = True if re.search(self.PREMIUM_PATTERN, html) else False
+ if premium:
+ validuntil = None
+ trafficleft = None
+ premium = None
- m = re.search(self.VALID_UNTIL_PATTERN, html, re.M)
- if m is not None:
- expiredate = m.group(1).lower().strip()
-
- if expiredate == "unlimited":
- validuntil = -1
- else:
- m = re.findall(r'(\d+) (week|day|hour)', expiredate)
- if m is not None:
- validuntil = time.time()
- for n, u in m:
- validuntil += float(n) * 60 * 60 * {'week': 168, 'day': 24, 'hour': 1}[u]
-
- m = re.search(self.TRAFFIC_LEFT_PATTERN, html)
- if m is not None:
- traffic = m.groupdict()
- size = traffic['S'].replace('.', '')
- unit = traffic['U'].lower()
- trafficleft = self.parse_traffic(size, unit)
-
- return {'validuntil' : validuntil,
- 'trafficleft': trafficleft,
- 'premium' : premium}
+ m = re.search(self.VALID_UNTIL_PATTERN, html, re.M)
+ if m is not None:
+ expiredate = m.group(1).lower().strip()
+
+ if expiredate == "unlimited":
+ validuntil = -1
+ else:
+ m = re.findall(r'(\d+) (week|day|hour)', expiredate)
+ if m is not None:
+ validuntil = time.time()
+ for n, u in m:
+ validuntil += float(n) * 60 * 60 * {'week': 168, 'day': 24, 'hour': 1}[u]
+
+ m = re.search(self.TRAFFIC_LEFT_PATTERN, html)
+ if m is not None:
+ traffic = m.groupdict()
+ size = traffic['S'].replace('.', '')
+ unit = traffic['U'].lower()
+ trafficleft = self.parse_traffic(size, unit)
+
+ return {'validuntil' : validuntil,
+ 'trafficleft': trafficleft,
+ 'premium' : premium}
+
+ else:
+ return {'validuntil' : -1,
+ 'trafficleft': -1,
+ 'premium' : premium}
def signin(self, user, password, data):