diff --git a/Changelog.yaml b/Changelog.yaml index bd1d2d9294..062f04da41 100644 --- a/Changelog.yaml +++ b/Changelog.yaml @@ -44,7 +44,7 @@ - title: "MOBI Output: Fix a memory leak and a crash in the palmdoc compression routine" - - title: "Metadata download: Fix a regressiont at resulted in a failed download for some books" + - title: "Metadata download: Fix a regression that resulted in a failed download for some books" new recipes: - title: "Foreign Policy and Alo!" diff --git a/resources/images/add_book.svg b/resources/images/add_book.svg index b0633d48d3..54a9f05b68 100644 --- a/resources/images/add_book.svg +++ b/resources/images/add_book.svg @@ -1,2404 +1,111 @@ - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + version="1.1" + id="Layer_1" + x="0px" + y="0px" + width="149.5" + height="201" + viewBox="0 0 149.49999 201" + enable-background="new 0 0 595.28 841.89" + xml:space="preserve" + inkscape:version="0.47 r22583" + sodipodi:docname="add_book.svg">image/svg+xml + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/images/config.svg b/resources/images/config.svg index d631d36aa4..28660a4eea 100644 --- a/resources/images/config.svg +++ b/resources/images/config.svg @@ -1,1523 +1,208 @@ - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + version="1.1" + id="Layer_1" + x="0px" + y="0px" + width="149.86" + height="195.22701" + viewBox="0 0 149.85999 195.227" + enable-background="new 0 0 595.28 841.89" + xml:space="preserve" + inkscape:version="0.47 r22583" + sodipodi:docname="config.svg">image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/images/convert.svg b/resources/images/convert.svg index cd18d49cf9..f318fc9c75 100644 --- a/resources/images/convert.svg +++ b/resources/images/convert.svg @@ -1,834 +1,142 @@ - + + image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + inkscape:zoom="0.28032165" + inkscape:cx="75.583001" + inkscape:cy="99.722002" + inkscape:window-x="0" + inkscape:window-y="41" + inkscape:window-maximized="0" + inkscape:current-layer="Isolation_Mode" /> + + - - - - - - - - - - - - - - - - - -image/svg+xml - - - + - - - - - - - - - - - - - - - - - - - - - - + - - - + + + + + + + + + + - + - + - - - + + + - + - + - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + style="stop-color:#000000" + id="stop36" /> + + + + + \ No newline at end of file diff --git a/resources/images/edit_input.svg b/resources/images/edit_input.svg index a2d8bc96e2..90d61917ee 100644 --- a/resources/images/edit_input.svg +++ b/resources/images/edit_input.svg @@ -1,1071 +1,80 @@ - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - Oxygen team - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + version="1.1" + id="Layer_1" + x="0px" + y="0px" + width="207.38489" + height="201.668" + viewBox="0 0 207.38488 201.668" + enable-background="new 0 0 595.28 841.89" + xml:space="preserve" + inkscape:version="0.47 r22583" + sodipodi:docname="edit_input.svg">image/svg+xml + + + + + + + + + \ No newline at end of file diff --git a/resources/images/news.svg b/resources/images/news.svg index 38016738f5..e4a1b1832a 100644 --- a/resources/images/news.svg +++ b/resources/images/news.svg @@ -1,2826 +1,94 @@ - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - Oxygen team - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + version="1.1" + id="Layer_1" + x="0px" + y="0px" + width="134.77701" + height="199.99901" + viewBox="0 0 134.777 199.999" + enable-background="new 0 0 595.28 841.89" + xml:space="preserve" + inkscape:version="0.47 r22583" + sodipodi:docname="news.svg">image/svg+xml + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/images/save.svg b/resources/images/save.svg index af62235cfc..14a431e60a 100644 --- a/resources/images/save.svg +++ b/resources/images/save.svg @@ -1,1961 +1,124 @@ - + + image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + inkscape:window-y="41" + inkscape:window-maximized="0" + inkscape:current-layer="Layer_1" /> + + - - - - - - - - - - - - - - - - - - - - - - - - - - + d="m 355.763,325.697 h -116.49 c -4.664,0 -8.445,3.782 -8.445,8.446 V 512.22 c 0,4.664 3.781,8.446 8.445,8.446 h 116.489 c 4.665,0 8.446,-3.782 8.446,-8.446 V 334.144 c 10e-4,-4.665 -3.78,-8.447 -8.445,-8.447 z m -106.283,19.004 59.827,-2.111 c 0,39.416 -58.068,57.364 -59.827,57.364 -1.759,0 0,-55.253 0,-55.253 z m -7.742,166.112 c -1.945,0 -3.521,-1.576 -3.521,-3.52 0,-1.944 1.575,-3.52 3.521,-3.52 1.942,0 3.519,1.575 3.519,3.52 0,1.944 -1.576,3.52 -3.519,3.52 z m 0,-84.112 c -1.945,0 -3.521,-1.575 -3.521,-3.519 0,-1.944 1.575,-3.52 3.521,-3.52 1.942,0 3.519,1.575 3.519,3.52 0,1.944 -1.576,3.519 -3.519,3.519 z m 0,-84.111 c -1.945,0 -3.521,-1.576 -3.521,-3.519 0,-1.944 1.575,-3.52 3.521,-3.52 1.942,0 3.519,1.576 3.519,3.52 0,1.943 -1.576,3.519 -3.519,3.519 z m 56.23,164.704 c -27.212,0 -49.271,-22.06 -49.271,-49.271 0,-26.822 21.438,-48.623 48.112,-49.241 24.819,-21.405 30.446,-63.729 30.446,-63.729 h 14.43 v 90.254 c 3.54,6.799 5.553,14.521 5.553,22.716 0,27.211 -22.058,49.271 -49.27,49.271 z m 55.332,3.519 c -1.944,0 -3.521,-1.576 -3.521,-3.52 0,-1.944 1.576,-3.52 3.521,-3.52 1.943,0 3.519,1.575 3.519,3.52 -0.001,1.944 -1.576,3.52 -3.519,3.52 z m 0,-84.112 c -1.944,0 -3.521,-1.575 -3.521,-3.519 0,-1.944 1.576,-3.52 3.521,-3.52 1.943,0 3.519,1.575 3.519,3.52 -0.001,1.944 -1.576,3.519 -3.519,3.519 z m 0,-84.111 c -1.944,0 -3.521,-1.576 -3.521,-3.519 0,-1.944 1.576,-3.52 3.521,-3.52 1.943,0 3.519,1.576 3.519,3.52 -0.001,1.943 -1.576,3.519 -3.519,3.519 z" + id="path7" + style="fill:#ffffff" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - + cx="297.96799" + cy="458.02301" + r="19.356001" + id="circle9" + sodipodi:cx="297.96799" + sodipodi:cy="458.02301" + sodipodi:rx="19.356001" + sodipodi:ry="19.356001" + style="fill:#ffffff" + d="m 317.32399,458.02301 c 0,10.69002 -8.66598,19.356 -19.356,19.356 -10.69003,0 -19.356,-8.66598 -19.356,-19.356 0,-10.69002 8.66597,-19.356 19.356,-19.356 10.69002,0 19.356,8.66598 19.356,19.356 z" /> + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/images/sync.svg b/resources/images/sync.svg index 93dc8ef5fb..09e59a1461 100644 --- a/resources/images/sync.svg +++ b/resources/images/sync.svg @@ -1,1515 +1,77 @@ - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + version="1.1" + id="Layer_1" + x="0px" + y="0px" + width="148.905" + height="201.16701" + viewBox="0 0 148.90499 201.167" + enable-background="new 0 0 595.28 841.89" + xml:space="preserve" + inkscape:version="0.47 r22583" + sodipodi:docname="sync.svg">image/svg+xml + + + + + + + \ No newline at end of file diff --git a/resources/images/trash.svg b/resources/images/trash.svg index 1ff9c4d874..15e10441fd 100644 --- a/resources/images/trash.svg +++ b/resources/images/trash.svg @@ -1,2442 +1,215 @@ - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + version="1.1" + id="Layer_1" + x="0px" + y="0px" + width="192.6368" + height="199.16716" + viewBox="0 0 192.63679 199.16716" + enable-background="new 0 0 595.28 841.89" + xml:space="preserve" + inkscape:version="0.47 r22583" + sodipodi:docname="trash.svg">image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/images/view.svg b/resources/images/view.svg index 7bdbb392dc..f0b0e1ef6c 100644 --- a/resources/images/view.svg +++ b/resources/images/view.svg @@ -1,2071 +1,32 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - Oxygen team - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/recipes/big_oven.recipe b/resources/recipes/big_oven.recipe new file mode 100644 index 0000000000..e1636daf72 --- /dev/null +++ b/resources/recipes/big_oven.recipe @@ -0,0 +1,64 @@ +from calibre.web.feeds.news import BasicNewsRecipe + +class BigOven(BasicNewsRecipe): + title = 'BigOven' + __author__ = 'Starson17' + description = 'Recipes for the Foodie in us all. Registration is free. A fake username and password just gives smaller photos.' + language = 'en' + category = 'news, food, recipes, gourmet' + publisher = 'Starson17' + use_embedded_content= False + no_stylesheets = True + oldest_article = 24 + remove_javascript = True + remove_empty_feeds = True + cover_url = 'http://www.software.com/images/products/BigOven%20Logo_177_216.JPG' + max_articles_per_feed = 30 + needs_subscription = True + + conversion_options = {'linearize_tables' : True + , 'comment' : description + , 'tags' : category + , 'publisher' : publisher + , 'language' : language + } + + def get_browser(self): + br = BasicNewsRecipe.get_browser() + if self.username is not None and self.password is not None: + br.open('http://www.bigoven.com/') + br.select_form(name='form1') + br['TopMenu_bo1$email'] = self.username + br['TopMenu_bo1$password'] = self.password + br.submit() + return br + + remove_attributes = ['style', 'font'] + + keep_only_tags = [dict(name='h1') + ,dict(name='div', attrs={'class':'img'}) + ,dict(name='div', attrs={'id':'intro'}) + ] + + remove_tags = [dict(name='div', attrs={'style':["overflow: visible;"]}) + ,dict(name='div', attrs={'class':['ctas']}) + #,dict(name='a', attrs={'class':['edit']}) + ,dict(name='p', attrs={'class':['byline']}) + ] + + feeds = [(u'4 & 5 Star Rated Recipes', u'http://feeds.feedburner.com/Bigovencom-RecipeRaves?format=xml')] + + def preprocess_html(self, soup): + for tag in soup.findAll(name='a', attrs={'class':['edit']}): + tag.parent.extract() + for tag in soup.findAll(name='a', attrs={'class':['deflink']}): + tag.replaceWith(tag.string) + return soup + + extra_css = ''' + h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;} + h2{font-family:Arial,Helvetica,sans-serif; font-weight:normal;font-size:medium;} + p{font-family:Arial,Helvetica,sans-serif;font-size:small;} + body{font-family:Helvetica,Arial,sans-serif;font-size:small;} + ''' + diff --git a/resources/recipes/editor_and_publisher.recipe b/resources/recipes/editor_and_publisher.recipe index c8f287a0c7..0ec5c59d74 100644 --- a/resources/recipes/editor_and_publisher.recipe +++ b/resources/recipes/editor_and_publisher.recipe @@ -1,14 +1,29 @@ -import re +#!/usr/bin/env python +__license__ = 'GPL v3' +__copyright__ = '2010 elsuave' + from calibre.web.feeds.news import BasicNewsRecipe class EandP(BasicNewsRecipe): title = u'Editor and Publisher' - __author__ = u'Xanthan Gum' + __author__ = u'elsuave (modified from Xanthan Gum)' description = 'News about newspapers and journalism.' + publisher = 'Editor and Publisher' + category = 'news, journalism, industry' language = 'en' - no_stylesheets = True + max_articles_per_feed = 25 + no_stylesheets = True + use_embedded_content = False + encoding = 'utf8' + cover_url = 'http://www.editorandpublisher.com/images/EP_main_logo.gif' + remove_javascript = True - oldest_article = 7 - max_articles_per_feed = 100 + html2lrf_options = [ + '--comment', description + , '--category', category + , '--publisher', publisher + ] + + html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"' # Font formatting code borrowed from kwetal @@ -18,17 +33,21 @@ class EandP(BasicNewsRecipe): h2{font-size: large;} ''' - # Delete everything before the article + # Keep only div:itemmgap - remove_tags_before = dict(name='font', attrs={'class':'titlebar_black'}) + keep_only_tags = [ + dict(name='div', attrs={'class':'itemmgap'}) + ] - # Delete everything after the article + # Remove commenting/social media lins - preprocess_regexps = [(re.compile(r'.*', re.DOTALL|re.IGNORECASE), - lambda match: ''),] + remove_tags_after = [dict(name='div', attrs={'class':'clear'})] + + + feeds = [(u'Breaking News', u'http://www.editorandpublisher.com/GenerateRssFeed.aspx'), + (u'Business News', u'http://www.editorandpublisher.com/GenerateRssFeed.aspx?CategoryId=2'), + (u'Ad/Circ News', u'http://www.editorandpublisher.com/GenerateRssFeed.aspx?CategoryId=3'), + (u'Newsroom', u'http://www.editorandpublisher.com/GenerateRssFeed.aspx?CategoryId=4'), + (u'Technology News', u'http://www.editorandpublisher.com/GenerateRssFeed.aspx?CategoryId=5'), + (u'Syndicates News', u'http://www.editorandpublisher.com/GenerateRssFeed.aspx?CategoryId=7')] - feeds = [(u'Breaking News', u'http://feeds.feedburner.com/EditorAndPublisher-BreakingNews'), - (u'Business News', u'http://feeds.feedburner.com/EditorAndPublisher-BusinessNews'), - (u'Newsroom', u'http://feeds.feedburner.com/EditorAndPublisher-Newsroom'), - (u'Technology News', u'http://feeds.feedburner.com/EditorAndPublisher-Technology'), - (u'Syndicates News', u'http://feeds.feedburner.com/EditorAndPublisher-Syndicates')] diff --git a/resources/recipes/estadao.recipe b/resources/recipes/estadao.recipe index e42eb0574d..4e520c1135 100644 --- a/resources/recipes/estadao.recipe +++ b/resources/recipes/estadao.recipe @@ -1,7 +1,7 @@ #!/usr/bin/env python __license__ = 'GPL v3' -__copyright__ = '2009, Darko Miletic ' +__copyright__ = '2010, elsuave' ''' estadao.com.br ''' @@ -10,12 +10,12 @@ from calibre.web.feeds.news import BasicNewsRecipe class Estadao(BasicNewsRecipe): title = 'O Estado de S. Paulo' - __author__ = 'Darko Miletic' + __author__ = 'elsuave (modified from Darko Miletic)' description = 'News from Brasil in Portuguese' publisher = 'O Estado de S. Paulo' category = 'news, politics, Brasil' oldest_article = 2 - max_articles_per_feed = 100 + max_articles_per_feed = 25 no_stylesheets = True use_embedded_content = False encoding = 'utf8' @@ -30,13 +30,14 @@ class Estadao(BasicNewsRecipe): html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"' - keep_only_tags = [dict(name='div', attrs={'id':'c1'})] + keep_only_tags = [ + dict(name='div', attrs={'class':['bb-md-noticia','c5']}) + ] remove_tags = [ dict(name=['script','object','form','ul']) - ,dict(name='div', attrs={'id':['votacao','estadaohoje']}) - ,dict(name='p', attrs={'id':'ctrl_texto'}) - ,dict(name='p', attrs={'class':'texto'}) + ,dict(name='div', attrs={'class':['fnt2 Color_04 bold','right fnt2 innerTop15 dvTmFont','™_01 right outerLeft15','tituloBox','tags']}) + ,dict(name='div', attrs={'id':['bb-md-noticia-subcom']}) ] feeds = [ @@ -51,13 +52,12 @@ class Estadao(BasicNewsRecipe): ,(u'Vida &', u'http://www.estadao.com.br/rss/vidae.xml') ] - def preprocess_html(self, soup): - ifr = soup.find('iframe') - if ifr: - ifr.extract() - for item in soup.findAll(style=True): - del item['style'] - return soup + language = 'pt' + def get_article_url(self, article): + url = BasicNewsRecipe.get_article_url(self, article) + if '/Multimidia/' not in url: + return url + diff --git a/src/calibre/ebooks/metadata/fetch.py b/src/calibre/ebooks/metadata/fetch.py index cb75d93f59..0613f64bfb 100644 --- a/src/calibre/ebooks/metadata/fetch.py +++ b/src/calibre/ebooks/metadata/fetch.py @@ -351,9 +351,13 @@ def search(title=None, author=None, publisher=None, isbn=None, isbndb_key=None, if len(results) > 1: if not results[0].comments or len(results[0].comments) == 0: for r in results[1:]: - if title.lower() == r.title[:len(title)].lower() and r.comments and len(r.comments): - results[0].comments = r.comments - break + try: + if title and title.lower() == r.title[:len(title)].lower() \ + and r.comments and len(r.comments): + results[0].comments = r.comments + break + except: + pass # Find a pubdate pubdate = None for r in results: diff --git a/src/calibre/gui2/actions.py b/src/calibre/gui2/actions.py index f36df397f9..9522083b98 100644 --- a/src/calibre/gui2/actions.py +++ b/src/calibre/gui2/actions.py @@ -323,7 +323,6 @@ class AddAction(object): # {{{ accept = True if accept: event.accept() - self.cover_cache.refresh([cid]) self.library_view.model().current_changed(current_idx, current_idx) def __add_filesystem_book(self, paths, allow_device=True): diff --git a/src/calibre/gui2/cover_flow.py b/src/calibre/gui2/cover_flow.py index c5ac474b0d..5dca2c8e72 100644 --- a/src/calibre/gui2/cover_flow.py +++ b/src/calibre/gui2/cover_flow.py @@ -115,6 +115,7 @@ class CoverFlowMixin(object): self.sync_cf_to_listview) self.db_images = DatabaseImages(self.library_view.model()) self.cover_flow.setImages(self.db_images) + self.cover_flow.itemActivated.connect(self.view_specific_book) else: self.cover_flow = QLabel('

'+_('Cover browser could not be loaded') +'
'+pictureflowerror) diff --git a/src/calibre/gui2/pictureflow/pictureflow.cpp b/src/calibre/gui2/pictureflow/pictureflow.cpp index 64c2c99b6c..450608cf6b 100644 --- a/src/calibre/gui2/pictureflow/pictureflow.cpp +++ b/src/calibre/gui2/pictureflow/pictureflow.cpp @@ -579,12 +579,10 @@ void PictureFlowPrivate::resetSlides() static QImage prepareSurface(QImage img, int w, int h) { - Qt::TransformationMode mode = Qt::SmoothTransformation; - img = img.scaled(w, h, Qt::IgnoreAspectRatio, mode); + img = img.scaled(w, h, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); // slightly larger, to accommodate for the reflection int hs = int(h * REFLECTION_FACTOR); - int hofs = 0; // offscreen buffer: black is sweet QImage result(hs, w, QImage::Format_RGB16); @@ -595,21 +593,20 @@ static QImage prepareSurface(QImage img, int w, int h) // (and much better and faster to work row-wise, i.e in one scanline) for(int x = 0; x < w; x++) for(int y = 0; y < h; y++) - result.setPixel(hofs + y, x, img.pixel(x, y)); + result.setPixel(y, x, img.pixel(x, y)); // create the reflection - int ht = hs - h - hofs; - int hte = ht; + int ht = hs - h; for(int x = 0; x < w; x++) for(int y = 0; y < ht; y++) { QRgb color = img.pixel(x, img.height()-y-1); //QRgb565 color = img.scanLine(img.height()-y-1) + x*sizeof(QRgb565); //img.pixel(x, img.height()-y-1); int a = qAlpha(color); - int r = qRed(color) * a / 256 * (hte - y) / hte * 3/5; - int g = qGreen(color) * a / 256 * (hte - y) / hte * 3/5; - int b = qBlue(color) * a / 256 * (hte - y) / hte * 3/5; - result.setPixel(h+hofs+y, x, qRgb(r, g, b)); + int r = qRed(color) * a / 256 * (ht - y) / ht * 3/5; + int g = qGreen(color) * a / 256 * (ht - y) / ht * 3/5; + int b = qBlue(color) * a / 256 * (ht - y) / ht * 3/5; + result.setPixel(h+y, x, qRgb(r, g, b)); } return result; @@ -798,12 +795,20 @@ QRect PictureFlowPrivate::renderCenterSlide(const SlideInfo &slide) { int sw = src->height(); int sh = src->width(); int h = buffer.height(); - QRect rect(buffer.width()/2 - sw/2, 0, sw, h-1); - int left = rect.left(); + int srcoff = 0; + int left = buffer.width()/2 - sw/2; + if (left < 0) { + srcoff = -left; + sw += left; + left = 0; + } + QRect rect(left, 0, sw, h-1); + int xcon = MIN(h-1, sh-1); + int ycon = MIN(sw, buffer.width() - left); - for(int x = 0; x < MIN(h-1, sh-1); x++) - for(int y = 0; y < sw; y++) - buffer.setPixel(left + y, 1+x, src->pixel(x, y)); + for(int x = 0; x < xcon; x++) + for(int y = 0; y < ycon; y++) + buffer.setPixel(left + y, 1+x, src->pixel(x, srcoff+y)); return rect; } diff --git a/src/calibre/web/fetch/simple.py b/src/calibre/web/fetch/simple.py index 41d9c4ed59..0bfca0fc54 100644 --- a/src/calibre/web/fetch/simple.py +++ b/src/calibre/web/fetch/simple.py @@ -238,7 +238,7 @@ class RecursiveFetcher(object): soup = BeautifulSoup(u'') self.log.debug('Downloading') res = self.process_links(soup, url, 0, into_dir='') - self.log.debug('%s saved to %s'%( url, res)) + self.log.debug(url, 'saved to', res) return res def is_link_ok(self, url): @@ -281,7 +281,7 @@ class RecursiveFetcher(object): try: data = self.fetch_url(iurl) except Exception: - self.log.exception('Could not fetch stylesheet %s'% iurl) + self.log.exception('Could not fetch stylesheet ', iurl) continue stylepath = os.path.join(diskpath, 'style'+str(c)+'.css') with self.stylemap_lock: @@ -304,7 +304,7 @@ class RecursiveFetcher(object): try: data = self.fetch_url(iurl) except Exception: - self.log.exception('Could not fetch stylesheet %s'% iurl) + self.log.exception('Could not fetch stylesheet ', iurl) continue c += 1 stylepath = os.path.join(diskpath, 'style'+str(c)+'.css') @@ -337,7 +337,7 @@ class RecursiveFetcher(object): # Skip empty GIF files as PIL errors on them anyway continue except Exception: - self.log.exception('Could not fetch image %s'% iurl) + self.log.exception('Could not fetch image ', iurl) continue c += 1 fname = ascii_filename('img'+str(c)) @@ -423,7 +423,7 @@ class RecursiveFetcher(object): newbaseurl = dsrc.newurl if len(dsrc) == 0 or \ len(re.compile('', re.DOTALL).sub('', dsrc).strip()) == 0: - raise ValueError('No content at URL %s'%iurl) + raise ValueError('No content at URL %r'%iurl) if callable(self.encoding): dsrc = self.encoding(dsrc) elif self.encoding is not None: