Fixes for FimFic--missing story, story password, updated date.

This commit is contained in:
Jim Miller 2012-02-29 17:23:02 -06:00
parent d3dc23b950
commit 54f5d53f33
3 changed files with 14 additions and 3 deletions

View file

@ -27,7 +27,7 @@ class FanFictionDownLoaderBase(InterfaceActionBase):
description = 'UI plugin to download FanFiction stories from various sites.'
supported_platforms = ['windows', 'osx', 'linux']
author = 'Jim Miller'
version = (1, 5, 3)
version = (1, 5, 4)
minimum_calibre_version = (0, 8, 30)
#: This field defines the GUI plugin class that contains all the code

View file

@ -63,7 +63,7 @@ def main():
help="Retrieve metadata and stop. Or, if --update-epub, update metadata title page only.",)
parser.add_option("-u", "--update-epub",
action="store_true", dest="update",
help="Update an existing epub with new chapter, give epub filename instead of storyurl. Not compatible with inserted TOC.",)
help="Update an existing epub with new chapter, give epub filename instead of storyurl.",)
parser.add_option("--force",
action="store_true", dest="force",
help="Force overwrite or update of an existing epub, download and overwrite all chapters.",)

View file

@ -83,9 +83,20 @@ class FimFictionNetSiteAdapter(BaseSiteAdapter):
if "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource" in data:
raise exceptions.StoryDoesNotExist(self.url)
if "/images/missing_story.png" in data:
raise exceptions.StoryDoesNotExist(self.url)
if "This story has been marked as having adult content." in data:
raise exceptions.AdultCheckRequired(self.url)
if self.password:
params = {}
params['password'] = self.password
data = self._postUrl(self.url,params)
if "Enter the password the author set for this story to view it." in data:
raise exceptions.FailedToLogin(self.url,"Story requires individual password")
soup = bs.BeautifulSoup(data).find("div", {"class":"content_box post_content_box"})
@ -161,7 +172,7 @@ class FimFictionNetSiteAdapter(BaseSiteAdapter):
dateUpdated_soup.find('span').extract()
dateUpdated = makeDate("%s%s"%(now.year,dateUpdated_soup.text), "%Y%b%d")
if dateUpdated > now :
dateUpdated = datePublished.replace(year=now.year-1)
dateUpdated = dateUpdated.replace(year=now.year-1)
self.story.setMetadata("dateUpdated", dateUpdated)
# Get the date of creation from the first chapter