summaryrefslogtreecommitdiffstats
path: root/module/plugins/Account.py
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2010-05-07 17:31:29 +0200
committerGravatar mkaay <mkaay@mkaay.de> 2010-05-07 17:31:29 +0200
commit4c6fbd8177a7499608b177d64297dc5117a8dd9a (patch)
tree903187b2fb69eabe3b6f59c31e2d9f245bdd0412 /module/plugins/Account.py
parentbetter rapidshare traffic share handling (diff)
downloadpyload-4c6fbd8177a7499608b177d64297dc5117a8dd9a.tar.xz
UploadedTo account plugin
Diffstat (limited to 'module/plugins/Account.py')
-rw-r--r--module/plugins/Account.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/module/plugins/Account.py b/module/plugins/Account.py
index ab3ad9ec5..2ed2325c9 100644
--- a/module/plugins/Account.py
+++ b/module/plugins/Account.py
@@ -18,6 +18,7 @@
"""
from random import randrange
+import re
class Account():
__name__ = "Account"
@@ -72,3 +73,16 @@ class Account():
else:
account = self.register[plugin]
return account
+
+ 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