summaryrefslogtreecommitdiff
path: root/searx/utils.py
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2016-10-22 14:25:50 +0200
committerGitHub <noreply@github.com>2016-10-22 14:25:50 +0200
commita88768efd8ee6b832febda8508cb1ba3c8778b94 (patch)
treea42f1078ce421a69edb7088c642461b6c05f7022 /searx/utils.py
parentf90eb428c679d3852d9738f6279d045283340562 (diff)
parent85c7237a4f26cea523d5c3b8a863058e459ca07a (diff)
Merge branch 'master' into http1.1
Diffstat (limited to 'searx/utils.py')
-rw-r--r--searx/utils.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/searx/utils.py b/searx/utils.py
index b3806d3fd..5039fa975 100644
--- a/searx/utils.py
+++ b/searx/utils.py
@@ -252,12 +252,27 @@ def get_torrent_size(filesize, filesize_multiplier):
filesize = int(filesize * 1024 * 1024)
elif filesize_multiplier == 'KB':
filesize = int(filesize * 1024)
+ elif filesize_multiplier == 'TiB':
+ filesize = int(filesize * 1000 * 1000 * 1000 * 1000)
+ elif filesize_multiplier == 'GiB':
+ filesize = int(filesize * 1000 * 1000 * 1000)
+ elif filesize_multiplier == 'MiB':
+ filesize = int(filesize * 1000 * 1000)
+ elif filesize_multiplier == 'KiB':
+ filesize = int(filesize * 1000)
except:
filesize = None
return filesize
+def convert_str_to_int(number_str):
+ if number_str.isdigit():
+ return int(number_str)
+ else:
+ return 0
+
+
def is_valid_lang(lang):
is_abbr = (len(lang) == 2)
if is_abbr: