From c59d0c200ed2c64bb6cbb35adfe7f18298d81af4 Mon Sep 17 00:00:00 2001 From: Cqoicebordel Date: Sun, 11 Jan 2015 19:34:11 +0100 Subject: [PATCH 1/5] Fix torrent W3C+UX Puts links to torrents and magnets in tool bar Fixes a lot of W3C errors --- searx/engines/kickass.py | 3 ++- .../templates/oscar/result_templates/torrent.html | 14 +++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/searx/engines/kickass.py b/searx/engines/kickass.py index a4d270673..ac349283d 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/result_templates/torrent.html b/searx/templates/oscar/result_templates/torrent.html index 9258a0cb7..1893282b3 100644 --- a/searx/templates/oscar/result_templates/torrent.html +++ b/searx/templates/oscar/result_templates/torrent.html @@ -4,9 +4,11 @@ {% 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 @@ -14,13 +16,11 @@ {% 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 %} {% 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 %} + +

From 6ca81f649d479625d9e7885860fa5d5846f64f0e Mon Sep 17 00:00:00 2001 From: Cqoicebordel Date: Sun, 11 Jan 2015 19:34:50 +0100 Subject: [PATCH 2/5] Fix RSS link Fix page number, urlencoded request and encoded & --- searx/templates/oscar/results.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/searx/templates/oscar/results.html b/searx/templates/oscar/results.html index 46c230695..b60c977a5 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 %}
From e32cb59ad6648472175041c0ca12cceaf939cb64 Mon Sep 17 00:00:00 2001 From: Cqoicebordel Date: Sun, 11 Jan 2015 19:45:17 +0100 Subject: [PATCH 3/5] W3C fix --- searx/templates/oscar/preferences.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/searx/templates/oscar/preferences.html b/searx/templates/oscar/preferences.html index 2868adecc..644865822 100644 --- a/searx/templates/oscar/preferences.html +++ b/searx/templates/oscar/preferences.html @@ -113,9 +113,9 @@
{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})
- - - + + +
From 3002725e2df6a6c6e8969b740a3eb7712967a5b6 Mon Sep 17 00:00:00 2001 From: Cqoicebordel Date: Mon, 12 Jan 2015 11:04:54 +0100 Subject: [PATCH 4/5] Few more translations --- searx/templates/oscar/result_templates/torrent.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/searx/templates/oscar/result_templates/torrent.html b/searx/templates/oscar/result_templates/torrent.html index 1893282b3..b47a1b808 100644 --- a/searx/templates/oscar/result_templates/torrent.html +++ b/searx/templates/oscar/result_templates/torrent.html @@ -10,11 +10,11 @@

{{ icon('transfer') }} {{ _('Seeder') }} {{ result.seed }} • {{ _('Leecher') }} {{ result.leech }} {% 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) }} {{ _('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 %} {% endif %} {% if result.files %}
{{ icon('file') }} {{ _('Number of Files') }} {{ result.files }}{% endif %} From 824208491a73f82e2297ef76753a44a93b4b1141 Mon Sep 17 00:00:00 2001 From: Cqoicebordel Date: Mon, 12 Jan 2015 13:08:32 +0100 Subject: [PATCH 5/5] Scientific accuracy --- searx/templates/oscar/result_templates/torrent.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/searx/templates/oscar/result_templates/torrent.html b/searx/templates/oscar/result_templates/torrent.html index b47a1b808..9e39776e0 100644 --- a/searx/templates/oscar/result_templates/torrent.html +++ b/searx/templates/oscar/result_templates/torrent.html @@ -11,10 +11,10 @@ {% if result.filesize %}
{{ icon('floppy-disk') }} {{ _('Filesize') }} {% if result.filesize < 1024 %}{{ result.filesize }} {{ _('Bytes') }} - {% 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 %} + {% 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 %}