From e9f8412a6e4b399a3335da73b3d321104bb0c4fb Mon Sep 17 00:00:00 2001 From: Bnyro Date: Wed, 12 Jun 2024 22:35:13 +0200 Subject: [perf] torrents.html, files.html: don't parse and re-format filesize --- searx/templates/simple/result_templates/files.html | 9 +-------- searx/templates/simple/result_templates/torrent.html | 9 +-------- 2 files changed, 2 insertions(+), 16 deletions(-) (limited to 'searx/templates/simple') diff --git a/searx/templates/simple/result_templates/files.html b/searx/templates/simple/result_templates/files.html index 0a1424da6..01dfc3535 100644 --- a/searx/templates/simple/result_templates/files.html +++ b/searx/templates/simple/result_templates/files.html @@ -35,14 +35,7 @@ {%- if result.filename %}{{ _('Filename') }}{{ result.filename|safe }}{% endif -%} -{%- if result.size %}{{ _('Filesize') }} - {%- if result.size < 1024 %}{{ result.size }} {{ _('Bytes') -}} - {%- elif result.size < 1024*1024 %}{{ '{0:0.2f}'.format(result.size/1024) }} {{ _('kiB') -}} - {%- elif result.size < 1024*1024*1024 %}{{ '{0:0.2f}'.format(result.size/1024/1024) }} {{ _('MiB') -}} - {%- elif result.size < 1024*1024*1024*1024 %}{{ '{0:0.2f}'.format(result.size/1024/1024/1024) }} {{ _('GiB') -}} - {%- else %}{{ '{0:0.2f}'.format(result.size/1024/1024/1024/1024) }} {{ _('TiB') }}{% endif -%} - -{%- endif -%} +{%- if result.size %}{{ _('Filesize') }}{{ result.size|safe }}{%- endif -%} {%- if result.time %}{{ _('Date') }}{{ result.time|safe }}{% endif -%} diff --git a/searx/templates/simple/result_templates/torrent.html b/searx/templates/simple/result_templates/torrent.html index 46cde2a65..befad2c89 100644 --- a/searx/templates/simple/result_templates/torrent.html +++ b/searx/templates/simple/result_templates/torrent.html @@ -8,14 +8,7 @@ {% if result.seed is defined %}

• {{ icon_big('arrow-swap') }} {{ _('Seeder') }} {{ result.seed }} • {{ _('Leecher') }} {{ result.leech }}

{% endif %} -{%- if result.filesize %}

{{ icon_big('floppy-disk') }} {{ _('Filesize') }} - {%- if result.filesize < 1024 %}{{ result.filesize }} {{ _('Bytes') }} - {%- elif result.filesize < 1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024) }} {{ _('kiB') }} - {%- elif result.filesize < 1024*1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024/1024) }} {{ _('MiB') }} - {%- elif result.filesize < 1024*1024*1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024/1024/1024) }} {{ _('GiB') }} - {%- else %}{{ '{0:0.2f}'.format(result.filesize/1024/1024/1024/1024) }} {{ _('TiB') }}{% endif -%} -

-{%- endif -%} +{%- if result.filesize %}

{{ icon_big('floppy-disk') }} {{ _('Filesize') }}{{ result.filesize }}

{%- endif -%} {%- if result.files %}

{{ icon_big('file') }} {{ _('Number of Files') }} {{ result.files }}

{% endif -%} -- cgit v1.2.3-54-g00ecf