From a8578eee2d4008a547f0cf2ac9c880ef02cf0a37 Mon Sep 17 00:00:00 2001 From: Sengian Date: Tue, 2 Nov 2010 00:05:20 +0100 Subject: [PATCH] minor corrections linked to bug 7345 --- src/calibre/ebooks/metadata/fetch.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/calibre/ebooks/metadata/fetch.py b/src/calibre/ebooks/metadata/fetch.py index 36a1af9c07..dedd251640 100644 --- a/src/calibre/ebooks/metadata/fetch.py +++ b/src/calibre/ebooks/metadata/fetch.py @@ -17,8 +17,6 @@ from calibre.utils.html2text import html2text metadata_config = None -html_check = re.compile("([\<])([^\>]{1,})*([\>])", re.I) - class MetadataSource(Plugin): # {{{ ''' Represents a source to query for metadata. Subclasses must implement @@ -86,9 +84,6 @@ class MetadataSource(Plugin): # {{{ mi.rating = None if not c.get('comments', True): mi.comments = None - if c.get('textconvert', True) and mi.comments is not None \ - and html_check.search(mi.comments) is not None: - mi.comments = html2text(mi.comments) if not c.get('tags', True): mi.tags = [] if self.has_html_comments and mi.comments and \ @@ -151,18 +146,21 @@ class MetadataSource(Plugin): # {{{ setattr(w, '_'+x, cb) cb.setChecked(c.get(x, True)) w._layout.addWidget(cb) - - cb = QCheckBox(_('Convert comments downloaded from %s to plain text')%(self.name)) - setattr(w, '_textcomments', cb) - cb.setChecked(c.get('textcomments', False)) - w._layout.addWidget(cb) + + if self.has_html_comments: + cb = QCheckBox(_('Convert comments downloaded from %s to plain text')%(self.name)) + setattr(w, '_textcomments', cb) + cb.setChecked(c.get('textcomments', False)) + w._layout.addWidget(cb) return w def save_settings(self, w): dl_settings = {} - for x in ('rating', 'tags', 'comments', 'textcomments'): + for x in ('rating', 'tags', 'comments'): dl_settings[x] = getattr(w, '_'+x).isChecked() + if self.has_html_comments: + dl_settings['textcomments'] = getattr(w, '_textcomments').isChecked() c = self.config_store() c.set(self.name, dl_settings) if hasattr(w, '_sc'):