Skip to content
Snippets Groups Projects
Commit dd689d0f authored by Dmitry Shelepnev's avatar Dmitry Shelepnev
Browse files

add NOZIP_FORMATS settings in opds_catalog and use with for epub and mobi....

add NOZIP_FORMATS settings in opds_catalog and use with for epub and mobi. Update Enclosure generation in CatalogsFeed
parent 7d421a76
No related branches found
No related tags found
No related merge requests found
......@@ -293,12 +293,19 @@ class CatalogsFeed(AuthFeed):
if item['is_catalog']:
return (opdsEnclosure(reverse("opds_catalog:cat_tree", kwargs={"cat_id":item['id']}),"application/atom+xml;profile=opds-catalog;kind=navigation", "subsection"),)
else:
return (
enclosure = [
opdsEnclosure(reverse("opds_catalog:download", kwargs={"book_id":item['id'],"zip_flag":0}),"application/%s"%item['format'] ,"http://opds-spec.org/acquisition/open-access"),
opdsEnclosure(reverse("opds_catalog:download", kwargs={"book_id":item['id'],"zip_flag":1}),"application/%s+zip"%item['format'], "http://opds-spec.org/acquisition/open-access"),
opdsEnclosure(reverse("opds_catalog:cover", kwargs={"book_id":item['id']}),"image/jpeg", "http://opds-spec.org/image"),
opdsEnclosure(reverse("opds_catalog:thumb", kwargs={"book_id": item['id']}), "image/jpeg","http://opds-spec.org/thumbnail"),
)
]
if (config.SOPDS_FB2TOEPUB!="") and (item['format']=='fb2'):
enclosure += [opdsEnclosure(reverse("opds_catalog:convert", kwargs={"book_id":item['id'],"convert_type":"epub"}),"application/epub+zip","http://opds-spec.org/acquisition/open-access")]
if (config.SOPDS_FB2TOMOBI!="") and (item['format']=='fb2'):
enclosure += [opdsEnclosure(reverse("opds_catalog:convert", kwargs={"book_id":item['id'],"convert_type":"mobi"}),"application/mobi","http://opds-spec.org/acquisition/open-access")]
return enclosure
def item_description(self, item):
if item['is_catalog']:
......
......@@ -5,6 +5,7 @@ from django.utils import translation
from constance import config
loglevels={'debug':logging.DEBUG,'info':logging.INFO,'warning':logging.WARNING,'error':logging.ERROR,'critical':logging.CRITICAL,'none':logging.NOTSET}
NOZIP_FORMATS = ['epub', 'mobi']
VERSION = "0.42-dev"
TITLE = getattr(settings, "SOPDS_TITLE", "SimpleOPDS")
......
......@@ -48,7 +48,9 @@
<b>{{ b.title }}</b>
<i style="font-size:80%;">{% trans "Download:" %} </i>
<i><a href="{% url 'opds_catalog:download' b.id 0 %}"><span class="label small">{{b.format}}</span></a></i>&nbsp;
{% if not b.format in nozip %}
<i><a href="{% url 'opds_catalog:download' b.id 1 %}"><span class="label small">{{b.format}}+zip</span></a></i>&nbsp;
{% endif %}
{% if b.format == 'fb2' and fb2toepub %}
<i><a href="{% url 'opds_catalog:convert' b.id 'epub' %}"><span class="label small">epub</span></a></i>&nbsp;
{% endif %}
......
......@@ -35,6 +35,8 @@ def sopds_processor(request):
args['splititems'] = config.SOPDS_SPLITITEMS
args['fb2tomobi'] = (config.SOPDS_FB2TOMOBI!="")
args['fb2toepub'] = (config.SOPDS_FB2TOEPUB!="")
args['nozip'] = settings.NOZIP_FORMATS
if config.SOPDS_ALPHABET_MENU:
args['lang_menu'] = lang_menu
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment