From: Jan Szejko Date: Wed, 16 Mar 2016 09:22:15 +0000 (+0100) Subject: images in epub/mobi X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/15bfd31759c7454aaceaf7107ef07718e662724a images in epub/mobi --- diff --git a/apps/catalogue/locale/pl/LC_MESSAGES/django.mo b/apps/catalogue/locale/pl/LC_MESSAGES/django.mo index 17689b80..8c88b6b0 100644 Binary files a/apps/catalogue/locale/pl/LC_MESSAGES/django.mo and b/apps/catalogue/locale/pl/LC_MESSAGES/django.mo differ diff --git a/apps/catalogue/locale/pl/LC_MESSAGES/django.po b/apps/catalogue/locale/pl/LC_MESSAGES/django.po index 64ddd9f4..67f10ef8 100644 --- a/apps/catalogue/locale/pl/LC_MESSAGES/django.po +++ b/apps/catalogue/locale/pl/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Platforma Redakcyjna\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-03-27 13:16+0100\n" +"POT-Creation-Date: 2016-03-15 18:38+0100\n" "PO-Revision-Date: 2014-03-27 13:17+0100\n" "Last-Translator: Radek Czajka \n" "Language-Team: Fundacja Nowoczesna Polska {% trans "TXT version" %}
{% trans "PDF version" %}
{% trans "EPUB version" %}
+ {% trans "MOBI version" %}

{% if user.is_authenticated %} diff --git a/apps/catalogue/urls.py b/apps/catalogue/urls.py index 908144f1..a09dd120 100644 --- a/apps/catalogue/urls.py +++ b/apps/catalogue/urls.py @@ -40,6 +40,7 @@ urlpatterns = patterns('catalogue.views', url(r'^book/(?P[^/]+)/txt$', 'book_txt', name="catalogue_book_txt"), url(r'^book/(?P[^/]+)/html$', 'book_html', name="catalogue_book_html"), url(r'^book/(?P[^/]+)/epub$', 'book_epub', name="catalogue_book_epub"), + url(r'^book/(?P[^/]+)/mobi$', 'book_mobi', name="catalogue_book_mobi"), url(r'^book/(?P[^/]+)/pdf$', 'book_pdf', name="catalogue_book_pdf"), url(r'^chunk_add/(?P[^/]+)/(?P[^/]+)/$', diff --git a/apps/catalogue/views.py b/apps/catalogue/views.py index 0eac8ded..84cc0972 100644 --- a/apps/catalogue/views.py +++ b/apps/catalogue/views.py @@ -274,13 +274,29 @@ def book_epub(request, slug): # TODO: move to celery doc = book.wldocument() # TODO: error handling - epub = doc.as_epub().get_string() + epub = doc.as_epub(ilustr_path=book.gallery_path()).get_string() response = HttpResponse(content_type='application/epub+zip') response['Content-Disposition'] = 'attachment; filename=%s' % book.slug + '.epub' response.write(epub) return response +@never_cache +def book_mobi(request, slug): + book = get_object_or_404(Book, slug=slug) + if not book.accessible(request): + return HttpResponseForbidden("Not authorized.") + + # TODO: move to celery + doc = book.wldocument() + # TODO: error handling + mobi = doc.as_mobi(ilustr_path=book.gallery_path()).get_string() + response = HttpResponse(content_type='application/x-mobipocket-ebook') + response['Content-Disposition'] = 'attachment; filename=%s' % book.slug + '.mobi' + response.write(mobi) + return response + + @never_cache def revision(request, slug, chunk=None): try: diff --git a/lib/librarian b/lib/librarian index 3acdb97e..3f616438 160000 --- a/lib/librarian +++ b/lib/librarian @@ -1 +1 @@ -Subproject commit 3acdb97ed96bb54a04c031e017c2059f86db57e4 +Subproject commit 3f6164384bfd12f173e5f38835ce8a5cfb8b282a