- def item_enclosure_url(self, book):
- return full_url(book.epub_url()) if book.epub_file else None
-
- def item_enclosure_length(self, book):
- return book.epub_file.size if book.epub_file else None
+ def item_enclosures(self, book):
+ enc = []
+ if book.epub_file:
+ enc.append(Enclosure(
+ url=full_url(book.epub_url()),
+ length=book.epub_file.size,
+ mime_type="application/epub+zip"
+ ))
+ if book.has_mp3_file():
+ e = Enclosure(
+ url=full_url(reverse('download_zip_mp3', args=[book.slug])),
+ length=sum(bm.file.size for bm in book.get_media('mp3')),
+ mime_type="application/zip"
+ )
+ e.indirect = 'audio/mpeg'
+ enc.append(e)
+ return enc