Explorar el Código

Merge pull request #172 from Cqoicebordel/torrents-w3c+ux+rss

Torrents w3c+ux+rss
Adam Tauber hace 10 años
padre
commit
12425618ca

+ 2
- 1
searx/engines/kickass.py Ver fichero

102
         magnetlink = result.xpath(magnet_xpath)[0].attrib['href']
102
         magnetlink = result.xpath(magnet_xpath)[0].attrib['href']
103
 
103
 
104
         torrentfile = result.xpath(torrent_xpath)[0].attrib['href']
104
         torrentfile = result.xpath(torrent_xpath)[0].attrib['href']
105
+        torrentfileurl = quote(torrentfile, safe="%/:=&?~#+!$,;'@()*")
105
 
106
 
106
         # append result
107
         # append result
107
         results.append({'url': href,
108
         results.append({'url': href,
112
                         'filesize': filesize,
113
                         'filesize': filesize,
113
                         'files': files,
114
                         'files': files,
114
                         'magnetlink': magnetlink,
115
                         'magnetlink': magnetlink,
115
-                        'torrentfile': torrentfile,
116
+                        'torrentfile': torrentfileurl,
116
                         'template': 'torrent.html'})
117
                         'template': 'torrent.html'})
117
 
118
 
118
     # return results sorted by seeder
119
     # return results sorted by seeder

+ 3
- 3
searx/templates/oscar/preferences.html Ver fichero

113
                                 <div class="col-xs-6 col-sm-4 col-md-4">{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})</div>
113
                                 <div class="col-xs-6 col-sm-4 col-md-4">{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})</div>
114
                                 <div class="col-xs-6 col-sm-4 col-md-4">
114
                                 <div class="col-xs-6 col-sm-4 col-md-4">
115
                                     <div class="checkbox">
115
                                     <div class="checkbox">
116
-                                    <input class="hidden" type="checkbox" id="engine_{{ categ }}_{{ search_engine.name|replace(' ', '_') }}" name="engine_{{ search_engine.name }}"{% if search_engine.name in blocked_engines %} checked="checked"{% endif %} />
117
-                                    <label class="btn btn-success label_hide_if_checked" for="engine_{{ categ }}_{{ search_engine.name|replace(' ', '_') }}">{{ _('Block') }}</label>
118
-                                    <label class="btn btn-danger label_hide_if_not_checked" for="engine_{{ categ }}_{{ search_engine.name|replace(' ', '_') }}">{{ _('Allow') }}</label>
116
+                                    <input class="hidden" type="checkbox" id="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}" name="engine_{{ search_engine.name }}"{% if search_engine.name in blocked_engines %} checked="checked"{% endif %} />
117
+                                    <label class="btn btn-success label_hide_if_checked" for="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}">{{ _('Block') }}</label>
118
+                                    <label class="btn btn-danger label_hide_if_not_checked" for="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}">{{ _('Allow') }}</label>
119
                                     </div>
119
                                     </div>
120
                                 </div>
120
                                 </div>
121
                             </div>
121
                             </div>

+ 12
- 12
searx/templates/oscar/result_templates/torrent.html Ver fichero

4
 
4
 
5
 {% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
5
 {% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
6
 <small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
6
 <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 %}
7
 
9
 
8
 <p class="result-content">{{ icon('transfer') }} {{ _('Seeder') }} <span class="badge">{{ result.seed }}</span> &bull; {{ _('Leecher') }} <span class="badge">{{ result.leech }}</span>
10
 <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') }} 
10
     <span class="badge">
12
     <span class="badge">
11
-        {% if result.filesize < 1024 %}{{ result.filesize }} Byte
12
-        {% elif result.filesize < 1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024) }} kb
13
-        {% elif result.filesize < 1024*1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024/1024) }} MB
14
-        {% elif result.filesize < 1024*1024*1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024/1024/1024) }} GB
15
-        {% else %}{{ '{0:0.2f}'.format(result.filesize/1024/1024/1024/1024) }} TB{% endif %}
13
+        {% if result.filesize < 1024 %}{{ result.filesize }} {{ _('Bytes') }}
14
+        {% elif result.filesize < 1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024) }} {{ _('kiB') }}
15
+        {% elif result.filesize < 1024*1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024/1024) }} {{ _('MiB') }}
16
+        {% elif result.filesize < 1024*1024*1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024/1024/1024) }} {{ _('GiB') }}
17
+        {% else %}{{ '{0:0.2f}'.format(result.filesize/1024/1024/1024/1024) }} {{ _('TiB') }}{% endif %}
16
     </span>{% endif %}
18
     </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 %}
22
 
22
 
23
-{% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %}
23
+</p>
24
 
24
 
25
 <div class="clearfix"></div>
25
 <div class="clearfix"></div>
26
 
26
 

+ 1
- 1
searx/templates/oscar/results.html Ver fichero

1
 {% extends "oscar/base.html" %}
1
 {% extends "oscar/base.html" %}
2
 {% block title %}{{ q }} - {% endblock %}
2
 {% block title %}{{ q }} - {% endblock %}
3
-{% block meta %}<link rel="alternate" type="application/rss+xml" title="Searx search: {{ q }}" href="{{ url_for('index') }}?q={{ q }}&format=rss&{% for category in selected_categories %}category_{{ category }}=1&{% endfor %}pageno={{ pageno+1 }}">{% endblock %}
3
+{% block meta %}<link rel="alternate" type="application/rss+xml" title="Searx search: {{ q }}" href="{{ url_for('index') }}?q={{ q|urlencode }}&amp;format=rss&amp;{% for category in selected_categories %}category_{{ category }}=1&amp;{% endfor %}pageno={{ pageno }}">{% endblock %}
4
 {% block content %}
4
 {% block content %}
5
     <div class="row">
5
     <div class="row">
6
         <div class="col-sm-8" id="main_results">
6
         <div class="col-sm-8" id="main_results">