Fix opds format errors & extend info

This commit is contained in:
xcffl
2020-04-08 23:11:59 +08:00
parent 80753b1115
commit 70c9dd1b95
2 changed files with 27 additions and 21 deletions

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dcterms="http://purl.org/dc/terms/">
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/terms/">
<id>urn:uuid:2853dacf-ed79-42f5-8e8a-a7bb3d1ae6a2</id>
<updated>{{ current_time }}</updated>
<link rel="self"
@@ -49,18 +49,24 @@
</author>
{% endif %}
{% if entry.publishers.__len__() > 0 %}
<publisher>
<dc:publisher>
<name>{{entry.publishers[0].name}}</name>
</publisher>
</dc:publisher>
{% endif %}
{% if entry.pubdate %}
<dc:issued>{{entry.pubdate}}</dc:issued>
{% endif %}
{% for lang in entry.languages %}
<dcterms:language>{{lang.lang_code}}</dcterms:language>
<dc:language>{{lang.lang_code}}</dc:language>
{% endfor %}
{% for tag in entry.tags %}
<category scheme="http://www.bisg.org/standards/bisac_subject/index.html"
term="{{tag.name}}"
label="{{tag.name}}"/>
{% endfor %}
{% for identifier in entry.identifiers %}
<dc:identifier>{{identifier.val}}</dc:identifier>
{% endfor %}
{% if entry.comments[0] %}<summary>{{entry.comments[0].text|striptags}}</summary>{% endif %}
{% if entry.has_cover %}
<link type="image/jpeg" href="{{url_for('opds.feed_get_cover', book_id=entry.id)}}" rel="http://opds-spec.org/image"/>
@@ -68,7 +74,7 @@
{% endif %}
{% for format in entry.data %}
<link rel="http://opds-spec.org/acquisition" href="{{ url_for('opds.opds_download_link', book_id=entry.id, book_format=format.format|lower)}}"
length="{{format.uncompressed_size}}" mtime="{{entry.atom_timestamp}}" type="{{format.format|lower|mimetype}}"/>
length="{{format.uncompressed_size}}" type="{{format.format|lower|mimetype}}"/>
{% endfor %}
</entry>
{% endfor %}