Skip to content

Commit

Permalink
Templates
Browse files Browse the repository at this point in the history
  • Loading branch information
kthoden committed Sep 23, 2019
1 parent 8763a7b commit faacf38
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 0 deletions.
15 changes: 15 additions & 0 deletions opds/templates/opds/base.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns:dcterms="http://purl.org/dc/terms/" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:app="http://www.w3.org/2007/app" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns="http://www.w3.org/2005/Atom" xmlns:opds="http://opds-spec.org/2010/catalog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xml:lang="en" xmlns:odl="http://opds-spec.org/odl" xmlns:schema="http://schema.org">
{% block id_and_title %}{% endblock%}
<updated>{{ Lastchange|date:"Y-m-d" }}T00:00:00Z</updated>
<icon>{{request.scheme}}://{{ request.site }}/static/assets/images/favicon.png</icon>
<author>
<name>{{ request.site.name }}</name>
<uri>{{request.scheme}}://{{request.site}}</uri>
</author>
{% block link_rel_self %}{% endblock%}
<link rel="start"
href="{{request.scheme}}://{{ request.site }}/opds/root.atom"
type="application/atom+xml;profile=opds-catalog;kind=navigation"/>
{% block content %}{% endblock %}
</feed>
24 changes: 24 additions & 0 deletions opds/templates/opds/root.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{% extends "opds/base.xml" %}
{% block id_and_title %}
<id>{{request.scheme}}://{{ request.site }}/opds/root.atom</id>
<title>EBook Catalogue of {{request.site.name}}</title>
{% endblock%}

{% block link_rel_self %}
<link rel="self"
title="Home"
href="{{request.scheme}}://{{ request.site }}/opds/root.atom"
type="application/atom+xml;profile=opds-catalog;kind=navigation"/>
{% endblock%}

{% block content %}
{% for serie in Series %}
<entry>
<title>{{ serie.name }}</title>
<link type="application/atom+xml;profile=opds-catalog;kind=navigation" rel="subsection" href="./{{ serie|lower }}.atom"/>
<updated>{{ Lastchange|date:"Y-m-d" }}T00:00:00Z</updated>
<id>{{request.scheme}}://{{ request.site }}/opds/{{ serie|lower }}.atom</id>
<content type="text">{{ serie.description }}</content>
</entry>
{% endfor %}
{% endblock %}
80 changes: 80 additions & 0 deletions opds/templates/opds/series.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{% extends "opds/base.xml" %}

{% block id_and_title %}
<id>{{request.scheme}}://{{ request.site }}/opds/{{ Series }}.atom</id>
<title>EBook Catalogue of {{request.site.name}} {{ Series|capfirst }}</title>
{% endblock%}

{% block link_rel_self %}
<link rel="self"
title="{{ Series|capfirst }}"
href="{{request.scheme}}://{{ request.site }}/opds/{{ Series }}.atom"
type="application/atom+xml;profile=opds-catalog;kind=navigation"/>
<link rel="up"
href="{{request.scheme}}://{{ request.site }}/opds/root.atom"
type="application/atom+xml;profile=opds-catalog;kind=navigation"/>
{% endblock%}

{% block content %}
{% for book in Books %}
<entry>
<title>{{ book.Title }}</title>
<id>{{request.scheme}}://{{ request.site }}/{{ book.Serie }}/{{ book.Number }}/index.html</id>
<dcterms:identifier xsi:type="dcterms:URI">urn:ISBN:{{ book.Isbn }}</dcterms:identifier>
{% if book.Publicationauthor1 %}
<author>
<name>{{ book.Publicationauthor1 }}</name>
<uri>{{request.scheme}}://{{ request.site }}/author/{{ book.Publicationauthor1number }}.html</uri>
</author>
{% endif %}
{% if book.Publicationauthor2 %}
<author>
<name>{{ book.Publicationauthor2 }}</name>
<uri>{{request.scheme}}://{{ request.site }}/author/{{ book.Publicationauthor2number }}.html</uri>
</author>
{% endif %}
{% if book.Publicationauthor3 %}
<author>
<name>{{ book.Publicationauthor3 }}</name>
<uri>{{request.scheme}}://{{ request.site }}/author/{{ book.Publicationauthor3number }}.html</uri>
</author>
{% endif %}
{% if book.Publicationauthor4 %}
<author>
<name>{{ book.Publicationauthor4 }}</name>
<uri>{{request.scheme}}://{{ request.site }}/author/{{ book.Publicationauthor4number }}.html</uri>
</author>
{% endif %}
{% if book.Publicationauthor5 %}
<author>
<name>{{ book.Publicationauthor5 }}</name>
<uri>{{request.scheme}}://{{ request.site }}/author/{{ book.Publicationauthor5number }}.html</uri>
</author>
{% endif %}
<published>{{ book.Datepublished |date:"Y-m-d" }}T00:00:00Z</published>
<updated>{{ book.Datepublished |date:"Y-m-d" }}T00:00:00Z</updated>
<dcterms:language>{{ book.Language }}</dcterms:language>
<dcterms:publisher>{{ request.site.name }}</dcterms:publisher>
<dcterms:issued>{{ book.Datepublished |date:"Y-m-d" }}</dcterms:issued>
<summary>{{ book.Descriptionlong }}</summary>
<category term="EOATB" scheme="{{request.scheme}}://{{ request.site }}/opds/categories" label="{{ Series|capfirst }}"/>
<link type="text/html" title="View on {{ reqeust.site.name }}" href="{{request.scheme}}://{{ request.site }}/{{ book.Serie }}/{{ book.Number }}/index.html" rel="alternate"/>
<link type="image/jpeg" href="{{request.scheme}}://{{ request.site }}/media/{{ book.Serie }}/{{ book.Number }}/Cover_medium.jpg" rel="http://opds-spec.org/image"/>
<link type="image/jpeg" href="{{request.scheme}}://{{ request.site }}/media/{{ book.Serie }}/{{ book.Number }}/Cover_small.jpg" rel="http://opds-spec.org/image/thumbnail"/>
{% if book.Shoplink %}
<link type="text/html" href="{{ book.Shoplink }}" rel="http://opds-spec.org/acquisition/buy">
<opds:price currencycode="EUR">{{ book.Price }}</opds:price>
<opds:indirectAcquisition type="application/vnd.adobe.adept+xml">
<opds:indirectAcquisition type="application/pdf"/>
</opds:indirectAcquisition>
</link>
{% endif %}
{% if book.Publicationebookfile %}
<link type="application/epub+zip" href="{{request.scheme}}://{{ request.site }}/media/{{ book.Publicationebookfile.name }}" rel="http://opds-spec.org/acquisition/open-access"/>
{% endif %}
{% if book.Publicationpdffile %}
<link type="application/pdf" href="{{request.scheme}}://{{ request.site }}/media/{{ book.Publicationpdffile.name }}" rel="http://opds-spec.org/acquisition/open-access"/>
{% endif %}
</entry>
{% endfor %}
{% endblock %}

0 comments on commit faacf38

Please sign in to comment.