diff --git a/searx/engines/kickass.py b/searx/engines/kickass.py index a4d27067..ac349283 100644 --- a/searx/engines/kickass.py +++ b/searx/engines/kickass.py @@ -102,6 +102,7 @@ def response(resp): magnetlink = result.xpath(magnet_xpath)[0].attrib['href'] torrentfile = result.xpath(torrent_xpath)[0].attrib['href'] + torrentfileurl = quote(torrentfile, safe="%/:=&?~#+!$,;'@()*") # append result results.append({'url': href, @@ -112,7 +113,7 @@ def response(resp): 'filesize': filesize, 'files': files, 'magnetlink': magnetlink, - 'torrentfile': torrentfile, + 'torrentfile': torrentfileurl, 'template': 'torrent.html'}) # return results sorted by seeder diff --git a/searx/templates/oscar/preferences.html b/searx/templates/oscar/preferences.html index 2868adec..64486582 100644 --- a/searx/templates/oscar/preferences.html +++ b/searx/templates/oscar/preferences.html @@ -113,9 +113,9 @@
{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})
- - - + + +
diff --git a/searx/templates/oscar/result_templates/torrent.html b/searx/templates/oscar/result_templates/torrent.html index 9258a0cb..9e39776e 100644 --- a/searx/templates/oscar/result_templates/torrent.html +++ b/searx/templates/oscar/result_templates/torrent.html @@ -4,23 +4,23 @@ {% if result.publishedDate %}{% endif %} {{ icon('link') }} {{ _('cached') }} +{% if result.magnetlink %}{{ icon('magnet') }} {{ _('magnet link') }}{% endif %} +{% if result.torrentfile %}{{ icon('download-alt') }} {{ _('torrent file') }}{% endif %}

{{ icon('transfer') }} {{ _('Seeder') }} {{ result.seed }} • {{ _('Leecher') }} {{ result.leech }} -{% if result.filesize %}
{{ icon('floppy-disk') }} {{ _('Filesize') }} +{% if result.filesize %}
{{ icon('floppy-disk') }} {{ _('Filesize') }} - {% if result.filesize < 1024 %}{{ result.filesize }} Byte - {% elif result.filesize < 1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024) }} kb - {% elif result.filesize < 1024*1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024/1024) }} MB - {% elif result.filesize < 1024*1024*1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024/1024/1024) }} GB - {% else %}{{ '{0:0.2f}'.format(result.filesize/1024/1024/1024/1024) }} TB{% endif %} + {% 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.files %}
{{ icon('file') }} {{ _('Number of Files') }} {{ result.files }}{% endif %}

-

- {{ icon('magnet') }} {{ _('magnet link') }} - {% if result.torrentfile %}
{{ icon('download-alt') }} {{ _('torrent file') }}{% endif %} -

+{% if result.files %}
{{ icon('file') }} {{ _('Number of Files') }} {{ result.files }}{% endif %} -{% if result.content %}

{{ result.content|safe }}

{% endif %} +{% if result.content %}
{{ result.content|safe }}{% endif %} + +

diff --git a/searx/templates/oscar/results.html b/searx/templates/oscar/results.html index 46c23069..b60c977a 100644 --- a/searx/templates/oscar/results.html +++ b/searx/templates/oscar/results.html @@ -1,6 +1,6 @@ {% extends "oscar/base.html" %} {% block title %}{{ q }} - {% endblock %} -{% block meta %}{% endblock %} +{% block meta %}{% endblock %} {% block content %}