2 # -*- coding: utf-8 -*-
3 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
4 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
8 sys.path.append('./apps')
9 sys.path.append('./lib')
11 from django.core.management import setup_environ
12 from redakcja import settings
14 setup_environ(settings)
16 from catalogue.models import Book, Chunk
19 if len(sys.argv) != 3:
20 print "dump-book slug-part filename"
25 books = Book.objects.filter(slug__contains=term)
27 for b in range(len(books)):
28 print "%d) %s" % (b+1, books[b].slug)
35 open(sys.argv[2], "w").write(book.materialize().encode('utf-8'))