]> git.parisson.com Git - telemeta.git/commitdiff
add EPUB exporter
authorGuillaume Pellerin <yomguy@parisson.com>
Mon, 25 May 2015 22:05:58 +0000 (00:05 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Mon, 25 May 2015 22:05:58 +0000 (00:05 +0200)
telemeta/management/commands/telemeta-export-corpus-epub.py [new file with mode: 0644]
telemeta/views/epub.py

diff --git a/telemeta/management/commands/telemeta-export-corpus-epub.py b/telemeta/management/commands/telemeta-export-corpus-epub.py
new file mode 100644 (file)
index 0000000..6c8cc58
--- /dev/null
@@ -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)
index 8962700986269068742e8816cb2560105cc0f741..2537351c88de90f7fa5564fd20ba226712c06852 100644 (file)
@@ -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)