From 3306b11a4fda13ae27e47fc698b6365eb75cae5a Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Mon, 25 May 2015 15:47:57 -0500 Subject: [PATCH 1/2] Change AO3 genre & category to fill with freeformtags, ao3categories & fandoms from defaults.ini instead of by hardcode. --- calibre-plugin/plugin-defaults.ini | 14 +++++++++++++- .../adapters/adapter_archiveofourownorg.py | 3 --- fanficfare/defaults.ini | 16 +++++++++++++++- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/calibre-plugin/plugin-defaults.ini b/calibre-plugin/plugin-defaults.ini index 358e1ad9..17f2acf3 100644 --- a/calibre-plugin/plugin-defaults.ini +++ b/calibre-plugin/plugin-defaults.ini @@ -593,6 +593,18 @@ hits_label:Hits collections_label:Collections bookmarks_label:Bookmarks +## AO3 doesn't have anything it calls 'genre'. The adapter used to be +## hardcoded to include the site specific metadata freeformtags & +## ao3categories in the standard metadata field genre. By making it +## configurable, users can change it. +include_in_genre: freeformtags, ao3categories + +## AO3 uses the word 'category' differently than most sites. The +## adapter used to be hardcoded to include the site specific metadata +## fandom in the standard metadata field category. By making it +## configurable, users can change it. +include_in_category:fandoms + ## freeformtags was previously typo'ed as freefromtags. This way, ## freefromtags will still work for people who've used it. include_in_freefromtags:freeformtags @@ -604,7 +616,7 @@ include_in_freefromtags:freeformtags #extra_subject_tags:fandoms,freeformtags,ao3categories ## AO3 chapters can include several different types of notes. We've -## traditional included them all in the chapter text, but this allows +## traditionally included them all in the chapter text, but this allows ## you to customize which you include. Copy this parameter to your ## personal.ini and list the ones you don't want. #exclude_notes:authorheadnotes,chaptersummary,chapterheadnotes,chapterfootnotes,authorfootnotes diff --git a/fanficfare/adapters/adapter_archiveofourownorg.py b/fanficfare/adapters/adapter_archiveofourownorg.py index 5dcae714..32f56677 100644 --- a/fanficfare/adapters/adapter_archiveofourownorg.py +++ b/fanficfare/adapters/adapter_archiveofourownorg.py @@ -230,7 +230,6 @@ class ArchiveOfOurOwnOrgAdapter(BaseSiteAdapter): fandoms = a.findAll('a',{'class':"tag"}) for fandom in fandoms: self.story.addToList('fandoms',fandom.string) - self.story.addToList('category',fandom.string) a = metasoup.find('dd',{'class':"warning tags"}) if a != None: @@ -243,7 +242,6 @@ class ArchiveOfOurOwnOrgAdapter(BaseSiteAdapter): genres = a.findAll('a',{'class':"tag"}) for genre in genres: self.story.addToList('freeformtags',genre.string) - self.story.addToList('genre',genre.string) a = metasoup.find('dd',{'class':"category tags"}) if a != None: @@ -251,7 +249,6 @@ class ArchiveOfOurOwnOrgAdapter(BaseSiteAdapter): for genre in genres: if genre != "Gen": self.story.addToList('ao3categories',genre.string) - self.story.addToList('genre',genre.string) a = metasoup.find('dd',{'class':"character tags"}) if a != None: diff --git a/fanficfare/defaults.ini b/fanficfare/defaults.ini index b6294dcc..150731f2 100644 --- a/fanficfare/defaults.ini +++ b/fanficfare/defaults.ini @@ -597,6 +597,18 @@ hits_label:Hits collections_label:Collections bookmarks_label:Bookmarks +## AO3 doesn't have anything it calls 'genre'. The adapter used to be +## hardcoded to include the site specific metadata freeformtags & +## ao3categories in the standard metadata field genre. By making it +## configurable, users can change it. +include_in_genre: freeformtags, ao3categories + +## AO3 uses the word 'category' differently than most sites. The +## adapter used to be hardcoded to include the site specific metadata +## fandom in the standard metadata field category. By making it +## configurable, users can change it. +include_in_category:fandoms + ## freeformtags was previously typo'ed as freefromtags. This way, ## freefromtags will still work for people who've used it. include_in_freefromtags:freeformtags @@ -608,7 +620,7 @@ include_in_freefromtags:freeformtags #extra_subject_tags:fandoms,freeformtags,ao3categories ## AO3 chapters can include several different types of notes. We've -## traditional included them all in the chapter text, but this allows +## traditionally included them all in the chapter text, but this allows ## you to customize which you include. Copy this parameter to your ## personal.ini and list the ones you don't want. #exclude_notes:authorheadnotes,chaptersummary,chapterheadnotes,chapterfootnotes,authorfootnotes @@ -1466,6 +1478,8 @@ extra_titlepage_entries:readings,awards awards_label:Awards readings_label:Readings +## some sites include images that we don't ever want becoming the +## cover image. This lets you exclude them. cover_exclusion_regexp:art/.*Awards.jpg [voracity2.e-fic.com] From 9658a2552b7d7afaf7012a9b7c12dc3427a57d31 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Mon, 25 May 2015 19:59:15 -0500 Subject: [PATCH 2/2] Don't flag ini error on do_update_hook in [archiveofourown.org]. --- fanficfare/configurable.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fanficfare/configurable.py b/fanficfare/configurable.py index 9d4623c8..e6f6ee80 100644 --- a/fanficfare/configurable.py +++ b/fanficfare/configurable.py @@ -142,7 +142,8 @@ def get_valid_set_options(): 'fix_fimf_blockquotes':(['fimfiction.net'],None,boollist), 'fail_on_password':(['fimfiction.net'],None,boollist), - 'do_update_hook':(['fimfiction.net'],None,boollist), + 'do_update_hook':(['fimfiction.net', + 'archiveofourown.org'],None,boollist), 'force_login':(['phoenixsong.net'],None,boollist), 'non_breaking_spaces':(['fictionmania.tv'],None,boollist),