diff --git a/calibre-plugin/config.py b/calibre-plugin/config.py index 4ebfeb79..ab6dfc51 100644 --- a/calibre-plugin/config.py +++ b/calibre-plugin/config.py @@ -173,6 +173,7 @@ class ConfigWidget(QWidget): prefs['adddialogstaysontop'] = self.basic_tab.adddialogstaysontop.isChecked() prefs['includeimages'] = self.basic_tab.includeimages.isChecked() prefs['lookforurlinhtml'] = self.basic_tab.lookforurlinhtml.isChecked() + prefs['checkforseriesurlid'] = self.basic_tab.checkforseriesurlid.isChecked() prefs['injectseries'] = self.basic_tab.injectseries.isChecked() if self.readinglist_tab: @@ -369,6 +370,11 @@ class BasicTab(QWidget): self.lookforurlinhtml.setChecked(prefs['lookforurlinhtml']) self.l.addWidget(self.lookforurlinhtml) + self.checkforseriesurlid = QCheckBox("Check for existing Series Anthology books?",self) + self.checkforseriesurlid.setToolTip("Check for existings Series Anthology books using each new story's series URL before downloading.\nOffer to skip downloading if a Series Anthology is found.") + self.checkforseriesurlid.setChecked(prefs['checkforseriesurlid']) + self.l.addWidget(self.checkforseriesurlid) + self.injectseries = QCheckBox("Inject calibre Series when none found?",self) self.injectseries.setToolTip("If no series is found, inject the calibre series (if there is one) so it appears on the FFDL title page(not cover).") self.injectseries.setChecked(prefs['injectseries']) diff --git a/calibre-plugin/ffdl_plugin.py b/calibre-plugin/ffdl_plugin.py index 7a48f2c3..dd2fc962 100644 --- a/calibre-plugin/ffdl_plugin.py +++ b/calibre-plugin/ffdl_plugin.py @@ -741,6 +741,30 @@ class FanFictionDownLoaderPlugin(InterfaceAction): # let other exceptions percolate up. story = adapter.getStoryMetadataOnly() + series = story.getMetadata('series') + if not merge and series and prefs['checkforseriesurlid']: + # try to find *series anthology* by *seriesUrl* identifier url or uri first. + searchstr = 'identifiers:"~ur(i|l):=%s"'%story.getMetadata('seriesUrl').replace(":","|") + identicalbooks = db.search_getting_ids(searchstr, None) + # print("searchstr:%s"%searchstr) + # print("identicalbooks:%s"%identicalbooks) + if len(identicalbooks) > 0 and question_dialog(self.gui, 'Skip Story?', + '

Skip Anthology Story?

'+ + '

Story "%s" is in series "%s" that you have an anthology book for.

'% + (story.getMetadata('title'),story.getMetadata('seriesUrl'),series[:series.index(' [')])+ + "

Click 'No' to download anyway.

", + show_copy_button=False): + book['comment'] = "Story in Series Anthology(%s)."%series + book['title'] = story.getMetadata('title') + book['author'] = [story.getMetadata('author')] + book['good']=False + book['icon']='rotate-right.png' + book['status'] = 'Skipped' + return + + + ################################################################################################################################################33 + # set PI version instead of default. if 'version' in options: story.setMetadata('version',options['version']) diff --git a/calibre-plugin/prefs.py b/calibre-plugin/prefs.py index f529534a..7eb759df 100644 --- a/calibre-plugin/prefs.py +++ b/calibre-plugin/prefs.py @@ -39,6 +39,7 @@ default_prefs['deleteotherforms'] = False default_prefs['adddialogstaysontop'] = False default_prefs['includeimages'] = False default_prefs['lookforurlinhtml'] = False +default_prefs['checkforseriesurlid'] = True default_prefs['injectseries'] = False default_prefs['send_lists'] = ''