X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/1345cca1d38dcb02b6d9091d36618524cddc6cc9..d60f44f5eceafa25705d55044ae1b11aceb28187:/scripts/make-xml-zip.py?ds=inline diff --git a/scripts/make-xml-zip.py b/scripts/make-xml-zip.py new file mode 100755 index 000000000..d8b3dde88 --- /dev/null +++ b/scripts/make-xml-zip.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# +import sys +sys.path.insert(0, '../apps') +sys.path.insert(0, '../lib') +sys.path.insert(0, '../lib/librarian') +sys.path.insert(0, '../wolnelektury') +sys.path.insert(0, '..') + +from django.core.management import setup_environ +from wolnelektury import settings +import sys +import zipfile + +setup_environ(settings) + +from catalogue.models import Book + + +if len(sys.argv) < 2: + print "Provide a zip name as first argument" + sys.exit(-1) + +zip = zipfile.ZipFile(sys.argv[1], 'w') +for book in Book.objects.all(): + zip.write(book.xml_file.path, "%s.xml" % book.slug) +zip.close() +