Beispiel #1
0
    def render_download_options(self,
                                edition: Edition,
                                extra_args: list = None):
        if edition.is_access_restricted() or not edition.ia_metadata:
            return ''

        formats = {
            'pdf': edition.get_ia_download_link('.pdf'),
            'epub': edition.get_ia_download_link('.epub'),
            'mobi': edition.get_ia_download_link('.mobi'),
            'txt': edition.get_ia_download_link('_djvu.txt'),
        }

        if any(formats.values()):
            return render_template(
                self.get_template_path('download_options'),
                formats,
                edition.url('/daisy'),
            )
        else:
            return ''
Beispiel #2
0
 def render_download_options(self,
                             edition: Edition,
                             extra_args: list = None):
     # The template also needs the ocaid, since some of the files are hosted on IA
     return super().render_download_options(edition, [edition.get('ocaid')])