- if 'mp3' in formats and book.mp3_file:
- filename = book.mp3_file.path
- archive.write(filename, str('%s.mp3' % book.slug))
- if 'ogg' in formats and book.ogg_file:
- filename = book.ogg_file.path
- archive.write(filename, str('%s.ogg' % book.slug))
+ if 'mp3' in formats and book.has_media("mp3"):
+ for file in book.get_media("mp3"):
+ filename = file.file.path
+ archive.write(filename, str('%s.mp3' % slughifi(file.name)))
+ if 'ogg' in formats and book.has_media("ogg"):
+ for file in book.get_media("ogg"):
+ filename = file.file.path
+ archive.write(filename, str('%s.ogg' % slughifi(file.name)))
+ if 'daisy' in formats and book.has_media("daisy"):
+ for file in book.get_media("daisy"):
+ filename = file.file.path
+ archive.write(filename, str('%s.daisy' % slughifi(file.name)))