New recipe for India Today and improved recipe for The Independent

This commit is contained in:
Kovid Goyal
2009-12-30 22:56:07 -07:00
parent 7333cc7319
commit 4b66da2fe6
3 changed files with 132 additions and 23 deletions
+7 -3
View File
@@ -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')