mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 15:00:01 +00:00
Merge branch 'update-rss-template' of https://github.com/sharkykh/nyaa into sharkykh-update-rss-template
This commit is contained in:
commit
e7614bcef1
|
@ -367,6 +367,7 @@ def render_rss(label, query, use_elastic):
|
||||||
use_elastic=use_elastic,
|
use_elastic=use_elastic,
|
||||||
term=label,
|
term=label,
|
||||||
site_url=flask.request.url_root,
|
site_url=flask.request.url_root,
|
||||||
|
compute_hash=lambda x: base64.b32encode(x).decode('utf-8'),
|
||||||
torrent_query=query)
|
torrent_query=query)
|
||||||
response = flask.make_response(rss_xml)
|
response = flask.make_response(rss_xml)
|
||||||
response.headers['Content-Type'] = 'application/xml'
|
response.headers['Content-Type'] = 'application/xml'
|
||||||
|
|
|
@ -5,33 +5,33 @@
|
||||||
<link>{{ url_for('home', _external=True) }}</link>
|
<link>{{ url_for('home', _external=True) }}</link>
|
||||||
<atom:link href="{{ url_for('home', page='rss', _external=True) }}" rel="self" type="application/rss+xml" />
|
<atom:link href="{{ url_for('home', page='rss', _external=True) }}" rel="self" type="application/rss+xml" />
|
||||||
{% for torrent in torrent_query %}
|
{% for torrent in torrent_query %}
|
||||||
{% if torrent.has_torrent %}
|
|
||||||
<item>
|
<item>
|
||||||
<title>{{ torrent.display_name }}</title>
|
<title>{{ torrent.display_name }}</title>
|
||||||
|
<description><![CDATA[{{ torrent.description }}]]></description>
|
||||||
{% if use_elastic %}
|
{% if use_elastic %}
|
||||||
<link>{{ url_for('download_torrent', torrent_id=torrent.meta.id, _external=True) }}</link>
|
{% if torrent.has_torrent %}
|
||||||
<guid isPermaLink="true">{{ url_for('view_torrent', torrent_id=torrent.meta.id, _external=True) }}</guid>
|
<link>{{ url_for('download_torrent', torrent_id=torrent.meta.id, _external=True) }}</link>
|
||||||
<pubDate>{{ torrent.created_time|rfc822_es }}</pubDate>
|
{% else %}
|
||||||
|
<link>{{ create_magnet_from_info(torrent.display_name, torrent.info_hash) }}</link>
|
||||||
|
{% endif %}
|
||||||
|
<guid isPermaLink="true">{{ url_for('view_torrent', torrent_id=torrent.meta.id, _external=True) }}</guid>
|
||||||
|
<pubDate>{{ torrent.created_time|rfc822_es }}</pubDate>
|
||||||
{% else %}
|
{% else %}
|
||||||
<link>{{ url_for('download_torrent', torrent_id=torrent.id, _external=True) }}</link>
|
{% if torrent.has_torrent %}
|
||||||
<guid isPermaLink="true">{{ url_for('view_torrent', torrent_id=torrent.id, _external=True) }}</guid>
|
<link>{{ url_for('download_torrent', torrent_id=torrent.id, _external=True) }}</link>
|
||||||
<pubDate>{{ torrent.created_time|rfc822 }}</pubDate>
|
{% else %}
|
||||||
{% endif %}
|
<link>{{ torrent.magnet_uri }}</link>
|
||||||
</item>
|
{% endif %}
|
||||||
{% else %}
|
<guid isPermaLink="true">{{ url_for('view_torrent', torrent_id=torrent.id, _external=True) }}</guid>
|
||||||
<item>
|
<pubDate>{{ torrent.created_time|rfc822 }}</pubDate>
|
||||||
<title>{{ torrent.display_name }}</title>
|
|
||||||
{% if use_elastic %}
|
|
||||||
<link>{{ create_magnet_from_info(torrent.display_name, torrent.info_hash) }}</link>
|
|
||||||
<guid isPermaLink="true">{{ url_for('view_torrent', torrent_id=torrent.meta.id, _external=True) }}</guid>
|
|
||||||
<pubDate>{{ torrent.created_time|rfc822_es }}</pubDate>
|
|
||||||
{% else %}
|
|
||||||
<link>{{ torrent.magnet_uri }}</link>
|
|
||||||
<guid isPermaLink="true">{{ url_for('view_torrent', torrent_id=torrent.id, _external=True) }}</guid>
|
|
||||||
<pubDate>{{ torrent.created_time|rfc822 }}</pubDate>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<category>{{ torrent.main_category.name }} - {{ torrent.sub_category.name }}</category>
|
||||||
|
<size>{{ torrent.filesize | filesizeformat(True) }}</size>
|
||||||
|
<seeders>{{ torrent.stats.seed_count }}</seeders>
|
||||||
|
<leechers>{{ torrent.stats.leech_count }}</leechers>
|
||||||
|
<downloads>{{ torrent.stats.download_count }}</downloads>
|
||||||
|
<infoHash>{{ compute_hash(torrent.info_hash) }}</infoHash>
|
||||||
</item>
|
</item>
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</channel>
|
</channel>
|
||||||
</rss>
|
</rss>
|
||||||
|
|
Loading…
Reference in a new issue