From: Guillaume Pellerin Date: Mon, 25 May 2015 22:05:58 +0000 (+0200) Subject: add EPUB exporter X-Git-Tag: 1.6a~4^2~46 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=b8e8bd4837dc1d59b379cd944828c0ecda6f1fbc;p=telemeta.git add EPUB exporter --- diff --git a/telemeta/management/commands/telemeta-export-corpus-epub.py b/telemeta/management/commands/telemeta-export-corpus-epub.py new file mode 100644 index 00000000..6c8cc58c --- /dev/null +++ b/telemeta/management/commands/telemeta-export-corpus-epub.py @@ -0,0 +1,25 @@ +from optparse import make_option +from django.conf import settings +from django.core.management.base import BaseCommand, CommandError +from django.contrib.auth.models import User +from django.template.defaultfilters import slugify + +import os +import timeside.core +from timeside.server.models import * +from timeside.core.tools.test_samples import generateSamples +from telemeta.models import * +from telemeta.views.epub import * + + +class Command(BaseCommand): + help = "Export all collections of a corpus and itself to EPUB3 files in cache" + + def handle(self, *args, **options): + corpus_id = args[-1] + corpus = MediaCorpus.objects.get(public_id=corpus_id) + book = BaseEpubMixin() + book.write_book(corpus) + for collection in corpus.children.all(): + book = BaseEpubMixin() + book.write_book(corpus, collection=collection) diff --git a/telemeta/views/epub.py b/telemeta/views/epub.py index 89627009..2537351c 100644 --- a/telemeta/views/epub.py +++ b/telemeta/views/epub.py @@ -67,7 +67,6 @@ class BaseEpubMixin(TelemetaBaseMixin): # add metadata self.book.set_identifier(corpus.public_id) - self.book.set_title(corpus.title + ' - ' + collection.title) self.book.set_language('fr') self.book.add_author(corpus.descriptions)