diff options
author | Noemi Vanyi <sitbackandwait@gmail.com> | 2016-08-13 14:55:47 +0200 |
---|---|---|
committer | Noemi Vanyi <sitbackandwait@gmail.com> | 2016-08-13 16:19:00 +0200 |
commit | 3a1c5876b16a51f64505c119283447b06f2a3d99 (patch) | |
tree | f2a453fb952224629a91e6fc0de03e80a0c45826 /searx/utils.py | |
parent | 104cdb7d03771d4eca5b5126532ccf47642bb9de (diff) | |
download | searxng-3a1c5876b16a51f64505c119283447b06f2a3d99.tar.gz searxng-3a1c5876b16a51f64505c119283447b06f2a3d99.zip |
add digbt engine
Unfortunately, it is quite slow so it is disabled.
Furthermore, the display of number of files is wrong
on digbt.org, so it is not displayed on searx.
Diffstat (limited to 'searx/utils.py')
-rw-r--r-- | searx/utils.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/searx/utils.py b/searx/utils.py index aa8ce92a1..744142e36 100644 --- a/searx/utils.py +++ b/searx/utils.py @@ -237,3 +237,21 @@ def list_get(a_list, index, default=None): return a_list[index] else: return default + + +def get_torrent_size(filesize, filesize_multiplier): + try: + filesize = float(filesize) + + if filesize_multiplier == 'TB': + filesize = int(filesize * 1024 * 1024 * 1024 * 1024) + elif filesize_multiplier == 'GB': + filesize = int(filesize * 1024 * 1024 * 1024) + elif filesize_multiplier == 'MB': + filesize = int(filesize * 1024 * 1024) + elif filesize_multiplier == 'KB': + filesize = int(filesize * 1024) + except: + filesize = None + + return filesize |