Implement #1502 (Add more metadata to calibredb's Stanza output)

This commit is contained in:
Kovid Goyal 2008-12-31 08:44:03 -08:00
parent fad5109de6
commit dad9ec898f

View File

@ -76,13 +76,23 @@ STANZA_TEMPLATE='''\
<entry> <entry>
<title>${record['title']}</title> <title>${record['title']}</title>
<id>urn:calibre:${record['id']}</id> <id>urn:calibre:${record['id']}</id>
<author><name>${record['authors']}</name></author> <author><name>${record['author_sort']}</name></author>
<updated>${record['timestamp'].strftime('%Y-%m-%dT%H:%M:%SZ')}</updated> <updated>${record['timestamp'].strftime('%Y-%m-%dT%H:%M:%SZ')}</updated>
<link type="application/epub+zip" href="${quote(record['fmt_epub'].replace(sep, '/')).replace('http%3A', 'http:')}" /> <link type="application/epub+zip" href="${quote(record['fmt_epub'].replace(sep, '/')).replace('http%3A', 'http:')}" />
<link py:if="record['cover']" rel="x-stanza-cover-image" type="image/png" href="${quote(record['cover'].replace(sep, '/')).replace('http%3A', 'http:')}" /> <link py:if="record['cover']" rel="x-stanza-cover-image" type="image/png" href="${quote(record['cover'].replace(sep, '/')).replace('http%3A', 'http:')}" />
<link py:if="record['cover']" rel="x-stanza-cover-image-thumbnail" type="image/png" href="${quote(record['cover'].replace(sep, '/')).replace('http%3A', 'http:')}" /> <link py:if="record['cover']" rel="x-stanza-cover-image-thumbnail" type="image/png" href="${quote(record['cover'].replace(sep, '/')).replace('http%3A', 'http:')}" />
<content type="xhtml"> <content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">${record['comments']}</div> <div xmlns="http://www.w3.org/1999/xhtml">
<py:for each="f in ('authors','publisher','rating','tags','series', 'isbn')">
<py:if test="record[f]">
${f.capitalize()}:${unicode(', '.join(record[f]) if f=='tags' else record[f])}<br/>
</py:if>
</py:for>
<py:if test="record['comments']">
<br/>
${record['comments']}
</py:if>
</div>
</content> </content>
</entry> </entry>
</py:for> </py:for>