on master help sign in
Fix torrent W3C+UX

Puts links to torrents and magnets in tool bar Fixes a lot of W3C errors

commitc59d0c200ed2c64bb6cbb35adfe7f18298d81af4 authorCqoicebordel <Cqoicebordel@users.noreply.github.com> dateSun 11 Jan 2015, 19:34 (12 years ago) parentd7ea44a
2 files changed+9−8
searx/engines/kickass.py+2−1 searx/templates/oscar/result_templates/torrent.html+7−7
searx/engines/kickass.py+2−1
@@ -102,6 +102,7 @@ def response(resp):
102102 magnetlink = result.xpath(magnet_xpath)[0].attrib['href']
103103
104104 torrentfile = result.xpath(torrent_xpath)[0].attrib['href']
105+ torrentfileurl = quote(torrentfile, safe="%/:=&?~#+!$,;'@()*")
105106
106107 # append result
107108 results.append({'url': href,
@@ -112,7 +113,7 @@ def response(resp):
112113 'filesize': filesize,
113114 'files': files,
114115 'magnetlink': magnetlink,
115− 'torrentfile': torrentfile,
116+ 'torrentfile': torrentfileurl,
116117 'template': 'torrent.html'})
117118
118119 # return results sorted by seeder
searx/templates/oscar/result_templates/torrent.html+7−7
@@ -4,9 +4,11 @@
44
55{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
66<small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
7+{% if result.magnetlink %}<small> &bull; <a href="{{ result.magnetlink }}" class="magnetlink">{{ icon('magnet') }} {{ _('magnet link') }}</a></small>{% endif %}
8+{% if result.torrentfile %}<small> &bull; <a href="{{ result.torrentfile }}" class="torrentfile">{{ icon('download-alt') }} {{ _('torrent file') }}</a></small>{% endif %}
79
810<p class="result-content">{{ icon('transfer') }} {{ _('Seeder') }} <span class="badge">{{ result.seed }}</span> &bull; {{ _('Leecher') }} <span class="badge">{{ result.leech }}</span>
9−{% if result.filesize %}</br>{{ icon('floppy-disk') }} {{ _('Filesize') }}
11+{% if result.filesize %}<br />{{ icon('floppy-disk') }} {{ _('Filesize') }}
1012 <span class="badge">
1113 {% if result.filesize < 1024 %}{{ result.filesize }} Byte
1214 {% elif result.filesize < 1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024) }} kb
@@ -14,13 +16,11 @@
1416 {% elif result.filesize < 1024*1024*1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024/1024/1024) }} GB
1517 {% else %}{{ '{0:0.2f}'.format(result.filesize/1024/1024/1024/1024) }} TB{% endif %}
1618 </span>{% endif %}
17−{% if result.files %}</br>{{ icon('file') }} {{ _('Number of Files') }} <span class="badge">{{ result.files }}</span>{% endif %}</p>
18−<p class="result-content">
19− <a href="{{ result.magnetlink }}" class="magnetlink">{{ icon('magnet') }} {{ _('magnet link') }}</a>
20− {% if result.torrentfile %}</br><a href="{{ result.torrentfile }}" class="torrentfile">{{ icon('download-alt') }} {{ _('torrent file') }}</a>{% endif %}
21−</p>
19+{% if result.files %}<br />{{ icon('file') }} {{ _('Number of Files') }} <span class="badge">{{ result.files }}</span>{% endif %}
20+
21+{% if result.content %}<br />{{ result.content|safe }}{% endif %}
2222
23−{% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %}
23+</p>
2424
2525<div class="clearfix"></div>
2626