From aa93d4bb2df983b4268147a3d3f63b4cf0cc1f34 Mon Sep 17 00:00:00 2001 From: Dmitry Kozliuk Date: Wed, 22 Jul 2015 14:31:06 +0300 Subject: [PATCH] Set site-specific language and category correctly. --- calibre-plugin/plugin-defaults.ini | 11 +++++++++++ fanficfare/adapters/adapter_masseffect2in.py | 5 +++++ fanficfare/defaults.ini | 5 +++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/calibre-plugin/plugin-defaults.ini b/calibre-plugin/plugin-defaults.ini index da2f078..94cd796 100644 --- a/calibre-plugin/plugin-defaults.ini +++ b/calibre-plugin/plugin-defaults.ini @@ -1132,6 +1132,17 @@ extracategories:Lord of the Rings ## Site dedicated to these categories/characters/ships extracategories:Harry Potter +[www.masseffect2.in] +## Site dedicated to this fandom. +extracategories: Mass Effect + +## Stories on the site almost never have cover image. +## May be adjusted in `personal.ini' on per-story basis. +cover_exclusion_regexp:.* + +my_custom_label: Some text +my_custom_setting: true + [merlinfic.dtwins.co.uk] ## Some sites require login (or login for some rated stories) The ## program can prompt you, or you can save it in config. In diff --git a/fanficfare/adapters/adapter_masseffect2in.py b/fanficfare/adapters/adapter_masseffect2in.py index 2347695..80d5446 100644 --- a/fanficfare/adapters/adapter_masseffect2in.py +++ b/fanficfare/adapters/adapter_masseffect2in.py @@ -99,6 +99,8 @@ class MassEffect2InAdapter(BaseSiteAdapter): ''', re.IGNORECASE + re.UNICODE + re.VERBOSE) + SITE_LANGUAGE = u'Russian' + def __init__(self, config, url): BaseSiteAdapter.__init__(self, config, url) @@ -225,6 +227,9 @@ class MassEffect2InAdapter(BaseSiteAdapter): 'numWords', str(self._transient_metadata['numWords'])) self.story.setMetadata( 'numChapters', self._transient_metadata['numChapters']) + # Site-specific metadata. + self.story.setMetadata( + 'language', self.SITE_LANGUAGE) def getChapterText(self, url): """Grabs the text for an individual chapter.""" diff --git a/fanficfare/defaults.ini b/fanficfare/defaults.ini index fe75370..231b154 100644 --- a/fanficfare/defaults.ini +++ b/fanficfare/defaults.ini @@ -1728,8 +1728,6 @@ extraships:InuYasha/Kagome extracategories:Lord of the Rings [www.masseffect2.in] -## Site with stories in this language. -language:Russian ## Site dedicated to this fandom. extracategories:Mass Effect @@ -1737,6 +1735,9 @@ extracategories:Mass Effect ## May be adjusted in `personal.ini' on per-story basis. cover_exclusion_regexp:.* +my_custom_label:Some text +my_custom_setting:true + [www.mediaminer.org] [www.midnightwhispers.ca]