Set Calibre Series URL link.

This commit is contained in:
Jim Miller 2023-04-01 14:53:20 -05:00
parent 98a5a120c1
commit cf7f84c886
3 changed files with 26 additions and 5 deletions

View file

@ -374,6 +374,7 @@ class ConfigWidget(QWidget):
prefs['setanthologyseries'] = self.std_columns_tab.setanthologyseries.isChecked()
prefs['set_author_url'] =self.std_columns_tab.set_author_url.isChecked()
prefs['set_series_url'] =self.std_columns_tab.set_series_url.isChecked()
prefs['includecomments'] =self.std_columns_tab.includecomments.isChecked()
prefs['anth_comments_newonly'] =self.std_columns_tab.anth_comments_newonly.isChecked()
@ -1578,17 +1579,29 @@ class StandardColumnsTab(QWidget):
self.titlecase.setChecked(prefs['titlecase'])
row.append(self.titlecase)
elif key == 'authors':
self.set_author_url = QCheckBox(_('Set Calibre Author URL'),self)
self.set_author_url.setToolTip(_("Set Calibre Author URL to Author's URL on story site."))
self.set_author_url.setChecked(prefs['set_author_url'])
row.append(self.set_author_url)
self.suppressauthorsort = QCheckBox(_('Force Author into Author Sort?'),self)
self.suppressauthorsort.setToolTip(_("If checked, the author(s) as given will be used for the Author Sort, too.\nIf not checked, calibre will apply it's built in algorithm which makes 'Bob Smith' sort as 'Smith, Bob', etc."))
self.suppressauthorsort.setChecked(prefs['suppressauthorsort'])
row.append(self.suppressauthorsort)
self.authorcase = QCheckBox(_('Fix Author Case?'),self)
self.authorcase.setToolTip(_("If checked, Calibre's routine for correcting the capitalization of author names will be applied.")
+"\n"+_("Calibre remembers all authors in the library; changing the author case on one book will effect all books by that author.")
+"\n"+_("This effects Calibre metadata only, not FanFicFare metadata in title page."))
self.authorcase.setChecked(prefs['authorcase'])
row.append(self.authorcase)
elif key == 'series':
self.set_series_url = QCheckBox(_('Set Calibre Series URL'),self)
self.set_series_url.setToolTip(_("Set Calibre Series URL to Series's URL on story site."))
self.set_series_url.setChecked(prefs['set_series_url'])
row.append(self.set_series_url)
self.setanthologyseries = QCheckBox(_("Set 'Series [0]' for New Anthologies?"),self)
self.setanthologyseries.setToolTip(_("If checked, the Series column will be set to 'Series Name [0]' when an Anthology for a series is first created."))
self.setanthologyseries.setChecked(prefs['setanthologyseries'])
@ -1606,11 +1619,6 @@ class StandardColumnsTab(QWidget):
self.l.addWidget(label)
self.l.addSpacing(5)
self.set_author_url = QCheckBox(_('Set Calibre Author URL'),self)
self.set_author_url.setToolTip(_("Set Calibre Author URL to Author's URL on story site."))
self.set_author_url.setChecked(prefs['set_author_url'])
self.l.addWidget(self.set_author_url)
self.includecomments = QCheckBox(_("Include Books' Comments in Anthology Comments?"),self)
self.includecomments.setToolTip(_('''Include all the merged books' comments in the new book's comments.
Default is a list of included titles only.'''))

View file

@ -2444,6 +2444,18 @@ class FanFicFarePlugin(InterfaceAction):
if author_id_to_link_map:
db.new_api.set_link_for_authors(author_id_to_link_map)
# set series link if found.
logger.debug("has link_map:%s"%(hasattr(db.new_api,'set_link_map')))
## new_api.set_link_map added in Calibre v6.15
if hasattr(db.new_api,'set_link_map') and \
prefs['set_series_url'] and \
book['all_metadata'].get('seriesUrl',False):
series = book['series']
if '[' in series: # a few can have a series w/o number
series = series[:series.index(' [')]
db.new_api.set_link_map('series',{series:
book['all_metadata']['seriesUrl']})
db.commit()
logger.info("cover_image:%s"%book['all_metadata']['cover_image'])

View file

@ -182,6 +182,7 @@ default_prefs['allow_custcol_from_ini'] = True
default_prefs['std_cols_newonly'] = {}
default_prefs['set_author_url'] = True
default_prefs['set_series_url'] = True
default_prefs['includecomments'] = False
default_prefs['anth_comments_newonly'] = True