diff --git a/recipes/chicago_tribune.recipe b/recipes/chicago_tribune.recipe
index 8fa006b5da..6842dcff2a 100644
--- a/recipes/chicago_tribune.recipe
+++ b/recipes/chicago_tribune.recipe
@@ -8,21 +8,25 @@ from calibre.web.feeds.news import BasicNewsRecipe
class ChicagoTribune(BasicNewsRecipe):
title = 'Chicago Tribune'
- __author__ = 'Kovid Goyal and Sujata Raman'
+ __author__ = 'Kovid Goyal and Sujata Raman, a.peter'
description = 'Politics, local and business news from Chicago'
- language = 'en'
+ language = 'en'
+ version = 2
- use_embedded_content = False
- no_stylesheets = True
- remove_javascript = True
+ use_embedded_content = False
+ no_stylesheets = True
+ remove_javascript = True
+ recursions = 1
keep_only_tags = [dict(name='div', attrs={'class':["story","entry-asset asset hentry"]}),
dict(name='div', attrs={'id':["pagebody","story","maincontentcontainer"]}),
]
- remove_tags_after = [ {'class':['photo_article',]} ]
+ remove_tags_after = [{'class':['photo_article',]}]
- remove_tags = [{'id':["moduleArticleTools","content-bottom","rail","articleRelates module","toolSet","relatedrailcontent","div-wrapper","beta","atp-comments","footer"]},
- {'class':["clearfix","relatedTitle","articleRelates module","asset-footer","tools","comments","featurePromo","featurePromo fp-topjobs brownBackground","clearfix fullSpan brownBackground","curvedContent"]},
+ match_regexps = [r'page=[0-9]+']
+
+ remove_tags = [{'id':["moduleArticleTools","content-bottom","rail","articleRelates module","toolSet","relatedrailcontent","div-wrapper","beta","atp-comments","footer",'gallery-subcontent','subFooter']},
+ {'class':["clearfix","relatedTitle","articleRelates module","asset-footer","tools","comments","featurePromo","featurePromo fp-topjobs brownBackground","clearfix fullSpan brownBackground","curvedContent",'nextgen-share-tools','outbrainTools', 'google-ad-story-bottom']},
dict(name='font',attrs={'id':["cr-other-headlines"]})]
extra_css = '''
h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
@@ -37,7 +41,7 @@ class ChicagoTribune(BasicNewsRecipe):
.maincontentcontainer{font-family:Arial,Helvetica,sans-serif;font-size:small;}
.story-body{font-family:Arial,Helvetica,sans-serif;font-size:small;}
body{font-family:Helvetica,Arial,sans-serif;font-size:small;}
- '''
+ '''
feeds = [
('Latest news', 'http://feeds.chicagotribune.com/chicagotribune/news/'),
('Local news', 'http://feeds.chicagotribune.com/chicagotribune/news/local/'),
@@ -76,8 +80,12 @@ class ChicagoTribune(BasicNewsRecipe):
print article.get('feedburner_origlink', article.get('guid', article.get('link')))
return article.get('feedburner_origlink', article.get('guid', article.get('link')))
-
def postprocess_html(self, soup, first_fetch):
+ # Remove the navigation bar. It was kept until now to be able to follow
+ # the links to further pages. But now we don't need them anymore.
+ for nav in soup.findAll(attrs={'class':['toppaginate','article-nav clearfix']}):
+ nav.extract()
+
for t in soup.findAll(['table', 'tr', 'td']):
t.name = 'div'
@@ -88,4 +96,3 @@ class ChicagoTribune(BasicNewsRecipe):
return soup
-
diff --git a/recipes/folhadesaopaulo_sub.recipe b/recipes/folhadesaopaulo_sub.recipe
index 660275330a..31ffb2db66 100644
--- a/recipes/folhadesaopaulo_sub.recipe
+++ b/recipes/folhadesaopaulo_sub.recipe
@@ -1,19 +1,21 @@
from calibre.web.feeds.news import BasicNewsRecipe
+import re
+
class FSP(BasicNewsRecipe):
- title = u'Folha de S\xE3o Paulo - Jornal'
+ title = u'Folha de S\xE3o Paulo'
__author__ = 'fluzao'
description = u'Printed edition contents. UOL subscription required (Folha subscription currently not supported).' + \
u' [Conte\xfado completo da edi\xe7\xe3o impressa. Somente para assinantes UOL.]'
INDEX = 'http://www1.folha.uol.com.br/fsp/indices/'
language = 'pt'
no_stylesheets = True
- max_articles_per_feed = 30
+ max_articles_per_feed = 40
remove_javascript = True
needs_subscription = True
remove_tags_before = dict(name='b')
- remove_tags_after = dict(name='!--/NOTICIA--')
+ remove_tags = [dict(name='td', attrs={'align':'center'})]
remove_attributes = ['height','width']
masthead_url = 'http://f.i.uol.com.br/fsp/furniture/images/lgo-fsp-430x50-ffffff.gif'
@@ -26,6 +28,13 @@ class FSP(BasicNewsRecipe):
# this solves the problem with truncated content in Kindle
conversion_options = {'linearize_tables' : True}
+ # this bit removes the footer where there are links for Proximo Texto, Texto Anterior,
+ # Indice e Comunicar Erros
+ preprocess_regexps = [(re.compile(r'
Texto Anterior:.*',
+ re.DOTALL|re.IGNORECASE), lambda match: r''),
+ (re.compile(r'
Próximo Texto:.*',
+ re.DOTALL|re.IGNORECASE), lambda match: r'')]
+
def get_browser(self):
br = BasicNewsRecipe.get_browser()
if self.username is not None and self.password is not None:
diff --git a/recipes/leipzer_volkszeitung.recipe b/recipes/leipzer_volkszeitung.recipe
new file mode 100644
index 0000000000..807ec5282e
--- /dev/null
+++ b/recipes/leipzer_volkszeitung.recipe
@@ -0,0 +1,34 @@
+from calibre.web.feeds.recipes import BasicNewsRecipe
+
+'''Calibre recipe to convert the RSS feeds of the Leipziger Volkszeitung to an ebook.'''
+
+class SportsIllustratedRecipe(BasicNewsRecipe) :
+ __author__ = 'a.peter'
+ __copyright__ = 'a.peter'
+ __license__ = 'GPL v3'
+ language = 'de'
+ description = 'Leipziger Volkszeitung Online RSS'
+ version = 1
+ title = u'Leipziger Volkszeitung Online RSS'
+ timefmt = ' [%d.%m.%Y]'
+
+ no_stylesheets = True
+ remove_javascript = True
+ use_embedded_content = False
+ publication_type = 'newspaper'
+
+ keep_only_tags = [dict(name='div', attrs={'class':'article'})]
+ remove_tags = [dict(name='div', attrs={'class':['ARTICLE_MORE', 'clearfloat']})]
+
+ feeds = [(u'Leipzig', u'http://nachrichten.lvz-online.de/rss/leipzig-rss.xml'),
+ (u'Mitteldeutschland', u'http://nachrichten.lvz-online.de/rss/mitteldeutschland-rss.xml'),
+ (u'Brennpunkte', u'http://nachrichten.lvz-online.de/rss/brennpunkte-rss.xml'),
+ (u'Polizeiticker', u'http://nachrichten.lvz-online.de/rss/polizeiticker-rss.xml'),
+ (u'Boulevard', u'http://nachrichten.lvz-online.de/rss/boulevard-rss.xml'),
+ (u'Kultur', u'http://nachrichten.lvz-online.de/rss/kultur-rss.xml'),
+ (u'Sport', u'http://nachrichten.lvz-online.de/rss/sport-rss.xml'),
+ (u'Regionalsport', u'http://nachrichten.lvz-online.de/rss/regionalsport-rss.xml'),
+ (u'Knipser', u'http://nachrichten.lvz-online.de/rss/knipser-rss.xml')]
+
+ def get_masthead_url(self):
+ return 'http://www.lvz-online.de/resources/themes/standard/images/global/logo.gif'
diff --git a/src/calibre/db/__init__.py b/src/calibre/db/__init__.py
index 826b7a99fd..cde01b5f01 100644
--- a/src/calibre/db/__init__.py
+++ b/src/calibre/db/__init__.py
@@ -64,4 +64,6 @@ Various things that require other things before they can be migrated:
columns/categories/searches info into
self.field_metadata. Finally, implement metadata dirtied
functionality.
+ 2. Catching DatabaseException and sqlite.Error when creating new
+ libraries/switching/on calibre startup.
'''
diff --git a/src/calibre/ebooks/conversion/utils.py b/src/calibre/ebooks/conversion/utils.py
index eabeba7b4f..cbc8b41529 100644
--- a/src/calibre/ebooks/conversion/utils.py
+++ b/src/calibre/ebooks/conversion/utils.py
@@ -315,7 +315,7 @@ class HeuristicProcessor(object):
supports a range of html markup and text files
'''
# define the pieces of the regex
-
+
lookahead = "(?<=.{"+str(length)+u"}([a-zäëïöüàèìòùáćéíĺóŕńśúýâêîôûçąężıãõñæøþðßěľščťžňďřů,:“”)\IA\u00DF]|(?]*>\s*
\s*', '
'+
@@ -102,14 +117,21 @@ def restore_database(db, parent=None):
_('Restoring database failed, click Show details to see details'),
det_msg=r.tb, show=True)
else:
- if r.errors_occurred:
- warning_dialog(parent, _('Success'),
- _('Restoring the database succeeded with some warnings'
- ' click Show details to see the details.'),
- det_msg=r.report, show=True)
- else:
- info_dialog(parent, _('Success'),
- _('Restoring database was successful'), show=True,
- show_copy_button=False)
+ _show_success_msg(r, parent=parent)
return True
+def repair_library_at(library_path, parent=None):
+ d = DBRestore(parent, library_path)
+ d.exec_()
+ if d.rejected:
+ return False
+ r = d.restorer
+ if r.tb is not None:
+ error_dialog(parent, _('Failed'),
+ _('Restoring database failed, click Show details to see details'),
+ det_msg=r.tb, show=True)
+ return False
+ _show_success_msg(r, parent=parent)
+ return True
+
+
diff --git a/src/calibre/gui2/main.py b/src/calibre/gui2/main.py
index 76b734a718..81324d31f8 100644
--- a/src/calibre/gui2/main.py
+++ b/src/calibre/gui2/main.py
@@ -4,16 +4,15 @@ __copyright__ = '2008, Kovid Goyal