diff --git a/src/calibre/library/catalogs/epub_mobi.py b/src/calibre/library/catalogs/epub_mobi.py index 6225612cc8..0d1e26bce6 100644 --- a/src/calibre/library/catalogs/epub_mobi.py +++ b/src/calibre/library/catalogs/epub_mobi.py @@ -9,6 +9,7 @@ __docformat__ = 'restructuredtext en' import os, shutil from collections import namedtuple +from copy import deepcopy from calibre import strftime from calibre.customize import CatalogPlugin @@ -328,6 +329,9 @@ class EPUB_MOBI(CatalogPlugin): # Launch the Catalog builder catalog = CatalogBuilder(db, opts, self, report_progress=notification) + # Save the output profile for the plumber + output_profile = deepcopy(catalog.output_profile) + if opts.verbose: log.info(" Begin catalog source generation") @@ -346,6 +350,8 @@ class EPUB_MOBI(CatalogPlugin): recommendations.append(('remove_fake_margins', False, OptionRecommendation.HIGH)) recommendations.append(('comments', '', OptionRecommendation.HIGH)) + recommendations.append(('output_profile', output_profile, + OptionRecommendation.HIGH)) """ >>> Use to debug generated catalog code before pipeline conversion <<< @@ -360,9 +366,7 @@ class EPUB_MOBI(CatalogPlugin): recommendations.append(('debug_pipeline', dp, OptionRecommendation.HIGH)) - if opts.fmt == 'mobi' and opts.output_profile and opts.output_profile.startswith("kindle"): - recommendations.append(('output_profile', opts.output_profile, - OptionRecommendation.HIGH)) + if opts.output_profile and opts.output_profile.startswith("kindle"): recommendations.append(('no_inline_toc', True, OptionRecommendation.HIGH)) recommendations.append(('book_producer',opts.output_profile, diff --git a/src/calibre/library/catalogs/epub_mobi_builder.py b/src/calibre/library/catalogs/epub_mobi_builder.py index f592437916..d38bbd1b27 100644 --- a/src/calibre/library/catalogs/epub_mobi_builder.py +++ b/src/calibre/library/catalogs/epub_mobi_builder.py @@ -69,7 +69,7 @@ class CatalogBuilder(object): @property def SYMBOL_PROGRESS_READ(self): psr = '+' - if self.generate_for_kindle: + if self.generate_for_kindle_mobi: psr = '▪' return psr @@ -77,14 +77,14 @@ class CatalogBuilder(object): @property def SYMBOL_PROGRESS_UNREAD(self): psu = '-' - if self.generate_for_kindle: + if self.generate_for_kindle_mobi: psu = '▫' return psu ''' device-specific symbol for reading progress ''' @property def SYMBOL_READING(self): - if self.generate_for_kindle: + if self.generate_for_kindle_mobi: return self.format_prefix('▷') else: return self.format_prefix(' ') @@ -103,7 +103,7 @@ class CatalogBuilder(object): self.cache_dir = os.path.join(config_dir, 'caches', 'catalog') self.catalog_path = PersistentTemporaryDirectory("_epub_mobi_catalog", prefix='') self.excluded_tags = self.get_excluded_tags() - self.generate_for_kindle = True if (_opts.fmt == 'mobi' and + self.generate_for_kindle_mobi = True if (_opts.fmt == 'mobi' and _opts.output_profile and _opts.output_profile.startswith("kindle")) else False @@ -122,7 +122,7 @@ class CatalogBuilder(object): self.error = [] self.generate_recently_read = True if (_opts.generate_recently_added and _opts.connected_kindle and - self.generate_for_kindle) else False + self.generate_for_kindle_mobi) else False self.genres = [] self.genre_tags_dict = None self.html_filelist_1 = [] @@ -130,7 +130,6 @@ class CatalogBuilder(object): self.merge_comments_rule = dict(zip(['field','position','hr'], _opts.merge_comments_rule.split(':'))) self.ncx_soup = None - self.output_profile = None self.output_profile = self.get_output_profile(_opts) self.play_order = 1 self.prefix_rules = self.get_prefix_rules() @@ -469,7 +468,7 @@ class CatalogBuilder(object): shutil.copy(os.path.join(catalog_resources,file[1]), os.path.join(self.catalog_path, file[0])) - if self.generate_for_kindle: + if self.generate_for_kindle_mobi: try: self.generate_masthead_image(os.path.join(self.catalog_path, 'images/mastheadImage.gif')) @@ -1421,7 +1420,7 @@ class CatalogBuilder(object): pTag.insert(ptc, aTag) ptc += 1 - if not self.generate_for_kindle: + if not self.generate_for_kindle_mobi: # Kindle don't need this because it shows section titles in Periodical format aTag = Tag(soup, "a") anchor_name = friendly_name.lower() @@ -1629,7 +1628,7 @@ class CatalogBuilder(object): pTag.insert(ptc, aTag) ptc += 1 - if not self.generate_for_kindle: + if not self.generate_for_kindle_mobi: # Kindle don't need this because it shows section titles in Periodical format aTag = Tag(soup, "a") anchor_name = friendly_name.lower() @@ -2258,7 +2257,7 @@ class CatalogBuilder(object): pTag.insert(ptc, aTag) ptc += 1 - if not self.generate_for_kindle: + if not self.generate_for_kindle_mobi: # Insert the