summaryrefslogtreecommitdiff
path: root/searx/templates/simple
diff options
context:
space:
mode:
authorBnyro <bnyro@tutanota.com>2024-06-12 22:35:13 +0200
committerMarkus Heiser <markus.heiser@darmarIT.de>2024-06-15 15:42:29 +0200
commite9f8412a6e4b399a3335da73b3d321104bb0c4fb (patch)
tree0caf5c1bede7bb8739c5c2e5d107fa75455ecc24 /searx/templates/simple
parent16ce5612dd0ef426b6851ab97b248595f3933d8f (diff)
downloadsearxng-e9f8412a6e4b399a3335da73b3d321104bb0c4fb.tar.gz
searxng-e9f8412a6e4b399a3335da73b3d321104bb0c4fb.zip
[perf] torrents.html, files.html: don't parse and re-format filesize
Diffstat (limited to 'searx/templates/simple')
-rw-r--r--searx/templates/simple/result_templates/files.html9
-rw-r--r--searx/templates/simple/result_templates/torrent.html9
2 files changed, 2 insertions, 16 deletions
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 %}<tr><td>{{ _('Filename') }}</td><td>{{ result.filename|safe }}</td></tr>{% endif -%}
-{%- if result.size %}<tr><td>{{ _('Filesize') }}</td><td>
- {%- 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 -%}
- </td></tr>
-{%- endif -%}
+{%- if result.size %}<tr><td>{{ _('Filesize') }}</td><td>{{ result.size|safe }}</td></tr>{%- endif -%}
{%- if result.time %}<tr><td>{{ _('Date') }}</td><td>{{ result.time|safe }}</td></tr>{% 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 %}<p class="stat"> &bull; {{ icon_big('arrow-swap') }} {{ _('Seeder') }} <span class="badge">{{ result.seed }}</span> &bull; {{ _('Leecher') }} <span class="badge">{{ result.leech }}</span></p>{% endif %}
-{%- if result.filesize %}<p class="stat">{{ icon_big('floppy-disk') }} {{ _('Filesize') }}<span class="badge">
- {%- 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 -%}
- </span></p>
-{%- endif -%}
+{%- if result.filesize %}<p class="stat">{{ icon_big('floppy-disk') }} {{ _('Filesize') }}<span class="badge">{{ result.filesize }}</span></p>{%- endif -%}
{%- if result.files %}<p class="stat">{{ icon_big('file') }} {{ _('Number of Files') }} <span class="badge">{{ result.files }}</span></p>{% endif -%}