|
1 | 1 | { |
2 | | - "pubdate": "{{entry.pubdate}}", |
3 | | - "title": "{{entry.title}}", |
| 2 | + "pubdate": {{ entry.pubdate | string | tojson }}, |
| 3 | + "title": {{ entry.title | tojson }}, |
4 | 4 | "format_metadata": { |
5 | 5 | {% for format in entry.data %} |
6 | | - "{{format.format}}": { |
7 | | - "mtime": "{{entry.last_modified}}", |
8 | | - "size": {{format.uncompressed_size}}, |
| 6 | + {{ format.format | tojson }}: { |
| 7 | + "mtime": {{ entry.last_modified | string | tojson }}, |
| 8 | + "size": {{ format.uncompressed_size }}, |
9 | 9 | "path": "" |
10 | 10 | }{% if not loop.last %},{% endif %} |
11 | 11 | {% endfor %} |
12 | 12 | }, |
13 | 13 | "formats": [ |
14 | 14 | {% for format in entry.data %} |
15 | | - "{{format.format}}"{% if not loop.last %},{% endif %} |
| 15 | + {{ format.format | tojson }}{% if not loop.last %},{% endif %} |
16 | 16 | {% endfor %} |
17 | 17 | ], |
18 | 18 | "series": null, |
19 | | - "cover": "{{url_for('opds.feed_get_cover', book_id=entry.id)}}", |
| 19 | + "cover": {{ url_for('opds.feed_get_cover', book_id=entry.id) | tojson }}, |
20 | 20 | "languages": [ |
21 | 21 | {% for lang in entry.languages %} |
22 | | - "{{lang.lang_code}}"{% if not loop.last %},{% endif %} |
| 22 | + {{ lang.lang_code | tojson }}{% if not loop.last %},{% endif %} |
23 | 23 | {% endfor %} |
24 | 24 | ], |
25 | | - "comments": "{% if entry.comments|length > 0 %}{{entry.comments[0].text.replace('"', '\\"')|safe}}{% endif %}", |
| 25 | + "comments": {% if entry.comments|length > 0 %}{{ entry.comments[0].text | tojson }}{% else %}null{% endif %}, |
26 | 26 | "tags": [ |
27 | 27 | {% for tag in entry.tags %} |
28 | | - "{{tag.name}}"{% if not loop.last %},{% endif %} |
| 28 | + {{ tag.name | tojson }}{% if not loop.last %},{% endif %} |
29 | 29 | {% endfor %} |
30 | 30 | ], |
31 | | - "application_id": {{entry.id}}, |
32 | | - "series_index": {% if entry.series|length > 0 %}"{{entry.series_index}}"{% else %}null{% endif %}, |
33 | | - "last_modified": "{{entry.last_modified}}", |
34 | | - "author_sort": "{{entry.author_sort}}", |
35 | | - "uuid": "{{entry.uuid}}", |
36 | | - "timestamp": "{{entry.timestamp}}", |
37 | | - "thumbnail": "{{url_for('opds.feed_get_cover', book_id=entry.id)}}", |
| 31 | + "application_id": {{ entry.id }}, |
| 32 | + "series_index": {% if entry.series|length > 0 %}{{ entry.series_index | tojson }}{% else %}null{% endif %}, |
| 33 | + "last_modified": {{ entry.last_modified | string | tojson }}, |
| 34 | + "author_sort": {{ entry.author_sort | tojson }}, |
| 35 | + "uuid": {{ entry.uuid | tojson }}, |
| 36 | + "timestamp": {{ entry.timestamp | string | tojson }}, |
| 37 | + "thumbnail": {{ url_for('opds.feed_get_cover', book_id=entry.id) | tojson }}, |
38 | 38 | "main_format": { |
39 | | - "{{entry.data[0].format|lower}}": "{{ url_for('opds.opds_download_link', book_id=entry.id, book_format=entry.data[0].format|lower)}}" |
| 39 | + {{ entry.data[0].format|lower | tojson }}: {{ url_for('opds.opds_download_link', book_id=entry.id, book_format=entry.data[0].format|lower) | tojson }} |
40 | 40 | }, |
41 | | - "rating":{% if entry.ratings.__len__() > 0 %} "{{entry.ratings[0].rating}}.0"{% else %}0.0{% endif %}, |
| 41 | + "rating": {% if entry.ratings.__len__() > 0 %}{{ (entry.ratings[0].rating|string + ".0") | tojson }}{% else %}0.0{% endif %}, |
42 | 42 | "authors": [ |
43 | 43 | {% for author in entry.authors %} |
44 | | - "{{author.name.replace('|',',')}}"{% if not loop.last %},{% endif %} |
| 44 | + {{ author.name.replace('|',',') | tojson }}{% if not loop.last %},{% endif %} |
| 45 | + {% endfor %} |
| 46 | + ], |
| 47 | + "publishers": [ |
| 48 | + {% for publisher in entry.publishers %} |
| 49 | + {{ publisher.name | tojson }}{% if not loop.last %},{% endif %} |
45 | 50 | {% endfor %} |
46 | 51 | ], |
47 | 52 | "other_formats": { |
48 | 53 | {% if entry.data.__len__() > 1 %} |
49 | 54 | {% for format in entry.data[1:] %} |
50 | | - "{{format.format|lower}}": "{{ url_for('opds.opds_download_link', book_id=entry.id, book_format=format.format|lower)}}"{% if not loop.last %},{% endif %} |
| 55 | + {{ format.format|lower | tojson }}: {{ url_for('opds.opds_download_link', book_id=entry.id, book_format=format.format|lower) | tojson }}{% if not loop.last %},{% endif %} |
51 | 56 | {% endfor %} |
52 | 57 | {% endif %} }, |
53 | | - "title_sort": "{{entry.sort}}" |
| 58 | + "title_sort": {{ entry.sort | tojson }} |
54 | 59 | } |
0 commit comments