mirror of
https://github.com/kovidgoyal/calibre.git
synced 2026-06-07 14:35:27 -04:00
New recipe for India Today and improved recipe for The Independent
This commit is contained in:
@@ -819,10 +819,14 @@ class BasicNewsRecipe(Recipe):
|
||||
if '?' in ext:
|
||||
ext = ''
|
||||
ext = ext.lower() if ext else 'jpg'
|
||||
self.report_progress(1, _('Downloading cover from %s')%cu)
|
||||
cpath = os.path.join(self.output_dir, 'cover.'+ext)
|
||||
with nested(open(cpath, 'wb'), closing(self.browser.open(cu))) as (cfile, r):
|
||||
cfile.write(r.read())
|
||||
if os.access(cu, os.R_OK):
|
||||
with open(cpath, 'wb') as cfile:
|
||||
cfile.write(open(cu, 'rb').read())
|
||||
else:
|
||||
self.report_progress(1, _('Downloading cover from %s')%cu)
|
||||
with nested(open(cpath, 'wb'), closing(self.browser.open(cu))) as (cfile, r):
|
||||
cfile.write(r.read())
|
||||
if ext.lower() == 'pdf':
|
||||
from calibre.ebook.metadata.pdf import get_metadata
|
||||
stream = open(cpath, 'rb')
|
||||
|
||||
Reference in New Issue
Block a user