diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-05-07 10:44:36 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-05-07 10:44:36 +0200 |
commit | b61e1467ee19ca96782248c0189424334d5980b7 (patch) | |
tree | cb7b7283f725efe9a525e81f535d22cb2a287e54 /module/plugins/Account.py | |
parent | merged (diff) | |
download | pyload-b61e1467ee19ca96782248c0189424334d5980b7.tar.xz |
hooks methods callable via rpc, closed #299
Diffstat (limited to 'module/plugins/Account.py')
-rw-r--r-- | module/plugins/Account.py | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/module/plugins/Account.py b/module/plugins/Account.py index b8de4ddf0..e8ca26749 100644 --- a/module/plugins/Account.py +++ b/module/plugins/Account.py @@ -22,7 +22,7 @@ from random import choice from time import time from traceback import print_exc -from module.utils import compare_time +from module.utils import compare_time, parseFileSize class WrongPassword(Exception): pass @@ -189,17 +189,7 @@ class Account(): return False if self.selectAccount() == (None, None) else True def parseTraffic(self, string): #returns kbyte - string = string.strip().lower() - p = re.compile(r"(\d+[\.,]\d+)(.*)") - m = p.match(string) - if m: - traffic = float(m.group(1).replace(",", ".")) - unit = m.group(2).strip() - if unit == "gb" or unit == "gig" or unit == "gbyte" or unit == "gigabyte": - traffic *= 1024*1024 - elif unit == "mb" or unit == "megabyte" or unit == "mbyte" or unit == "mib": - traffic *= 1024 - return traffic + return parseFileSize(string) / 1024 def wrongPassword(self): raise WrongPassword |