- def zip_audiobooks(self, format_):
- bm = BookMedia.objects.filter(book=self, type=format_)
- paths = map(lambda bm: (bm.get_nice_filename(), bm.file.path), bm)
- licenses = set()
- for m in bm:
- license = constants.LICENSES.get(
- m.get_extra_info_json().get('license'), {}
- ).get('locative')
- if license:
- licenses.add(license)
- readme = render_to_string('catalogue/audiobook_zip_readme.txt', {
- 'licenses': licenses,
- 'meta': self.wldocument2().meta,
- })
- return create_zip(paths, "%s_%s" % (self.slug, format_), {'informacje.txt': readme})
-