From 7cae65300a31c13d6e9ff262b0570ec92bda7ae0 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Sat, 31 Aug 2013 15:38:44 -0500 Subject: [PATCH] Feature: add_genre_when_multi_category setting --- defaults.ini | 3 +++ fanficdownloader/story.py | 3 +++ plugin-defaults.ini | 3 +++ plugin-example.ini | 3 +++ 4 files changed, 12 insertions(+) diff --git a/defaults.ini b/defaults.ini index 6c27300..15eb143 100644 --- a/defaults.ini +++ b/defaults.ini @@ -152,6 +152,9 @@ extratags: FanFiction #extraships: #extrawarnings: +## Add this to genre if there's more than one category. +#add_genre_when_multi_category: Crossover + ## number of seconds to sleep between calls to the story site. May by ## useful if pulling large numbers of stories or if the site is slow. #slow_down_sleep_time:0.5 diff --git a/fanficdownloader/story.py b/fanficdownloader/story.py index 4256c67..1137060 100644 --- a/fanficdownloader/story.py +++ b/fanficdownloader/story.py @@ -411,6 +411,9 @@ class Story(Configurable): if not value in self.metadata[listname]: self.metadata[listname].append(value) + if listname == 'category' and self.getConfig('add_genre_when_multi_category') and len(self.metadata[listname]) > 1: + self.addToList('genre',self.getConfig('add_genre_when_multi_category')) + def isList(self,listname): 'Everything set with an include_in_* is considered a list.' return self.hasConfig("include_in_"+listname) or \ diff --git a/plugin-defaults.ini b/plugin-defaults.ini index 4861ee5..c6d0e0c 100644 --- a/plugin-defaults.ini +++ b/plugin-defaults.ini @@ -124,6 +124,9 @@ extratags: FanFiction #extraships: #extrawarnings: +## Add this to genre if there's more than one category. +#add_genre_when_multi_category: Crossover + ## number of seconds to sleep between calls to the story site. May by ## useful if pulling large numbers of stories or if the site is slow. #slow_down_sleep_time:0.5 diff --git a/plugin-example.ini b/plugin-example.ini index a0b9237..3080bd9 100644 --- a/plugin-example.ini +++ b/plugin-example.ini @@ -15,6 +15,9 @@ #strip_chapter_numbers:true #add_chapter_numbers:true +## Add this to genre if there's more than one category. +#add_genre_when_multi_category: Crossover + [epub] ## include images from img tags in the body and summary of stories. ## Images will be converted to jpg for size if possible. Images work