From 6c3100ffaa23d79814a8b4d845b285c3a5fcfd44 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 21 May 2009 13:06:09 -0700 Subject: [PATCH 1/7] New recipe for PHD Cmics by Rafardeon --- src/calibre/web/feeds/recipes/__init__.py | 2 +- .../web/feeds/recipes/recipe_phd_comics.py | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 src/calibre/web/feeds/recipes/recipe_phd_comics.py diff --git a/src/calibre/web/feeds/recipes/__init__.py b/src/calibre/web/feeds/recipes/__init__.py index 639878b37f..5f78801493 100644 --- a/src/calibre/web/feeds/recipes/__init__.py +++ b/src/calibre/web/feeds/recipes/__init__.py @@ -43,7 +43,7 @@ recipe_modules = ['recipe_' + r for r in ( 'seattle_times', 'scott_hanselman', 'coding_horror', 'twitchfilms', 'stackoverflow', 'telepolis_artikel', 'zaobao', 'usnews', 'straitstimes', 'index_hu', 'pcworld_hu', 'hrt', 'rts', - 'h1', 'h2', 'h3', + 'h1', 'h2', 'h3', 'phd_comics', )] import re, imp, inspect, time, os diff --git a/src/calibre/web/feeds/recipes/recipe_phd_comics.py b/src/calibre/web/feeds/recipes/recipe_phd_comics.py new file mode 100644 index 0000000000..4bf8772064 --- /dev/null +++ b/src/calibre/web/feeds/recipes/recipe_phd_comics.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai +from __future__ import with_statement + +__license__ = 'GPL v3' +__copyright__ = '2009, Kovid Goyal ' +__docformat__ = 'restructuredtext en' + + +from calibre.web.feeds.news import BasicNewsRecipe + +class PHDComics(BasicNewsRecipe): + title = u'PHD Comics' + oldest_article = 14 + max_articles_per_feed = 100 + language = _('English') + __author__ = 'Rafardeon' + + feeds = [(u'PHD Comics', u'http://www.phdcomics.com/gradfeed.php')] + + def print_version(self, url): + return url.replace('http://www.phdcomics.com/comics.php?f=', 'http://www.phdcomics.com/comics/archive_print.php?comicid=') From 362b35bef2c4bfcfb2909fdbef4ccbad294f360c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 21 May 2009 20:39:31 -0700 Subject: [PATCH 2/7] Implement #2478 (Updated recipe Vreme) --- src/calibre/gui2/images/news/vreme.png | Bin 0 -> 737 bytes src/calibre/web/feeds/recipes/recipe_vreme.py | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 src/calibre/gui2/images/news/vreme.png diff --git a/src/calibre/gui2/images/news/vreme.png b/src/calibre/gui2/images/news/vreme.png new file mode 100644 index 0000000000000000000000000000000000000000..61a6266b8f20df9a93ae863dfb5ec1f4db1b7f8d GIT binary patch literal 737 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b zK-vS0-A-oPfdtD69Mgd`SU*F|v9*U87?`*`T^vI!PS;Mh&j=0_IadFC=BkC?_Byf5 zPSCQlJL2eQuq7|a)U@dahwt&O8z&dec0Qx9_QEYy4XquL27MO~HZ`l=3cbP-wa{5Q z!*Q`^+mxsmg%y?hxxb#zKDYP#ocA@~cR%+!$F+)~qmeuGYZ7DB>bV~Z>*s835B?GA z$P(%rYWe?_>b|`0FYS@**8fwrk+~nK+f?}RoQCsO(dDc2nzU>$o|ci8d9d7{;f0N$ z+68&V3-SvKH%&hlG_xeUU4+e+VBkABY2%BT(~X;}%j|B+FFb5CS9{IA>i4oYw!J-B-o8S1V?@vW zpZdD|V)OUim^R`3bJ_2y`H#iamPfOEeeZg0+NpbPR&&+T*}ls@^h)gWN<611knr(j z@%s;_at?BC3)!A6m{6Cr>SvGA6ytLTTownaADp_r`lNvW(Z+|)vHWJ&uYdgBCRuHA z@Wnx84yHDR=&tM2rmYltW>LLka&NvX%ZmRRiuq?JG+iovX2Si{=%9V5`;v=7_x|mT zZ4RCK|GMqXD@J$C+kr_$wZt`|B)KRxu_RSD1xPR$85mgV8kp)D8HN}cSQ(pJnV9Pu vm|Gbb{Mc^v9i|~SKP5A*5<`Qbp_M66j|D`-2T_4=paup{S3j3^P6 Date: Sat, 23 May 2009 18:51:14 +0300 Subject: [PATCH 3/7] Handle soft linebreaks --- src/calibre/ebooks/rtf2xml/process_tokens.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/calibre/ebooks/rtf2xml/process_tokens.py b/src/calibre/ebooks/rtf2xml/process_tokens.py index 57bb2eaafe..1811f6a1a3 100755 --- a/src/calibre/ebooks/rtf2xml/process_tokens.py +++ b/src/calibre/ebooks/rtf2xml/process_tokens.py @@ -73,6 +73,7 @@ class ProcessTokens: 'backslash' : ('nu', '\\', self.text_func), 'ob' : ('nu', '{', self.text_func), 'cb' : ('nu', '}', self.text_func), + 'line' : ('nu', ' ', self.text_func), # paragraph formatting => pf 'page' : ('pf', 'page-break', self.default_func), 'par' : ('pf', 'par-end___', self.default_func), From c410bb9ea9803d811f892c01352b7732411f8fb4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 25 May 2009 13:08:55 -0700 Subject: [PATCH 4/7] Fix #2497 (Scientific American recipe not working) --- src/calibre/web/feeds/recipes/__init__.py | 2 +- .../web/feeds/recipes/recipe_le_temps.py | 88 ++++++++++ .../recipes/recipe_scientific_american.py | 154 +++++++----------- .../web/feeds/recipes/recipe_woz_die.py | 46 ++++++ 4 files changed, 196 insertions(+), 94 deletions(-) create mode 100644 src/calibre/web/feeds/recipes/recipe_le_temps.py create mode 100644 src/calibre/web/feeds/recipes/recipe_woz_die.py diff --git a/src/calibre/web/feeds/recipes/__init__.py b/src/calibre/web/feeds/recipes/__init__.py index 5f78801493..bd1b5098d9 100644 --- a/src/calibre/web/feeds/recipes/__init__.py +++ b/src/calibre/web/feeds/recipes/__init__.py @@ -43,7 +43,7 @@ recipe_modules = ['recipe_' + r for r in ( 'seattle_times', 'scott_hanselman', 'coding_horror', 'twitchfilms', 'stackoverflow', 'telepolis_artikel', 'zaobao', 'usnews', 'straitstimes', 'index_hu', 'pcworld_hu', 'hrt', 'rts', - 'h1', 'h2', 'h3', 'phd_comics', + 'h1', 'h2', 'h3', 'phd_comics', 'woz_die', )] import re, imp, inspect, time, os diff --git a/src/calibre/web/feeds/recipes/recipe_le_temps.py b/src/calibre/web/feeds/recipes/recipe_le_temps.py new file mode 100644 index 0000000000..eb0b6c5a64 --- /dev/null +++ b/src/calibre/web/feeds/recipes/recipe_le_temps.py @@ -0,0 +1,88 @@ +#!/usr/bin/env python +# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai +from __future__ import with_statement + +__license__ = 'GPL v3' +__copyright__ = '2009, Kovid Goyal ' +__docformat__ = 'restructuredtext en' + + + +from calibre.web.feeds.news import BasicNewsRecipe + +class LeTemps(BasicNewsRecipe): + title = u'Le Temps' + oldest_article = 7 + max_articles_per_feed = 100 + no_stylesheets = True + remove_tags = [dict(name='div', attrs={'id':'footer'})] + remove_tags = [dict(name='div', attrs={'class':'box links'})] + remove_tags = [dict(name='script')] + extra_css = '''.heading {font-size: 13px; line-height: 15px; + margin: 20px 0;} \n h2 {font-size: 24px; line-height: 25px; margin-bottom: + 14px;} \n .author {font-size: 11px; margin: 0 0 5px 0;} \n .lead {font- + weight: 700; margin: 10px 0;} \n p {margin: 0 0 10px 0;}''' + + feeds = [ + ('Actualité', + 'http://www.letemps.ch/rss/site/'), + ('Monde', + 'http://www.letemps.ch/rss/site/actualite/monde'), + ('Suisse & Régions', + 'http://www.letemps.ch/rss/site/actualite/suisse_regions'), + ('Sciences & Environnement', + 'http://www.letemps.ch/rss/site/actualite/sciences_environnement'), + ('Société', + 'http://www.letemps.ch/rss/site/actualite/societe'), + ('Economie & Finance', + 'http://www.letemps.ch/rss/site/economie_finance'), + ('Economie & Finance - Finance', + 'http://www.letemps.ch/rss/site/economie_finance/finance'), + ('Economie & Finance - Fonds de placement', + 'http://www.letemps.ch/rss/site/economie_finance/fonds_placement'), + ('Economie & Finance - Carrières', + 'http://www.letemps.ch/rss/site/economie_finance/carrieres'), + ('Culture', + 'http://www.letemps.ch/rss/site/culture'), + ('Culture - Cinéma', + 'http://www.letemps.ch/rss/site/culture/cinema'), + ('Culture - Musiques', + 'http://www.letemps.ch/rss/site/culture/musiques'), + ('Culture - Scènes', + 'http://www.letemps.ch/rss/site/culture/scenes'), + ('Culture - Arts plastiques', + 'http://www.letemps.ch/rss/site/culture/arts_plastiques'), + ('Livres', + 'http://www.letemps.ch/rss/site/culture/livres'), + ('Opinions', + 'http://www.letemps.ch/rss/site/opinions'), + ('Opinions - Editoriaux', + 'http://www.letemps.ch/rss/site/opinions/editoriaux'), + ('Opinions - Invités', + 'http://www.letemps.ch/rss/site/opinions/invites'), + ('Opinions - Chroniques', + 'http://www.letemps.ch/rss/site/opinions/chroniques'), + ('LifeStyle', + 'http://www.letemps.ch/rss/site/lifestyle'), + ('LifeStyle - Luxe', + 'http://www.letemps.ch/rss/site/lifestyle/luxe'), + ('LifeStyle - Horlogerie & Joaillerie', + 'http://www.letemps.ch/rss/site/lifestyle/horlogerie_joaillerie'), + ('LifeStyle - Design', + 'http://www.letemps.ch/rss/site/lifestyle/design'), + ('LifeStyle - Voyages', + 'http://www.letemps.ch/rss/site/lifestyle/voyages'), + ('LifeStyle - Gastronomie', + 'http://www.letemps.ch/rss/site/lifestyle/gastronomie'), + ('LifeStyle - Architecture & Immobilier', + 'http://www.letemps.ch/rss/site/lifestyle/architecture_immobilier'), + ('LifeStyle - Automobile', + 'http://www.letemps.ch/rss/site/lifestyle/automobile'), + ('Sports', + 'http://www.letemps.ch/rss/site/actualite/sports'), + ] + + def print_version(self, url): + return url.replace('Page', 'Facet/print') + + diff --git a/src/calibre/web/feeds/recipes/recipe_scientific_american.py b/src/calibre/web/feeds/recipes/recipe_scientific_american.py index e2bce46f2f..8d706e8416 100644 --- a/src/calibre/web/feeds/recipes/recipe_scientific_american.py +++ b/src/calibre/web/feeds/recipes/recipe_scientific_american.py @@ -7,124 +7,92 @@ __docformat__ = 'restructuredtext en' sciam.com ''' import re -from lxml import html from calibre.web.feeds.news import BasicNewsRecipe class ScientificAmerican(BasicNewsRecipe): title = u'Scientific American' - description = u'Popular science. Monthly magazine.' + description = u'Popular science. Monthly magazine.' __author__ = 'Kovid Goyal' language = _('English') - oldest_article = 30 + oldest_article = 30 max_articles_per_feed = 100 no_stylesheets = True use_embedded_content = False remove_tags_before = dict(name='div', attrs={'class':'headline'}) - remove_tags_after = dict(id='article') + remove_tags_after = dict(id=['article']) remove_tags = [ - dict(id=['sharetools', 'reddit']), + dict(id=['sharetools', 'reddit']), dict(name='script'), + {'class':['float_left', 'atools']}, {"class": re.compile(r'also-in-this')} ] html2lrf_options = ['--base-font-size', '8'] recursions = 1 - match_regexps = [r'article.cfm.id=\S+page=(2|3|4|5|6|7|8|9|10|11|12|13|14)'] -# feeds = [ -# (u'Latest News', u'http://rss.sciam.com/ScientificAmerican-News'), -# (u'Global', u'http://rss.sciam.com/ScientificAmerican-Global'), -# (u'Health', u'http://rss.sciam.com/sciam/health'), -# (u'Space', u'http://rss.sciam.com/sciam/space'), -# (u'Technology', u'http://rss.sciam.com/sciam/technology'), -# (u'Biology', u'http://rss.sciam.com/sciam/biology'), -# (u'Mind & Brain', u'http://rss.sciam.com/sciam/mind-and-brain'), -# (u"What's Next", u'http://rss.sciam.com/sciam/whats-next'), -# (u'Archeology and Paleontology', u'http://www.sciam.com/page.cfm?section=rsscategory&alias=archaeology-and-paleontology'), -# (u'Physics', u'http://www.sciam.com/page.cfm?section=rsscategory&alias=physics'), -# (u'Math', u'http://rss.sciam.com/sciam/math'), -# (u'History of Science', u'http://www.sciam.com/page.cfm?section=rsscategory&alias=history-of-science'), -# (u'Chemistry', u'http://rss.sciam.com/sciam/chemistry'), -# (u'Mind Matters', u'http://rss.sciam.com/ScientificAmerican-MindBlog') -# ] -# + match_regexps = [r'article.cfm.id=\S+page=(2|3|4|5|6|7|8|9|10|11|12|13|14|15)'] + def parse_index(self): - src = self.browser.open('http://www.sciam.com/sciammag/').read() - root = html.fromstring(src) - self.cover_url = root.xpath('//img[re:match(@src, "cover_")]', - namespaces={'re':'http://exslt.org/regular-expressions'} - )[0].get('src') - self.timefmt = ' [%s]'%(root.xpath('//div[@id = "magazine-month"]')[0].text) - feeds = [] - features = [] - for a in root.xpath('//a[@href and @title = "Feature"]'): - if not a.text.strip(): - continue + soup = self.index_to_soup('http://www.scientificamerican.com/sciammag/') + month = soup.find(id='magazine-month') + self.timefmt = ' [%s]'%(self.tag_to_string(month)) + img = soup.find('img', alt='Scientific American Magazine', src=True) + if img is not None: + self.cover_url = img['src'] + features, feeds = [], [] + for p in soup.find(id='magazine-info').findAll('p') + \ + soup.find(id='magazine-info-more').findAll('p'): + all_as = p.findAll('a', href=True) + a = all_as[0] + if a is None: continue + desc = '' + for s in p.find('span', attrs={'class':'sub'}): + desc += self.tag_to_string(s) + article = { - 'url' : a.get('href'), - 'title' : u''.join(a.xpath('./text()')), - 'date' : '', - 'description' : '', - } - for s in a.itersiblings('span'): - if s.get('class', '') == 'sub': - article['description'] += u''.join(s.xpath('./text()')) + ' ' + 'url' : a.get('href'), + 'title' : self.tag_to_string(all_as[-1]), + 'date' : '', + 'description' : desc, + } features.append(article) - if features: - feeds.append(('Features', features)) - - departments = [] - for a in root.xpath('//a[@href and @class="title"]'): - txt = u''.join(a.xpath('./text()')).strip() - if not txt: - continue - article = { - 'url' : a.get('href'), - 'title' : txt, - 'date' : '', - 'description' : '', - } - p = a.getparent() - p.remove(a) - article['description'] = u''.join(p.xpath('./text()')) - departments.append(article) - - feeds.append(('Departments', departments)) - opinion = [] - for a in root.xpath('//div[@id = "opinion"]//a[@href]'): - txt = u''.join(a.xpath('./text()')).strip() - if not txt: - continue - article = { - 'url' : a.get('href'), - 'title' : txt, - 'date' : '', - 'description' : '', - } - opinion.append(article) - feeds.append(('Opinion', opinion)) - - ontheweb = [] - for a in root.xpath('//div[@id = "ontheweb"]//a[@href]'): - txt = u''.join(a.xpath('./text()')).strip() - if not txt: - continue - article = { - 'url' : a.get('href'), - 'title' : txt, - 'date' : '', - 'description' : '', - } - ontheweb.append(article) - feeds.append(('On the web', ontheweb)) - + feeds.append(('Features', features)) + + section = [] + found = [] + title = None + for x in soup.find(id='magazine-main_col1').findAll(['div', 'a']): + if x.name == 'div': + if section: + feeds.append((title, section)) + title = self.tag_to_string(x) + section = [] + else: + if title is None or not a.get('href', False) or a.get('href', None) in found: + continue + article = { + 'url' : x['href'], + 'title' : self.tag_to_string(x), + 'date': '', + 'description': '', + } + section.append(article) + if section: + feeds.append((title, section)) + + articles = [] + for a in soup.find(id='opinion').findAll('a', href=True): + articles.append({'url':a['href'], 'title':self.tag_to_string(a), + 'description':'', 'date':''}) + feeds.append(('Opinion', articles)) + return feeds - - + + def postprocess_html(self, soup, first_fetch): if soup is not None: for span in soup.findAll('span', attrs={'class':'pagination'}): span.extract() if not first_fetch: div = soup.find('div', attrs={'class':'headline'}) - if div: + if div: div.extract() return soup diff --git a/src/calibre/web/feeds/recipes/recipe_woz_die.py b/src/calibre/web/feeds/recipes/recipe_woz_die.py new file mode 100644 index 0000000000..730425eb9f --- /dev/null +++ b/src/calibre/web/feeds/recipes/recipe_woz_die.py @@ -0,0 +1,46 @@ +from calibre.web.feeds.news import BasicNewsRecipe + +class WozDie(BasicNewsRecipe): + title = u'WOZ Die Wochenzeitung' + oldest_article = 7 + max_articles_per_feed = 100 + language = _('German') + no_stylesheets = True + remove_tags = [dict(name='p', attrs={'class':'arrow_top'})] + remove_tags = [dict(name='p', attrs={'class':'bottom_right'})] + remove_tags = [dict(name='script')] + extra_css = '''#print_titel{vertical-align: bottom; text-align: + left; color: #666666; background-color: white; padding-top: 30px; padding- + bottom: 10px; border-bottom: 1px solid #999999;} #title{text-align: + left; font-size: large; font-weight: 600; padding-top: 0px; padding- + bottom: 6px;} h3 {text-align: left; font-size: large; font-weight: 600; + padding-top: 0px; padding-bottom: 6px;} #lead{font-weight: 600; + padding-bottom: 6px;} h2{font-weight: 600; padding-bottom: 6px;} + #author{color: #666666; padding-top: 0px; padding-bottom: 0px;} + h4{color: #666666; padding-top: 0px; padding-bottom: 0px;} #author2 + {color: #666666; padding-top: 0px; padding-bottom: 0px;} .dotted_line + {padding-top: 0px; margin-bottom: 18px; border-bottom: 1px dotted + #666666;} .intro{margin: 0 auto; font-weight: 600; padding-bottom: + 18px;} h5{margin: 0 auto; font-weight: 600; padding-bottom: 18px;} + .intro2{margin: 0 auto; font-weight: 600;} .text{padding-bottom: + 18px;} .subtitle{margin: 0 auto; font-weight: 600; padding-bottom: + 10px;} .articletitle{margin: 0 auto; font-weight: 600; padding-bottom: + 10px;} #content_infobox{margin-top: 20px; margin-left: 0px; margin- + right: 0px; margin-bottom: 10px; text-align: left; border-bottom: 1px + solid #999999;} .content_infobox_titel{padding-top: 6px; padding- + bottom: 8px; padding-left: 8px; padding-right: 8px; font-weight: 600; + border-top: 1px solid #999999; border-bottom: 1px dotted #999999;} + .content_infobox_text{padding-top: 6px; padding-bottom: 12px; padding- + left: 8px; padding-right: 8px;} .box_gray{padding-top: 4px; padding- + left: 7px; padding-right: 7px; padding-bottom: 4px;} .box_white { + padding-top: 4px; padding-left: 7px; padding-right: 7px; padding-bottom: + 4px;} .content_infobox_mehr{margin-top: 20px; margin-left: 0px; margin- + right: 0px; margin-bottom: 10px; text-align: left; width: 600px; border- + bottom: 1px solid #999999;}''' + + feeds = [('WOZ Die Wochenzeitung - Headlines', + 'http://www.woz.ch/inhalt/headlinesRSS.php'),] + + def print_version(self, url): + return url.replace('rss/', 'print_') + From 8c6801d9c8b0f687aad807fe45c17bf0f561504d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 25 May 2009 13:17:53 -0700 Subject: [PATCH 5/7] IGN:... --- COPYRIGHT | 174 +++++++++++++++++++++++++++++ src/calibre/gui2/dialogs/config.ui | 2 +- 2 files changed, 175 insertions(+), 1 deletion(-) diff --git a/COPYRIGHT b/COPYRIGHT index b546204f50..16f64b7d09 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -349,6 +349,11 @@ License: other Computronix® is a registered trademark of Computronix (Canada) Ltd. +Liberation Fonts +----------------- +calibre includes a copy of the liberation fonts, available from +https://fedorahosted.org/liberation-fonts + BSD License (for all the BSD licensed code indicated above) ----------------------------------------------------------- Copyright (c) , @@ -361,3 +366,172 @@ Redistribution and use in source and binary forms, with or without modification, * Neither the name of the nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +LGPL License (for all the LGPL licensed code indicated above) +------------------------------------------------------------- + + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/src/calibre/gui2/dialogs/config.ui b/src/calibre/gui2/dialogs/config.ui index 9afcac8914..baccca83b1 100644 --- a/src/calibre/gui2/dialogs/config.ui +++ b/src/calibre/gui2/dialogs/config.ui @@ -12,7 +12,7 @@ - Configuration + Preferences From 0d5fa4cac5963d6e8da89fb1312a2626889358aa Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 25 May 2009 13:18:23 -0700 Subject: [PATCH 6/7] ... --- todo | 1 - 1 file changed, 1 deletion(-) diff --git a/todo b/todo index 750d969822..2777a54070 100644 --- a/todo +++ b/todo @@ -9,4 +9,3 @@ * MOBI navigation indexing support -* Move pdf metadata setting into separate process From b407fdf9ab5ec95f8f051df2a52144034ff8d2eb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 25 May 2009 13:52:43 -0700 Subject: [PATCH 7/7] Ebook Viewer: When viewing PDF run through OEBBook --- src/calibre/ebooks/oeb/iterator.py | 8 +++++--- src/calibre/ebooks/pdf/input.py | 8 -------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/calibre/ebooks/oeb/iterator.py b/src/calibre/ebooks/oeb/iterator.py index 6653240629..ba0e8b22b5 100644 --- a/src/calibre/ebooks/oeb/iterator.py +++ b/src/calibre/ebooks/oeb/iterator.py @@ -123,19 +123,21 @@ class EbookIterator(object): self.delete_on_exit = [] self._tdir = TemporaryDirectory('_ebook_iter') self.base = self._tdir.__enter__() - from calibre.ebooks.conversion.plumber import Plumber + from calibre.ebooks.conversion.plumber import Plumber, create_oebbook plumber = Plumber(self.pathtoebook, self.base, self.log) plumber.setup_options() if hasattr(plumber.opts, 'dont_package'): plumber.opts.dont_package = True if hasattr(plumber.opts, 'no_process'): plumber.opts.no_process = True - if hasattr(plumber.input_plugin, '_preprocess_html_for_viewer'): - plumber.input_plugin._preprocess_html_for_viewer = True self.pathtoopf = plumber.input_plugin(open(plumber.input, 'rb'), plumber.opts, plumber.input_fmt, self.log, {}, self.base) + + if plumber.input_fmt.lower() == 'pdf': + self.pathtoopf = create_oebbook(self.log, self.pathtoopf, plumber.opts, + plumber.input_plugin) if hasattr(self.pathtoopf, 'manifest'): self.pathtoopf = write_oebbook(self.pathtoopf, self.base) diff --git a/src/calibre/ebooks/pdf/input.py b/src/calibre/ebooks/pdf/input.py index d6e66ebd74..6aa695c912 100644 --- a/src/calibre/ebooks/pdf/input.py +++ b/src/calibre/ebooks/pdf/input.py @@ -17,18 +17,10 @@ class PDFInput(InputFormatPlugin): description = 'Convert PDF files to HTML' file_types = set(['pdf']) - _preprocess_html_for_viewer = False - def convert(self, stream, options, file_ext, log, accelerators): html = pdftohtml(stream.name) - if self._preprocess_html_for_viewer: - from calibre.ebooks.conversion.preprocess import HTMLPreProcessor - prepro = HTMLPreProcessor(lambda x:x, False) - html = prepro(html.decode('utf-8')).encode('utf-8') - - with open('index.html', 'wb') as index: index.write(html)