def start_download(self, request): if not self.gui: return url = unicode(request.url().toString(NO_URL_FORMATTING)) cf = self.get_cookies() filename = get_download_filename(url, cf) ext = os.path.splitext(filename)[1][1:].lower() filename = ascii_filename(filename[:60] + '.' + ext) if ext not in BOOK_EXTENSIONS: if ext == 'acsm': from calibre.gui2.dialogs.confirm_delete import confirm if not confirm('<p>' + _('This ebook is a DRMed EPUB file. ' 'You will be prompted to save this file to your ' 'computer. Once it is saved, open it with ' '<a href="https://www.adobe.com/products/digitaleditions/">' 'Adobe Digital Editions</a> (ADE).<p>ADE, in turn ' 'will download the actual ebook, which will be a ' '.epub file. You can add this book to calibre ' 'using "Add Books" and selecting the file from ' 'the ADE library folder.'), 'acsm_download', self): return name = choose_save_file(self, 'web-store-download-unknown', _('File is not a supported ebook type. Save to disk?'), initial_filename=filename) if name: self.gui.download_ebook(url, cf, name, name, False, create_browser=self.create_browser) else: show_download_info(filename, self) self.gui.download_ebook(url, cf, filename, tags=self.tags, create_browser=self.create_browser)
def download_book(self, result): d = ChooseFormatDialog(self, _('Choose format to download to your library.'), result.downloads.keys()) if d.exec_() == d.Accepted: ext = d.format() fname = result.title[:60] + '.' + ext.lower() fname = ascii_filename(fname) show_download_info(result.title, parent=self) self.gui.download_ebook(result.downloads[ext], filename=fname, create_browser=result.create_browser)
def download_book(self, result): d = ChooseFormatDialog(self, _('Choose format to download to your library.'), list(result.downloads.keys())) if d.exec_() == QDialog.DialogCode.Accepted: ext = d.format() fname = result.title[:60] + '.' + ext.lower() fname = ascii_filename(fname) show_download_info(result.title, parent=self) self.gui.download_ebook(result.downloads[ext], filename=fname, create_browser=result.create_browser)