diff --git a/resources/recipes/ars_technica.recipe b/resources/recipes/ars_technica.recipe index 3997ee4645..3a955d5e15 100644 --- a/resources/recipes/ars_technica.recipe +++ b/resources/recipes/ars_technica.recipe @@ -1,6 +1,5 @@ - __license__ = 'GPL v3' -__copyright__ = '2008-2010, Darko Miletic ' +__copyright__ = '2008-2011, Darko Miletic ' ''' arstechnica.com ''' @@ -9,19 +8,26 @@ import re from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import BeautifulSoup, Tag -class ArsTechnica2(BasicNewsRecipe): +class ArsTechnica(BasicNewsRecipe): title = u'Ars Technica' language = 'en' - __author__ = 'Darko Miletic and Sujata Raman' + __author__ = 'Darko Miletic, Sujata Raman, Alexis Rohou' description = 'The art of technology' publisher = 'Ars Technica' category = 'news, IT, technology' - oldest_article = 2 + oldest_article = 5 max_articles_per_feed = 100 no_stylesheets = True encoding = 'utf-8' use_embedded_content = False - extra_css = ' body {font-family: Arial,Helvetica,sans-serif} .title{text-align: left} .byline{font-weight: bold; line-height: 1em; font-size: 0.625em; text-decoration: none} ' + extra_css = ''' + body {font-family: Arial,Helvetica,sans-serif} + .title{text-align: left} + .byline{font-weight: bold; line-height: 1em; font-size: 0.625em; text-decoration: none} + .news-item-figure-caption-text{font-size:small; font-style:italic} + .news-item-figure-caption-byline{font-size:small; font-style:italic; font-weight:bold} + ''' + ignoreEtcArticles = True # Etc feed items can be ignored, as they're not real stories conversion_options = { 'comments' : description @@ -31,10 +37,10 @@ class ArsTechnica2(BasicNewsRecipe): } - preprocess_regexps = [ - (re.compile(r'
.*?', re.DOTALL|re.IGNORECASE),lambda match: '') - ] + #preprocess_regexps = [ + # (re.compile(r'
.*?', re.DOTALL|re.IGNORECASE),lambda match: '') + # ] keep_only_tags = [dict(name='div', attrs={'id':['story','etc-story']})] @@ -42,7 +48,7 @@ class ArsTechnica2(BasicNewsRecipe): dict(name=['object','link','embed']) ,dict(name='div', attrs={'class':'read-more-link'}) ] - remove_attributes=['width','height'] + #remove_attributes=['width','height'] feeds = [ (u'Infinite Loop (Apple content)' , u'http://feeds.arstechnica.com/arstechnica/apple/' ) @@ -56,6 +62,7 @@ class ArsTechnica2(BasicNewsRecipe): ,(u'Law & Disorder (Tech policy content)' , u'http://feeds.arstechnica.com/arstechnica/tech-policy/') ] + # This deals with multi-page stories def append_page(self, soup, appendtag, position): pager = soup.find('div',attrs={'class':'pager'}) if pager: @@ -81,6 +88,7 @@ class ArsTechnica2(BasicNewsRecipe): def preprocess_html(self, soup): + # Adds line breaks near the byline (not sure why this is needed) ftag = soup.find('div', attrs={'class':'byline'}) if ftag: brtag = Tag(soup,'br') @@ -88,12 +96,33 @@ class ArsTechnica2(BasicNewsRecipe): ftag.insert(4,brtag) ftag.insert(5,brtag2) + # Remove style items for item in soup.findAll(style=True): del item['style'] + # Remove id + for item in soup.findAll(id=True): + del item['id'] + + # For some reason, links to authors don't have the domainname + a_author = soup.find('a',{'href':re.compile("^/author")}) + if a_author: + a_author['href'] = 'http://arstechnica.com'+a_author['href'] + + # within div class news-item-figure, we need to grab images + + # Deal with multi-page stories self.append_page(soup, soup.body, 3) return soup def get_article_url(self, article): + # If the article title starts with Etc:, don't return it + if self.ignoreEtcArticles: + article_title = article.get('title',None) + if re.match('Etc: ',article_title) is not None: + return None + + # The actual article is in a guid tag return article.get('guid', None).rpartition('?')[0] + diff --git a/resources/recipes/seattle_times.recipe b/resources/recipes/seattle_times.recipe index 7fcea9cae5..cd7f96fc8b 100644 --- a/resources/recipes/seattle_times.recipe +++ b/resources/recipes/seattle_times.recipe @@ -21,16 +21,53 @@ class SeattleTimes(BasicNewsRecipe): encoding = 'cp1252' language = 'en' - - html2lrf_options = [ - '--comment' , description - , '--category' , category - , '--publisher', publisher - ] - - html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"' - - feeds = [(u'Articles', u'http://seattletimes.nwsource.com/rss/seattletimes.xml')] + feeds = [ + (u'Top Stories', + u'http://seattletimes.nwsource.com/rss/home.xml'), + #(u'Articles', u'http://seattletimes.nwsource.com/rss/seattletimes.xml') + (u'Business & Technology', + u'http://seattletimes.nwsource.com/rss/businesstechnology.xml'), + (u'Personal Technology', + u'http://seattletimes.nwsource.com/rss/personaltechnology.xml'), + (u'Entertainment & the Arts', + u'http://seattletimes.nwsource.com/rss/artsentertainment.xml'), + (u'Health', + u'http://seattletimes.nwsource.com/rss/health.xml'), + (u'Living', + u'http://seattletimes.nwsource.com/rss/living.xml'), + (u'Local News', + u'http://seattletimes.nwsource.com/rss/localnews.xml'), + (u'Nation & World', + u'http://seattletimes.nwsource.com/rss/nationworld.xml'), + (u'Opinion', + u'http://seattletimes.nwsource.com/rss/opinion.xml'), + (u'Politics', + u'http://seattletimes.nwsource.com/rss/politics.xml'), + (u'Sports', + u'http://seattletimes.nwsource.com/rss/sports.xml'), + (u'Nicole Brodeur', + u'http://seattletimes.nwsource.com/rss/nicolebrodeur.xml'), + (u'Danny Westneat', + u'http://seattletimes.nwsource.com/rss/dannywestneat.xml'), + (u'Jerry Large', + u'http://seattletimes.nwsource.com/rss/jerrylarge.xml'), + (u'Ron Judd', + u'http://seattletimes.nwsource.com/rss/ronjudd.xml'), + (u'Education', + u'http://seattletimes.nwsource.com/rss/education.xml'), + (u'Letters to the Editor', + u'http://seattletimes.nwsource.com/rss/northwestvoices.xml'), + (u'Travel', + u'http://seattletimes.nwsource.com/rss/travel.xml'), + (u'Outdoors', + u'http://seattletimes.nwsource.com/rss/outdoors.xml'), + (u'Steve Kelley', + u'http://seattletimes.nwsource.com/rss/stevekelley.xml'), + (u'Jerry Brewer', + u'http://seattletimes.nwsource.com/rss/jerrybrewer.xml'), + (u'Most Read Articles', + u'http://seattletimes.nwsource.com/rss/mostreadarticles.xml'), + ] remove_tags = [ dict(name=['object','link','script']) diff --git a/src/calibre/devices/eb600/driver.py b/src/calibre/devices/eb600/driver.py index 3201229699..95f6dc6ab0 100644 --- a/src/calibre/devices/eb600/driver.py +++ b/src/calibre/devices/eb600/driver.py @@ -178,7 +178,7 @@ class INVESBOOK(EB600): class BOOQ(EB600): name = 'Booq Device Interface' - gui_name = 'Booq' + gui_name = 'bq Reader' FORMATS = ['epub', 'mobi', 'prc', 'fb2', 'pdf', 'doc', 'rtf', 'txt', 'html'] diff --git a/src/calibre/devices/misc.py b/src/calibre/devices/misc.py index ecd12ac61d..aaf948f25e 100644 --- a/src/calibre/devices/misc.py +++ b/src/calibre/devices/misc.py @@ -33,8 +33,8 @@ class PALMPRE(USBMS): class AVANT(USBMS): name = 'Booq Avant Device Interface' - gui_name = 'Avant' - description = _('Communicate with the Booq Avant') + gui_name = 'bq Avant' + description = _('Communicate with the Bq Avant') author = 'Kovid Goyal' supported_platforms = ['windows', 'osx', 'linux'] diff --git a/src/calibre/ebooks/txt/input.py b/src/calibre/ebooks/txt/input.py index 39bfb4b132..c918d145f4 100644 --- a/src/calibre/ebooks/txt/input.py +++ b/src/calibre/ebooks/txt/input.py @@ -34,7 +34,7 @@ class TXTInput(InputFormatPlugin): 'starts a paragraph.' '* unformatted: Most lines have hard line breaks, few/no blank lines or indents.')), OptionRecommendation(name='formatting_type', recommended_value='auto', - choices=['auto', 'none', 'heuristic', 'markdown'], + choices=['auto', 'none', 'heuristic', 'textile', 'markdown'], help=_('Formatting used within the document.' '* auto: Automatically decide which formatting processor to use.\n' '* none: Do not process the document formatting. Everything is a ' diff --git a/src/calibre/gui2/comments_editor.py b/src/calibre/gui2/comments_editor.py index 013d13f9e7..04bc5284ed 100644 --- a/src/calibre/gui2/comments_editor.py +++ b/src/calibre/gui2/comments_editor.py @@ -593,6 +593,11 @@ class Editor(QWidget): # {{{ def code_dirtied(self, *args): self.source_dirty = True + def hide_toolbars(self): + self.toolbar1.setVisible(False) + self.toolbar2.setVisible(False) + self.toolbar3.setVisible(False) + # }}} if __name__ == '__main__': diff --git a/src/calibre/gui2/convert/metadata.py b/src/calibre/gui2/convert/metadata.py index 5f39202e26..23cac74cf8 100644 --- a/src/calibre/gui2/convert/metadata.py +++ b/src/calibre/gui2/convert/metadata.py @@ -18,6 +18,7 @@ from calibre.ebooks.metadata.opf2 import metadata_to_opf from calibre.ptempfile import PersistentTemporaryFile from calibre.gui2.convert import Widget from calibre.utils.icu import sort_key +from calibre.library.comments import comments_to_html def create_opf_file(db, book_id): mi = db.get_metadata(book_id, index_is_id=True) @@ -57,6 +58,7 @@ class MetadataWidget(Widget, Ui_Form): self.initialize_metadata_options() self.initialize_options(get_option, get_help, db, book_id) self.connect(self.cover_button, SIGNAL("clicked()"), self.select_cover) + self.comment.hide_toolbars() def deduce_author_sort(self, *args): au = unicode(self.author.currentText()) @@ -79,7 +81,7 @@ class MetadataWidget(Widget, Ui_Form): self.author_sort.setText(mi.author_sort if mi.author_sort else '') self.tags.setText(', '.join(mi.tags if mi.tags else [])) self.tags.update_items_cache(self.db.all_tags()) - self.comment.setPlainText(mi.comments if mi.comments else '') + self.comment.html = comments_to_html(mi.comments) if mi.comments else '' if mi.series: self.series.setCurrentIndex(self.series.findText(mi.series)) if mi.series_index is not None: @@ -154,7 +156,7 @@ class MetadataWidget(Widget, Ui_Form): author_sort = unicode(self.author_sort.text()).strip() if author_sort: mi.author_sort = author_sort - comments = unicode(self.comment.toPlainText()).strip() + comments = self.comment.html if comments: mi.comments = comments mi.series_index = float(self.series_index.value()) diff --git a/src/calibre/gui2/convert/metadata.ui b/src/calibre/gui2/convert/metadata.ui index 8db4cfa2a1..61c27594c4 100644 --- a/src/calibre/gui2/convert/metadata.ui +++ b/src/calibre/gui2/convert/metadata.ui @@ -20,30 +20,6 @@ Book Cover - - - - - - - 0 - 0 - - - - - - - - - - Use cover from &source file - - - true - - - @@ -95,6 +71,30 @@ + + + + Use cover from &source file + + + true + + + + + + + + + + 0 + 0 + + + + + + opt_prefer_metadata_cover @@ -264,35 +264,7 @@ - - - - 0 - 0 - - - - - 16777215 - 200 - - - - Comments - - - - - - - 16777215 - 180 - - - - - - + @@ -325,6 +297,12 @@
calibre/gui2/widgets.h
1 + + Editor + QWidget +
calibre/gui2/comments_editor.h
+ 1 +
title @@ -334,7 +312,6 @@ tags series series_index - comment cover_path cover_button opt_prefer_metadata_cover diff --git a/src/calibre/gui2/preferences/plugins.py b/src/calibre/gui2/preferences/plugins.py index c53c634ab4..b00a485566 100644 --- a/src/calibre/gui2/preferences/plugins.py +++ b/src/calibre/gui2/preferences/plugins.py @@ -196,6 +196,12 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): def modify_plugin(self, op=''): index = self.plugin_view.currentIndex() if index.isValid(): + if not index.parent().isValid(): + name = unicode(index.data().toString()) + return error_dialog(self, _('Error'), '

'+ + _('Select an actual plugin under %s to customize')%name, + show=True, show_copy_button=False) + plugin = self._plugin_model.index_to_plugin(index) if op == 'toggle': if not plugin.can_be_disabled: diff --git a/src/calibre/gui2/ui.py b/src/calibre/gui2/ui.py index 9eb202d761..6c6e41e0a5 100644 --- a/src/calibre/gui2/ui.py +++ b/src/calibre/gui2/ui.py @@ -485,7 +485,8 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{ if 'calibre.ebooks.DRMError' in job.details: if not minz: from calibre.gui2.dialogs.drm_error import DRMErrorMessage - d = DRMErrorMessage(self, job.description.split(':')[-1]) + d = DRMErrorMessage(self, _('Cannot convert') + ' ' + + job.description.split(':')[-1].partition('(')[-1][:-1]) d.setModal(False) d.show() self._modeless_dialogs.append(d) diff --git a/src/calibre/gui2/wizard/__init__.py b/src/calibre/gui2/wizard/__init__.py index 4e5e79bbdf..8144dcabf3 100644 --- a/src/calibre/gui2/wizard/__init__.py +++ b/src/calibre/gui2/wizard/__init__.py @@ -111,7 +111,7 @@ class Kobo(Device): id = 'kobo' class Booq(Device): - name = 'Booq Reader' + name = 'bq Classic' manufacturer = 'Booq' output_profile = 'sony' output_format = 'EPUB' @@ -125,7 +125,18 @@ class TheBook(Device): id = 'thebook' class Avant(Booq): - name = 'Booq Avant' + name = 'bq Avant' + +class AvantXL(Booq): + name = 'bq Avant XL' + output_profile = 'ipad' + +class BooqPocketPlus(Booq): + name = 'bq Pocket Plus' + output_profile = 'sony300' + +class BooqCervantes(Booq): + name = 'bq Cervantes' class Sony300(Sony505):