From 91a7ce01a3870ee88928a0928694bf4473fe33db Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Thu, 3 Jun 2021 11:20:23 -0500 Subject: [PATCH] Collect 'fandoms' for adapter_scribblehubcom. --- calibre-plugin/plugin-defaults.ini | 4 ++-- fanficfare/adapters/adapter_scribblehubcom.py | 6 ++++++ fanficfare/defaults.ini | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/calibre-plugin/plugin-defaults.ini b/calibre-plugin/plugin-defaults.ini index a066e433..010b4299 100644 --- a/calibre-plugin/plugin-defaults.ini +++ b/calibre-plugin/plugin-defaults.ini @@ -3505,10 +3505,10 @@ website_encodings:Windows-1252,utf8 [www.scribblehub.com] use_basic_cache:true -extra_valid_entries:views, averageWords +extra_valid_entries:views, averageWords, fandoms views_label:Views averageWords_label:Average Words (Chapter) -add_to_titlepage_entries:,views, averageWords +add_to_titlepage_entries:,views, averageWords, fandoms ## Scribble Hub chapters can include author's notes and news blocks. We've ## traditionally included them all in the chapter text, but this allows diff --git a/fanficfare/adapters/adapter_scribblehubcom.py b/fanficfare/adapters/adapter_scribblehubcom.py index 394784a2..37c5a39d 100644 --- a/fanficfare/adapters/adapter_scribblehubcom.py +++ b/fanficfare/adapters/adapter_scribblehubcom.py @@ -181,6 +181,12 @@ class ScribbleHubComAdapter(BaseSiteAdapter): # XXX for genre in genres: self.story.addToList('genre', stripHTML(genre)) + # Fandoms + if soup.find('div', string="Fandom"): + fandoms = soup.find('div', string="Fandom").next_sibling.find_all('a') + for fandom in fandoms: + self.story.addToList('fandoms', stripHTML(fandom)) + # Content Warnings if soup.find('ul',{'class': 'ul_rate_expand'}): warnings = soup.find('ul',{'class': 'ul_rate_expand'}).findAll('a') diff --git a/fanficfare/defaults.ini b/fanficfare/defaults.ini index c0f39402..a4bbb55e 100644 --- a/fanficfare/defaults.ini +++ b/fanficfare/defaults.ini @@ -3500,10 +3500,10 @@ website_encodings:Windows-1252,utf8 [www.scribblehub.com] use_basic_cache:true -extra_valid_entries:views, averageWords +extra_valid_entries:views, averageWords, fandoms views_label:Views averageWords_label:Average Words (Chapter) -add_to_titlepage_entries:,views, averageWords +add_to_titlepage_entries:,views, averageWords, fandoms ## Scribble Hub chapters can include author's notes and news blocks. We've ## traditionally included them all in the chapter text, but this allows