diff --git a/calibre-plugin/plugin-defaults.ini b/calibre-plugin/plugin-defaults.ini index 26466f63..e9b516e4 100644 --- a/calibre-plugin/plugin-defaults.ini +++ b/calibre-plugin/plugin-defaults.ini @@ -731,9 +731,6 @@ add_to_extra_valid_entries:,storynotes storynotes_label:Story Notes add_to_extra_titlepage_entries:,storynotes -[base_otw] -use_basic_cache:true - [base_xenforoforum] ## NOTE: There are no supported XenForo1 sites anymore, only XenForo2 ## site. The [base_xenforoforum] section is kept for backward @@ -1765,6 +1762,9 @@ extraships:Severus Snape/Hermione Granger website_encodings:Windows-1252,utf8 +[base_otw] +use_basic_cache:true + [bloodshedverse.com] use_basic_cache:true ## website encoding(s) In theory, each website reports the character @@ -2118,71 +2118,6 @@ use_basic_cache:true #username:YourName #password:yourpassword -[finestories.com] -use_basic_cache:true -## Some sites require login (or login for some rated stories) The -## program can prompt you, or you can save it in config. In -## commandline version, this should go in your personal.ini, not -## defaults.ini. -## finestories.com has started requiring login by email rather than -## pen name. -#username:youremail@yourdomain.dom -#password:yourpassword - -## In order to see some protected stories, login is required, -## but not indicated anyway we can detect. Requires valid -## username and password when true. -#always_login:true - -## dateUpdated/datePublished don't usually have time, but they do on this site. -## http://docs.python.org/library/datetime.html#strftime-strptime-behavior -## Note that ini format requires % to be escaped as %%. -dateUpdated_format:%%Y-%%m-%%d %%H:%%M:%%S -datePublished_format:%%Y-%%m-%%d %%H:%%M:%%S - -## Clear FanFiction from defaults, site is original fiction. -extratags: - -extra_valid_entries:size,universe,universeUrl,universeHTML,sitetags,notice,codes,score -#extra_titlepage_entries:size,universeHTML,sitetags,notice,score -include_in_codes:sitetags - -## adds to include_subject_tags instead of replacing it. -#extra_subject_tags:sitetags - -size_label:Size -universe_label:Universe -universeUrl_label:Universe URL -universeHTML_label:Universe -sitetags_label:Site Tags -notice_label:Notice -score_label:Score - -## Assume entryUrl, apply to "%s" to -## make entryHTML. -make_linkhtml_entries:universe - -## finestories.com stories can be in a series and/or a universe. By -## default, series will be populated with the universe if there is -## universe but not series. -universe_as_series: true - -## some sites include images that we don't ever want becoming the -## cover image. This lets you exclude them. -cover_exclusion_regexp:/css/bir.png - -## This site uses shortened title chapters in chapter lists. When set -## true, this will inject the site's full length chapter title into -## the chapter text in a smaller h4 tag. -#inject_chapter_title:false - -## append_datepublished_to_storyurl literally appends -## datePublished(-%Y-%m-%d) to storyUrl. This is an ugly kludge to -## (hopefully) help address the site's unfortunately habit of -## *reusing* storyId numbers. Off by default to *not* cause weirdness -## for those not expecting it. -#append_datepublished_to_storyurl:false - [forum.questionablequesting.com] ## see [base_xenforoforum] @@ -2829,6 +2764,71 @@ cover_exclusion_regexp:/css/bir.png ## for those not expecting it. #append_datepublished_to_storyurl:false +[storyroom.com] +use_basic_cache:true +## Some sites require login (or login for some rated stories) The +## program can prompt you, or you can save it in config. In +## commandline version, this should go in your personal.ini, not +## defaults.ini. +## storyroom.com has started requiring login by email rather than +## pen name. +#username:youremail@yourdomain.dom +#password:yourpassword + +## In order to see some protected stories, login is required, +## but not indicated anyway we can detect. Requires valid +## username and password when true. +#always_login:true + +## dateUpdated/datePublished don't usually have time, but they do on this site. +## http://docs.python.org/library/datetime.html#strftime-strptime-behavior +## Note that ini format requires % to be escaped as %%. +dateUpdated_format:%%Y-%%m-%%d %%H:%%M:%%S +datePublished_format:%%Y-%%m-%%d %%H:%%M:%%S + +## Clear FanFiction from defaults, site is original fiction. +extratags: + +extra_valid_entries:size,universe,universeUrl,universeHTML,sitetags,notice,codes,score +#extra_titlepage_entries:size,universeHTML,sitetags,notice,score +include_in_codes:sitetags + +## adds to include_subject_tags instead of replacing it. +#extra_subject_tags:sitetags + +size_label:Size +universe_label:Universe +universeUrl_label:Universe URL +universeHTML_label:Universe +sitetags_label:Site Tags +notice_label:Notice +score_label:Score + +## Assume entryUrl, apply to "%s" to +## make entryHTML. +make_linkhtml_entries:universe + +## storyroom.com stories can be in a series and/or a universe. By +## default, series will be populated with the universe if there is +## universe but not series. +universe_as_series: true + +## some sites include images that we don't ever want becoming the +## cover image. This lets you exclude them. +cover_exclusion_regexp:/css/bir.png + +## This site uses shortened title chapters in chapter lists. When set +## true, this will inject the site's full length chapter title into +## the chapter text in a smaller h4 tag. +#inject_chapter_title:false + +## append_datepublished_to_storyurl literally appends +## datePublished(-%Y-%m-%d) to storyUrl. This is an ugly kludge to +## (hopefully) help address the site's unfortunately habit of +## *reusing* storyId numbers. Off by default to *not* cause weirdness +## for those not expecting it. +#append_datepublished_to_storyurl:false + [superlove.sayitditto.net] ## This is a OTW-archive site. Note that ao3categories is still used, ## but labeled "superlove Categories". diff --git a/fanficfare/adapters/__init__.py b/fanficfare/adapters/__init__.py index b20b39c1..f1a780ed 100644 --- a/fanficfare/adapters/__init__.py +++ b/fanficfare/adapters/__init__.py @@ -65,7 +65,6 @@ from . import adapter_fanfiktionde from . import adapter_themasquenet from . import adapter_pretendercentrecom from . import adapter_darksolaceorg -from . import adapter_finestoriescom from . import adapter_storyroomcom from . import adapter_dracoandginnycom from . import adapter_wolverineandroguecom diff --git a/fanficfare/adapters/adapter_finestoriescom.py b/fanficfare/adapters/adapter_finestoriescom.py deleted file mode 100644 index 0d9e31aa..00000000 --- a/fanficfare/adapters/adapter_finestoriescom.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2013 Fanficdownloader team, 2018 FanFicFare team -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -from __future__ import absolute_import -import logging -logger = logging.getLogger(__name__) - -# py2 vs py3 transition - -from .adapter_storiesonlinenet import StoriesOnlineNetAdapter - -def getClass(): - return FineStoriesComAdapter - -# Class name has to be unique. Our convention is camel case the -# sitename with Adapter at the end. www is skipped. -class FineStoriesComAdapter(StoriesOnlineNetAdapter): - - @classmethod - def getSiteAbbrev(cls): - return 'fnst' - - @staticmethod # must be @staticmethod, don't remove it. - def getSiteDomain(): - # The site domain. Does have www here, if it uses it. - return 'finestories.com' diff --git a/fanficfare/adapters/adapter_storyroomcom.py b/fanficfare/adapters/adapter_storyroomcom.py index 8b83adda..68b00664 100644 --- a/fanficfare/adapters/adapter_storyroomcom.py +++ b/fanficfare/adapters/adapter_storyroomcom.py @@ -38,3 +38,16 @@ class StoryRoomComAdapter(StoriesOnlineNetAdapter): def getSiteDomain(): # The site domain. Does have www here, if it uses it. return 'storyroom.com' + + @classmethod + def getAcceptDomains(cls): + return ['finestories.com',cls.getSiteDomain()] + + @classmethod + def getConfigSections(cls): + "Only needs to be overriden if has additional ini sections." + return ['finestories.com',cls.getSiteDomain()] + + @classmethod + def getSiteURLPattern(self): + return r"https?://("+r"|".join([x.replace('.',r'\.') for x in self.getAcceptDomains()])+r")/(?Ps|n|library)/(storyInfo.php\?id=)?(?P\d+)(?P:\d+)?(?P/.+)?((;\d+)?$|(:i)?$)?" diff --git a/fanficfare/defaults.ini b/fanficfare/defaults.ini index 1e075b24..37cfc508 100644 --- a/fanficfare/defaults.ini +++ b/fanficfare/defaults.ini @@ -730,9 +730,6 @@ add_to_extra_valid_entries:,storynotes storynotes_label:Story Notes add_to_extra_titlepage_entries:,storynotes -[base_otw] -use_basic_cache:true - [base_xenforoforum] ## NOTE: There are no supported XenForo1 sites anymore, only XenForo2 ## site. The [base_xenforoforum] section is kept for backward @@ -1758,6 +1755,9 @@ extraships:Severus Snape/Hermione Granger website_encodings:Windows-1252,utf8 +[base_otw] +use_basic_cache:true + [bloodshedverse.com] use_basic_cache:true ## website encoding(s) In theory, each website reports the character @@ -2111,71 +2111,6 @@ use_basic_cache:true #username:YourName #password:yourpassword -[finestories.com] -use_basic_cache:true -## Some sites require login (or login for some rated stories) The -## program can prompt you, or you can save it in config. In -## commandline version, this should go in your personal.ini, not -## defaults.ini. -## finestories.com has started requiring login by email rather than -## pen name. -#username:youremail@yourdomain.dom -#password:yourpassword - -## In order to see some protected stories, login is required, -## but not indicated anyway we can detect. Requires valid -## username and password when true. -#always_login:true - -## dateUpdated/datePublished don't usually have time, but they do on this site. -## http://docs.python.org/library/datetime.html#strftime-strptime-behavior -## Note that ini format requires % to be escaped as %%. -dateUpdated_format:%%Y-%%m-%%d %%H:%%M:%%S -datePublished_format:%%Y-%%m-%%d %%H:%%M:%%S - -## Clear FanFiction from defaults, site is original fiction. -extratags: - -extra_valid_entries:size,universe,universeUrl,universeHTML,sitetags,notice,codes,score -#extra_titlepage_entries:size,universeHTML,sitetags,notice,score -include_in_codes:sitetags - -## adds to include_subject_tags instead of replacing it. -#extra_subject_tags:sitetags - -size_label:Size -universe_label:Universe -universeUrl_label:Universe URL -universeHTML_label:Universe -sitetags_label:Site Tags -notice_label:Notice -score_label:Score - -## Assume entryUrl, apply to "<a class='%slink' href='%s'>%s</a>" to -## make entryHTML. -make_linkhtml_entries:universe - -## finestories.com stories can be in a series and/or a universe. By -## default, series will be populated with the universe if there is -## universe but not series. -universe_as_series: true - -## some sites include images that we don't ever want becoming the -## cover image. This lets you exclude them. -cover_exclusion_regexp:/css/bir.png - -## This site uses shortened title chapters in chapter lists. When set -## true, this will inject the site's full length chapter title into -## the chapter text in a smaller h4 tag. -#inject_chapter_title:false - -## append_datepublished_to_storyurl literally appends -## datePublished(-%Y-%m-%d) to storyUrl. This is an ugly kludge to -## (hopefully) help address the site's unfortunately habit of -## *reusing* storyId numbers. Off by default to *not* cause weirdness -## for those not expecting it. -#append_datepublished_to_storyurl:false - [forum.questionablequesting.com] ## see [base_xenforoforum] @@ -2822,6 +2757,71 @@ cover_exclusion_regexp:/css/bir.png ## for those not expecting it. #append_datepublished_to_storyurl:false +[storyroom.com] +use_basic_cache:true +## Some sites require login (or login for some rated stories) The +## program can prompt you, or you can save it in config. In +## commandline version, this should go in your personal.ini, not +## defaults.ini. +## storyroom.com has started requiring login by email rather than +## pen name. +#username:youremail@yourdomain.dom +#password:yourpassword + +## In order to see some protected stories, login is required, +## but not indicated anyway we can detect. Requires valid +## username and password when true. +#always_login:true + +## dateUpdated/datePublished don't usually have time, but they do on this site. +## http://docs.python.org/library/datetime.html#strftime-strptime-behavior +## Note that ini format requires % to be escaped as %%. +dateUpdated_format:%%Y-%%m-%%d %%H:%%M:%%S +datePublished_format:%%Y-%%m-%%d %%H:%%M:%%S + +## Clear FanFiction from defaults, site is original fiction. +extratags: + +extra_valid_entries:size,universe,universeUrl,universeHTML,sitetags,notice,codes,score +#extra_titlepage_entries:size,universeHTML,sitetags,notice,score +include_in_codes:sitetags + +## adds to include_subject_tags instead of replacing it. +#extra_subject_tags:sitetags + +size_label:Size +universe_label:Universe +universeUrl_label:Universe URL +universeHTML_label:Universe +sitetags_label:Site Tags +notice_label:Notice +score_label:Score + +## Assume entryUrl, apply to "<a class='%slink' href='%s'>%s</a>" to +## make entryHTML. +make_linkhtml_entries:universe + +## storyroom.com stories can be in a series and/or a universe. By +## default, series will be populated with the universe if there is +## universe but not series. +universe_as_series: true + +## some sites include images that we don't ever want becoming the +## cover image. This lets you exclude them. +cover_exclusion_regexp:/css/bir.png + +## This site uses shortened title chapters in chapter lists. When set +## true, this will inject the site's full length chapter title into +## the chapter text in a smaller h4 tag. +#inject_chapter_title:false + +## append_datepublished_to_storyurl literally appends +## datePublished(-%Y-%m-%d) to storyUrl. This is an ugly kludge to +## (hopefully) help address the site's unfortunately habit of +## *reusing* storyId numbers. Off by default to *not* cause weirdness +## for those not expecting it. +#append_datepublished_to_storyurl:false + [superlove.sayitditto.net] ## This is a OTW-archive site. Note that ao3categories is still used, ## but labeled "superlove Categories".