diff --git a/nyaa/routes.py b/nyaa/routes.py index fe4ccff..cfae637 100644 --- a/nyaa/routes.py +++ b/nyaa/routes.py @@ -367,6 +367,7 @@ def render_rss(label, query, use_elastic): use_elastic=use_elastic, term=label, site_url=flask.request.url_root, + compute_hash=lambda x: base64.b32encode(x).decode('utf-8'), torrent_query=query) response = flask.make_response(rss_xml) response.headers['Content-Type'] = 'application/xml' diff --git a/nyaa/templates/rss.xml b/nyaa/templates/rss.xml index e1787d2..839e55a 100644 --- a/nyaa/templates/rss.xml +++ b/nyaa/templates/rss.xml @@ -5,33 +5,33 @@ {{ url_for('home', _external=True) }} {% for torrent in torrent_query %} - {% if torrent.has_torrent %} {{ torrent.display_name }} + {% if use_elastic %} - {{ url_for('download_torrent', torrent_id=torrent.meta.id, _external=True) }} - {{ url_for('view_torrent', torrent_id=torrent.meta.id, _external=True) }} - {{ torrent.created_time|rfc822_es }} + {% if torrent.has_torrent %} + {{ url_for('download_torrent', torrent_id=torrent.meta.id, _external=True) }} + {% else %} + {{ create_magnet_from_info(torrent.display_name, torrent.info_hash) }} + {% endif %} + {{ url_for('view_torrent', torrent_id=torrent.meta.id, _external=True) }} + {{ torrent.created_time|rfc822_es }} {% else %} - {{ url_for('download_torrent', torrent_id=torrent.id, _external=True) }} - {{ url_for('view_torrent', torrent_id=torrent.id, _external=True) }} - {{ torrent.created_time|rfc822 }} - {% endif %} - - {% else %} - - {{ torrent.display_name }} - {% if use_elastic %} - {{ create_magnet_from_info(torrent.display_name, torrent.info_hash) }} - {{ url_for('view_torrent', torrent_id=torrent.meta.id, _external=True) }} - {{ torrent.created_time|rfc822_es }} - {% else %} - {{ torrent.magnet_uri }} - {{ url_for('view_torrent', torrent_id=torrent.id, _external=True) }} - {{ torrent.created_time|rfc822 }} + {% if torrent.has_torrent %} + {{ url_for('download_torrent', torrent_id=torrent.id, _external=True) }} + {% else %} + {{ torrent.magnet_uri }} + {% endif %} + {{ url_for('view_torrent', torrent_id=torrent.id, _external=True) }} + {{ torrent.created_time|rfc822 }} {% endif %} + {{ torrent.main_category.name }} - {{ torrent.sub_category.name }} + {{ torrent.filesize | filesizeformat(True) }} + {{ torrent.stats.seed_count }} + {{ torrent.stats.leech_count }} + {{ torrent.stats.download_count }} + {{ compute_hash(torrent.info_hash) }} - {% endif %} {% endfor %}