mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Improved database tag set diagnostics
This commit is contained in:
parent
ef6902a58a
commit
fcc99fb988
@ -940,7 +940,7 @@ class EPUB_MOBI(CatalogPlugin):
|
|||||||
|
|
||||||
def generateHTMLDescriptions(self):
|
def generateHTMLDescriptions(self):
|
||||||
# Write each title to a separate HTML file in contentdir
|
# Write each title to a separate HTML file in contentdir
|
||||||
self.updateProgressFullStep("Description")
|
self.updateProgressFullStep("Generating 'Descriptions'")
|
||||||
|
|
||||||
for (title_num, title) in enumerate(self.booksByTitle):
|
for (title_num, title) in enumerate(self.booksByTitle):
|
||||||
if False:
|
if False:
|
||||||
@ -1069,7 +1069,7 @@ class EPUB_MOBI(CatalogPlugin):
|
|||||||
def generateHTMLByTitle(self):
|
def generateHTMLByTitle(self):
|
||||||
# Write books by title A-Z to HTML file
|
# Write books by title A-Z to HTML file
|
||||||
|
|
||||||
self.updateProgressFullStep("Books by Title")
|
self.updateProgressFullStep("Generating 'Titles'")
|
||||||
|
|
||||||
soup = self.generateHTMLEmptyHeader("Books By Alpha Title")
|
soup = self.generateHTMLEmptyHeader("Books By Alpha Title")
|
||||||
body = soup.find('body')
|
body = soup.find('body')
|
||||||
@ -1171,7 +1171,7 @@ class EPUB_MOBI(CatalogPlugin):
|
|||||||
|
|
||||||
def generateHTMLByAuthor(self):
|
def generateHTMLByAuthor(self):
|
||||||
# Write books by author A-Z
|
# Write books by author A-Z
|
||||||
self.updateProgressFullStep("Books by Author")
|
self.updateProgressFullStep("Generating 'Authors'")
|
||||||
|
|
||||||
friendly_name = "By Author"
|
friendly_name = "By Author"
|
||||||
|
|
||||||
@ -1301,7 +1301,7 @@ class EPUB_MOBI(CatalogPlugin):
|
|||||||
|
|
||||||
def generateHTMLByDateAdded(self):
|
def generateHTMLByDateAdded(self):
|
||||||
# Write books by reverse chronological order
|
# Write books by reverse chronological order
|
||||||
self.updateProgressFullStep("Recently Added")
|
self.updateProgressFullStep("Generating 'Recently Added'")
|
||||||
|
|
||||||
def add_books_to_HTML(this_months_list, dtc):
|
def add_books_to_HTML(this_months_list, dtc):
|
||||||
if len(this_months_list):
|
if len(this_months_list):
|
||||||
@ -1718,7 +1718,7 @@ class EPUB_MOBI(CatalogPlugin):
|
|||||||
|
|
||||||
def generateNCXHeader(self):
|
def generateNCXHeader(self):
|
||||||
|
|
||||||
self.updateProgressFullStep("NCX header")
|
self.updateProgressFullStep("Generating NCX header")
|
||||||
|
|
||||||
header = '''
|
header = '''
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
@ -1754,7 +1754,7 @@ class EPUB_MOBI(CatalogPlugin):
|
|||||||
|
|
||||||
def generateNCXDescriptions(self, tocTitle):
|
def generateNCXDescriptions(self, tocTitle):
|
||||||
|
|
||||||
self.updateProgressFullStep("NCX descriptions")
|
self.updateProgressFullStep("Generating NCX for 'Descriptions'")
|
||||||
|
|
||||||
# --- Construct the 'Books by Title' section ---
|
# --- Construct the 'Books by Title' section ---
|
||||||
ncx_soup = self.ncxSoup
|
ncx_soup = self.ncxSoup
|
||||||
@ -1825,7 +1825,7 @@ class EPUB_MOBI(CatalogPlugin):
|
|||||||
self.ncxSoup = ncx_soup
|
self.ncxSoup = ncx_soup
|
||||||
|
|
||||||
def generateNCXByTitle(self, tocTitle):
|
def generateNCXByTitle(self, tocTitle):
|
||||||
self.updateProgressFullStep("NCX Titles")
|
self.updateProgressFullStep("Generating NCX for 'Titles'")
|
||||||
|
|
||||||
def add_to_books_by_letter(current_book_list):
|
def add_to_books_by_letter(current_book_list):
|
||||||
current_book_list = " • ".join(current_book_list)
|
current_book_list = " • ".join(current_book_list)
|
||||||
@ -1914,7 +1914,7 @@ class EPUB_MOBI(CatalogPlugin):
|
|||||||
self.ncxSoup = soup
|
self.ncxSoup = soup
|
||||||
|
|
||||||
def generateNCXByAuthor(self, tocTitle):
|
def generateNCXByAuthor(self, tocTitle):
|
||||||
self.updateProgressFullStep("NCX Authors")
|
self.updateProgressFullStep("Generating NCX for 'Authors'")
|
||||||
|
|
||||||
def add_to_author_list(current_author_list, current_letter):
|
def add_to_author_list(current_author_list, current_letter):
|
||||||
current_author_list = " • ".join(current_author_list)
|
current_author_list = " • ".join(current_author_list)
|
||||||
@ -2003,7 +2003,7 @@ class EPUB_MOBI(CatalogPlugin):
|
|||||||
self.ncxSoup = soup
|
self.ncxSoup = soup
|
||||||
|
|
||||||
def generateNCXByDateAdded(self, tocTitle):
|
def generateNCXByDateAdded(self, tocTitle):
|
||||||
self.updateProgressFullStep("NCX Recently Added")
|
self.updateProgressFullStep("Generating NCX for 'Recently Added'")
|
||||||
|
|
||||||
def add_to_master_month_list(current_titles_list):
|
def add_to_master_month_list(current_titles_list):
|
||||||
book_count = len(current_titles_list)
|
book_count = len(current_titles_list)
|
||||||
@ -2105,7 +2105,7 @@ class EPUB_MOBI(CatalogPlugin):
|
|||||||
# Add each genre as an article
|
# Add each genre as an article
|
||||||
# 'tag', 'file', 'authors'
|
# 'tag', 'file', 'authors'
|
||||||
|
|
||||||
self.updateProgressFullStep("NCX by Genre")
|
self.updateProgressFullStep("Generating NCX for Genres")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -2270,6 +2270,13 @@ class EPUB_MOBI(CatalogPlugin):
|
|||||||
# Remove the special marker tags from the database's tag list,
|
# Remove the special marker tags from the database's tag list,
|
||||||
# return sorted list of tags representing valid genres
|
# return sorted list of tags representing valid genres
|
||||||
|
|
||||||
|
def next_tag(tags):
|
||||||
|
for (i, tag) in enumerate(tags):
|
||||||
|
if i < len(tags) - 1:
|
||||||
|
yield tag + ", "
|
||||||
|
else:
|
||||||
|
yield tag
|
||||||
|
|
||||||
filtered_tags = []
|
filtered_tags = []
|
||||||
for tag in tags:
|
for tag in tags:
|
||||||
if tag[0] in self.markerTags:
|
if tag[0] in self.markerTags:
|
||||||
@ -2295,7 +2302,14 @@ class EPUB_MOBI(CatalogPlugin):
|
|||||||
if self.verbose:
|
if self.verbose:
|
||||||
self.opts.log.info(u' %d Genre tags in database (exclude_genre: %s):' % \
|
self.opts.log.info(u' %d Genre tags in database (exclude_genre: %s):' % \
|
||||||
(len(filtered_tags), self.opts.exclude_genre))
|
(len(filtered_tags), self.opts.exclude_genre))
|
||||||
self.opts.log.info(u' %s' % ', '.join(filtered_tags))
|
out_buf = ''
|
||||||
|
|
||||||
|
for tag in next_tag(filtered_tags):
|
||||||
|
out_buf += tag
|
||||||
|
if len(out_buf) > 72:
|
||||||
|
self.opts.log(u' %s' % out_buf.rstrip())
|
||||||
|
out_buf = ''
|
||||||
|
self.opts.log(u' %s' % out_buf)
|
||||||
|
|
||||||
return filtered_tags
|
return filtered_tags
|
||||||
|
|
||||||
@ -2633,6 +2647,8 @@ class EPUB_MOBI(CatalogPlugin):
|
|||||||
self.progressString = description
|
self.progressString = description
|
||||||
self.progressInt = float((self.current_step-1)/self.total_steps)
|
self.progressInt = float((self.current_step-1)/self.total_steps)
|
||||||
self.reporter(self.progressInt, self.progressString)
|
self.reporter(self.progressInt, self.progressString)
|
||||||
|
if self.opts.cli_environment:
|
||||||
|
self.opts.log(u"%3.0f%% %s" % (self.progressInt*100, self.progressString))
|
||||||
|
|
||||||
def updateProgressMicroStep(self, description, micro_step_pct):
|
def updateProgressMicroStep(self, description, micro_step_pct):
|
||||||
step_range = 100/self.total_steps
|
step_range = 100/self.total_steps
|
||||||
@ -2655,12 +2671,13 @@ class EPUB_MOBI(CatalogPlugin):
|
|||||||
opts.descriptionClip = 380 if op.endswith('dx') or 'kindle' not in op else 90
|
opts.descriptionClip = 380 if op.endswith('dx') or 'kindle' not in op else 90
|
||||||
opts.basename = "Catalog"
|
opts.basename = "Catalog"
|
||||||
opts.plugin_path = self.plugin_path
|
opts.plugin_path = self.plugin_path
|
||||||
|
opts.cli_environment = getattr(opts,'sync',True)
|
||||||
|
|
||||||
if opts.verbose:
|
if opts.verbose:
|
||||||
opts_dict = vars(opts)
|
opts_dict = vars(opts)
|
||||||
gui = True if 'sync' in opts_dict else False
|
log("%s(): Generating %s for %s in %s environment" %
|
||||||
log("%s(): Generating %s for %s in %s environment" % \
|
(self.name,self.fmt,opts.output_profile,
|
||||||
(self.name,self.fmt,opts.output_profile, 'GUI' if gui else 'CLI'))
|
'CLI' if opts.cli_environment else 'GUI'))
|
||||||
if opts_dict['ids']:
|
if opts_dict['ids']:
|
||||||
log(" Book count: %d" % len(opts_dict['ids']))
|
log(" Book count: %d" % len(opts_dict['ids']))
|
||||||
# Display opts
|
# Display opts
|
||||||
@ -2674,13 +2691,14 @@ class EPUB_MOBI(CatalogPlugin):
|
|||||||
log(" %s: %s" % (key, opts_dict[key]))
|
log(" %s: %s" % (key, opts_dict[key]))
|
||||||
|
|
||||||
# Launch the Catalog builder
|
# Launch the Catalog builder
|
||||||
|
if opts.verbose:
|
||||||
|
log.info("Begin generating catalog source")
|
||||||
catalog = self.CatalogBuilder(db, opts, self, report_progress=notification)
|
catalog = self.CatalogBuilder(db, opts, self, report_progress=notification)
|
||||||
catalog.createDirectoryStructure()
|
catalog.createDirectoryStructure()
|
||||||
catalog.copyResources()
|
catalog.copyResources()
|
||||||
catalog.buildSources()
|
catalog.buildSources()
|
||||||
|
|
||||||
if opts.verbose:
|
if opts.verbose:
|
||||||
log.info("Catalog source generation complete")
|
log.info("Finished generating catalog source\n")
|
||||||
|
|
||||||
recommendations = []
|
recommendations = []
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user