From 3a1c5876b16a51f64505c119283447b06f2a3d99 Mon Sep 17 00:00:00 2001 From: Noemi Vanyi Date: Sat, 13 Aug 2016 14:55:47 +0200 Subject: 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. --- searx/utils.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'searx/utils.py') 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 -- cgit v1.2.3