diff options
author | Noémi Ványi <sitbackandwait@gmail.com> | 2016-10-11 19:31:42 +0200 |
---|---|---|
committer | Noémi Ványi <sitbackandwait@gmail.com> | 2016-10-22 05:27:18 +0200 |
commit | 53c9fde992741dea936d9ca92d13e5a8a30b1c47 (patch) | |
tree | d23fbfc374c5c6d7e1f292c30541a3aaf72a296c /searx/utils.py | |
parent | 218857999e41c86732738a6733cb1fe3ea6b33ca (diff) | |
download | searxng-53c9fde992741dea936d9ca92d13e5a8a30b1c47.tar.gz searxng-53c9fde992741dea936d9ca92d13e5a8a30b1c47.zip |
fix kickass torrents engine
Diffstat (limited to 'searx/utils.py')
-rw-r--r-- | searx/utils.py | 15 |
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: |