GwR catalog comments

This commit is contained in:
GRiker 2010-02-18 10:15:09 -07:00
parent 7d69048a4b
commit 1dbbd470a0

View File

@ -3404,6 +3404,19 @@ class EPUB_MOBI(CatalogPlugin):
tag_list.append(tag)
return tag_list
def updateCatalogMetadata(self, comments):
''' Store comments to library entry's comments metadata '''
self.db.search('title:"%s" author:calibre' % self.title)
data = self.db.get_data_as_dict()
if data:
catalog_id = data[0]['id']
cm = self.db.get_metadata(catalog_id, index_is_id=True)
cm.comments = comments
self.db.set_metadata(catalog_id, cm)
else:
self.opts.log(u"updateCatalogMetadata(): No library entry found for catalog '%s'" % self.title)
return
def updateProgressFullStep(self, description):
self.currentStep += 1
self.progressString = description
@ -3516,6 +3529,9 @@ class EPUB_MOBI(CatalogPlugin):
recommendations = []
# recommendations.append(('cover', I('catalog.svg'), OptionRecommendation.HIGH))
recommendations.append(('comments', 'I added this comment in library.cli:run()',
OptionRecommendation.HIGH))
dp = getattr(opts, 'debug_pipeline', None)
if dp is not None:
recommendations.append(('debug_pipeline', dp,
@ -3537,6 +3553,7 @@ class EPUB_MOBI(CatalogPlugin):
plumber.merge_ui_recommendations(recommendations)
plumber.run()
catalog.updateCatalogMetadata("I added this comment from library.catalog:run()")
return 0
else:
return 1