summaryrefslogtreecommitdiff
path: root/searx_extra
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2021-06-01 09:58:46 +0200
committerAlexandre Flament <alex@al-f.net>2021-06-01 10:01:39 +0200
commitfa0ae252b0226d495ce1912d6c2689f28a339c1d (patch)
treef3b8661320b8df4d706e9ac76f6726718afa1275 /searx_extra
parent856729226d5822a3285483689f9f8ba5c2bafc07 (diff)
downloadsearxng-fa0ae252b0226d495ce1912d6c2689f28a339c1d.tar.gz
searxng-fa0ae252b0226d495ce1912d6c2689f28a339c1d.zip
[fix] searx_extra/update/update_languages.py
* call searx.engines.load_engines (instead of initialize_engines) * set timeout to 10 seconds * remove some dead code
Diffstat (limited to 'searx_extra')
-rwxr-xr-xsearx_extra/update/update_languages.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/searx_extra/update/update_languages.py b/searx_extra/update/update_languages.py
index e63282586..1b43e01af 100755
--- a/searx_extra/update/update_languages.py
+++ b/searx_extra/update/update_languages.py
@@ -11,7 +11,8 @@ from babel import Locale, UnknownLocaleError
from babel.languages import get_global
from searx import settings, searx_dir
-from searx.engines import initialize_engines, engines
+from searx.engines import load_engines, engines
+from searx.network import set_timeout_for_thread
# Output files.
engines_languages_file = Path(searx_dir) / 'data' / 'engines_languages.json'
@@ -20,6 +21,7 @@ languages_file = Path(searx_dir) / 'languages.py'
# Fetchs supported languages for each engine and writes json file with those.
def fetch_supported_languages():
+ set_timeout_for_thread(10.0)
engines_languages = dict()
names = list(engines)
@@ -129,9 +131,6 @@ def filter_language_list(all_languages):
new_dict['country_name'] = country_name
return new_dict
- def _country_count(i):
- return len(countries[sorted_countries[i]]['counter'])
-
# for each language get country codes supported by most engines or at least one country code
filtered_languages_with_countries = dict()
for lang, lang_data in filtered_languages.items():
@@ -198,7 +197,7 @@ def write_languages_file(languages):
if __name__ == "__main__":
- initialize_engines(settings['engines'])
+ load_engines(settings['engines'])
engines_languages = fetch_supported_languages()
all_languages = join_language_lists(engines_languages)
filtered_languages = filter_language_list(all_languages)