--- /dev/null
+# Generated by Django 2.2.28 on 2022-09-27 23:24
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('catalogue', '0036_book_toc'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='bookmedia',
+ name='type',
+ field=models.CharField(choices=[('mp3', 'MP3 file'), ('ogg', 'Ogg Vorbis file'), ('daisy', 'DAISY file'), ('audio.epub', 'EPUB+audio file')], db_index=True, max_length=20, verbose_name='type'),
+ ),
+ ]
def get_daisy(self):
return self.get_media("daisy")
+ def get_audio_epub(self):
+ return self.get_media("audio.epub")
+
def media_url(self, format_):
media = self.get_media(format_)
if media:
has_daisy_file.short_description = 'DAISY'
has_daisy_file.boolean = True
+ def has_audio_epub_file(self):
+ return self.has_media("audio.epub")
+
@property
def media_daisy(self):
return self.get_media('daisy')
+ @property
+ def media_audio_epub(self):
+ return self.get_media('audio.epub')
+
def get_audiobooks(self):
ogg_files = {}
for m in self.media.filter(type='ogg').order_by().iterator():
('mp3', FileFormat(name='MP3', ext='mp3')),
('ogg', FileFormat(name='Ogg Vorbis', ext='ogg')),
('daisy', FileFormat(name='DAISY', ext='daisy.zip')),
+ ('audio.epub', FileFormat(name='EPUB+audio', ext='audio.epub')),
])
format_choices = [(k, _('%s file' % t.name)) for k, t in formats.items()]
</div>
</div>
{% endif %}
- {% if book.has_synchro_file %}
+ {% if book.has_audio_epub_file %}
<div class="c-media__popup__box__item">
<div>
- <h3>synchrobook</h3>
+ <h3>EPUB + audiobook</h3>
<p>Książka elektroniczna i audiobook w jednym. Wymaga aplikacji obsługującej format.</p>
</div>
<div>
- <a href="#" class="l-button l-button--media l-button--media--full">synchrobook</a>
+ {% for epub in book.media_audio_epub %}
+ <a href="{{ epub.file.url }}" class="l-button l-button--media l-button--media--full">EPUB+audio</a>
+ {% endfor %}
</div>
</div>
{% endif %}
if daisy and book.has_media('daisy'):
for dsy in book.get_media('daisy'):
links.append("<a href='%s'>%s</a>" % (dsy.file.url, BookMedia.formats['daisy'].name))
+ if daisy and book.has_media('audio.epub'):
+ for dsy in book.get_media('audio.epub'):
+ links.append("<a href='%s'>%s</a>" % (dsy.file.url, BookMedia.formats['audio.epub'].name))
return mark_safe("".join(links))