diff --git a/resources/recipes/hbr.recipe b/resources/recipes/hbr.recipe index 10f4c580d1..7c91837529 100644 --- a/resources/recipes/hbr.recipe +++ b/resources/recipes/hbr.recipe @@ -1,4 +1,5 @@ from calibre.web.feeds.news import BasicNewsRecipe +import re class HBR(BasicNewsRecipe): @@ -7,8 +8,8 @@ class HBR(BasicNewsRecipe): needs_subscription = True __author__ = 'Kovid Goyal' timefmt = ' [%B %Y]' - no_stylesheets = True - + no_stylesheets = True + LOGIN_URL = 'http://hbr.harvardbusiness.org/login?request_url=/' INDEX = 'http://hbr.harvardbusiness.org/current' @@ -19,7 +20,15 @@ class HBR(BasicNewsRecipe): 'contentRight', 'summaryLink']), dict(name='form'), ] - + + extra_css = ''' + a {font-family:Georgia,"Times New Roman",Times,serif; font-style:italic; color:#000000; } + .article{font-family:Georgia,"Times New Roman",Times,serif; font-size: xx-small;} + h2{font-family:Georgia,"Times New Roman",Times,serif; font-weight:bold; font-size:large; } + h4{font-family:Georgia,"Times New Roman",Times,serif; font-weight:bold; font-size:small; } + #articleAuthors{font-family:Georgia,"Times New Roman",Times,serif; font-style:italic; color:#000000;font-size:x-small;} + #summaryText{font-family:Georgia,"Times New Roman",Times,serif; font-weight:bold; font-size:x-small;} + ''' def get_browser(self): br = BasicNewsRecipe.get_browser(self) @@ -86,4 +95,15 @@ class HBR(BasicNewsRecipe): feeds.extend(self.get_departments(soup)) return feeds - + def get_cover_url(self): + cover_url = None + index = 'http://hbr.harvardbusiness.org/current' + soup = self.index_to_soup(index) + link_item = soup.find('img', alt=re.compile("HBR Cover Image"), src=True) + + if link_item: + cover_url = 'http://hbr.harvardbusiness.org' + link_item['src'] + + return cover_url + + diff --git a/src/calibre/ebooks/oeb/base.py b/src/calibre/ebooks/oeb/base.py index b86819a441..77cef0d22c 100644 --- a/src/calibre/ebooks/oeb/base.py +++ b/src/calibre/ebooks/oeb/base.py @@ -777,7 +777,7 @@ class Manifest(object): # Remove DOCTYPE declaration as it messes up parsing - # Inparticular it causes tostring to insert xmlns + # In particular, it causes tostring to insert xmlns # declarations, which messes up the coercing logic idx = data.find(' -1: diff --git a/src/calibre/gui2/tag_view.py b/src/calibre/gui2/tag_view.py index 48e344890b..12b1856b82 100644 --- a/src/calibre/gui2/tag_view.py +++ b/src/calibre/gui2/tag_view.py @@ -47,7 +47,10 @@ class TagsView(QTreeView): ci = self.currentIndex() if not ci.isValid(): ci = self.indexAt(QPoint(10, 10)) - self.model().refresh() + try: + self.model().refresh() + except: #Database connection could be closed if an integrity check is happening + pass if ci.isValid(): self.scrollTo(ci, QTreeView.PositionAtTop) diff --git a/src/calibre/linux.py b/src/calibre/linux.py index f8beafc94d..b66c2ff49d 100644 --- a/src/calibre/linux.py +++ b/src/calibre/linux.py @@ -115,7 +115,7 @@ class PostInstall: self.info('Creating symlinks...') for exe in scripts.keys(): dest = os.path.join(self.opts.staging_bindir, exe) - if os.path.exists(dest): + if os.path.lexists(dest): os.unlink(dest) tgt = os.path.join(getattr(sys, 'frozen_path'), exe) self.info('\tSymlinking %s to %s'%(tgt, dest))