summaryrefslogtreecommitdiffstats
path: root/module/plugins/Account.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/Account.py')
-rw-r--r--module/plugins/Account.py14
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