From 9fe90a1ca7c25910da9b8875969f4b80be25f01a Mon Sep 17 00:00:00 2001 From: GRiker Date: Mon, 22 Feb 2010 06:57:26 -0700 Subject: [PATCH] GwR pass save_template to catalog --- src/calibre/gui2/tools.py | 14 ++++++++------ src/calibre/library/catalog.py | 19 +++++++++++-------- src/calibre/library/cli.py | 2 +- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/calibre/gui2/tools.py b/src/calibre/gui2/tools.py index 90686f7d86..8f1f66b8e1 100644 --- a/src/calibre/gui2/tools.py +++ b/src/calibre/gui2/tools.py @@ -250,7 +250,8 @@ def generate_catalog(parent, dbspec, ids, device): # Profile the connected device # Parallel initialization in calibre.library.cli:command_catalog() - connected_device = { 'storage':None,'serial':None,'name':None} + connected_device = { 'storage':None,'serial':None,'save_template':None,'name':None} + if device: try: storage = [] @@ -260,12 +261,13 @@ def generate_catalog(parent, dbspec, ids, device): storage.append(os.path.join(device._card_a_prefix, device.EBOOK_DIR_CARD_A)) if device._card_b_prefix: storage.append(os.path.join(device._card_b_prefix, device.EBOOK_DIR_CARD_B)) - connected_device = {'storage': storage, - 'serial': device.detected_device.serial if \ - hasattr(device.detected_device,'serial') else None, - 'name': device.gui_name} + connected_device = { 'storage': storage, + 'serial': device.detected_device.serial if \ + hasattr(device.detected_device,'serial') else None, + 'save_template': device.save_template(), + 'name': device.gui_name} except: - pass + print "No connected device" # These args are passed inline to gui2.convert.gui_conversion:gui_catalog args = [ diff --git a/src/calibre/library/catalog.py b/src/calibre/library/catalog.py index 76f572df95..9555a69b0d 100644 --- a/src/calibre/library/catalog.py +++ b/src/calibre/library/catalog.py @@ -3448,6 +3448,10 @@ class EPUB_MOBI(CatalogPlugin): build_log = [] + build_log.append(u"%s(): Generating %s %sin %s environment" % + (self.name,self.fmt,'for %s ' % opts.output_profile if opts.output_profile else '', + 'CLI' if opts.cli_environment else 'GUI')) + # If exclude_genre is blank, assume user wants all genre tags included if opts.exclude_genre.strip() == '': opts.exclude_genre = '\[^.\]' @@ -3459,18 +3463,17 @@ class EPUB_MOBI(CatalogPlugin): (opts.connected_device['name'], opts.connected_device['serial'][0:4], 'x' * (len(opts.connected_device['serial']) - 4))) + build_log.append(" save_template: '%s'" % opts.connected_device['save_template']) else: build_log.append(" connected_device: '%s'" % opts.connected_device['name']) for storage in opts.connected_device['storage']: if storage: build_log.append(" mount point: %s" % storage) + build_log.append(" save_template: '%s'" % opts.connected_device['save_template']) opts_dict = vars(opts) - build_log.append(u"%s(): Generating %s %sin %s environment" % - (self.name,self.fmt,'for %s ' % opts.output_profile if opts.output_profile else '', - 'CLI' if opts.cli_environment else 'GUI')) if opts_dict['ids']: - build_log.append(" Book count: %d" % len(opts_dict['ids'])) + build_log.append(" book count: %d" % len(opts_dict['ids'])) sections_list = ['Descriptions','Authors'] if opts.generate_titles: @@ -3479,7 +3482,7 @@ class EPUB_MOBI(CatalogPlugin): sections_list.append('Recently Added') if not opts.exclude_genre.strip() == '.': sections_list.append('Genres') - build_log.append(u"Creating Sections for %s" % ', '.join(sections_list)) + build_log.append(u" Sections: %s" % ', '.join(sections_list)) # Display opts keys = opts_dict.keys() @@ -3499,16 +3502,16 @@ class EPUB_MOBI(CatalogPlugin): # Launch the Catalog builder catalog = self.CatalogBuilder(db, opts, self, report_progress=notification) if opts.verbose: - log.info("Begin catalog source generation") + log.info(" Begin catalog source generation") catalog.createDirectoryStructure() catalog.copyResources() catalog.calculateThumbnailSize() catalog_source_built = catalog.buildSources() if opts.verbose: if catalog_source_built: - log.info("Finished catalog source generation\n") + log.info(" Finished catalog source generation\n") else: - log.warn("No database hits with supplied criteria") + log.warn(" No database hits with supplied criteria") if catalog_source_built: recommendations = [] diff --git a/src/calibre/library/cli.py b/src/calibre/library/cli.py index 1c0c6d5808..9a8ad88c13 100644 --- a/src/calibre/library/cli.py +++ b/src/calibre/library/cli.py @@ -683,7 +683,7 @@ def command_catalog(args, dbpath): # No support for connected device in CLI environment # Parallel initialization in calibre.gui2.tools:generate_catalog() - opts.connected_device = {'storage':None,'serial':None,'name':None} + opts.connected_device = { 'storage':None,'serial':None,'save_template':None,'name':None} with plugin: plugin.run(args[1], opts, get_db(dbpath, opts))