From 8912f4ee18c9b5f213be56bd6bec533161bfdb76 Mon Sep 17 00:00:00 2001 From: FaceDeer Date: Wed, 7 Jun 2017 19:25:43 -0600 Subject: [PATCH 1/3] button for full list of groups when >8 groups has moved --- fanficfare/adapters/adapter_fimfictionnet.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fanficfare/adapters/adapter_fimfictionnet.py b/fanficfare/adapters/adapter_fimfictionnet.py index b39dc05b..341d9bd0 100644 --- a/fanficfare/adapters/adapter_fimfictionnet.py +++ b/fanficfare/adapters/adapter_fimfictionnet.py @@ -279,7 +279,8 @@ class FimFictionNetSiteAdapter(BaseSiteAdapter): self.story.setMetadata("short_description", stripHTML(descriptionMeta['content'])) #groups - if soup.find('button', {'id':'button-view-all-groups'}): + groupDiv = soup.find('div', {'class':'groups'}) + if groupDiv != None and groupDiv.find('div').find('button'): groupResponse = self._fetchUrl("https://www.fimfiction.net/ajax/stories/%s/groups" % (self.story.getMetadata("storyId"))) groupData = json.loads(groupResponse) groupList = self.make_soup(groupData["content"]) From 15ac85a7fb96c552bbb0eee18153220d1d7f06c4 Mon Sep 17 00:00:00 2001 From: FaceDeer Date: Wed, 7 Jun 2017 21:10:17 -0600 Subject: [PATCH 2/3] fallback for broken lastlogin data about 20% of the time the data-time attibute is simply absent. I haven't figured out a pattern as to why (it seems to come and go for any given story), but the date is still present in the title so it can be parsed out in that case. --- fanficfare/adapters/adapter_fimfictionnet.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fanficfare/adapters/adapter_fimfictionnet.py b/fanficfare/adapters/adapter_fimfictionnet.py index 341d9bd0..9383b2d7 100644 --- a/fanficfare/adapters/adapter_fimfictionnet.py +++ b/fanficfare/adapters/adapter_fimfictionnet.py @@ -314,7 +314,14 @@ class FimFictionNetSiteAdapter(BaseSiteAdapter): span = listItems[1].find('span',{'data-time':re.compile(r'^\d+$')}) ## Jun 27th, 2015 ## No timezone adjustment is done. - lastLogin = datetime.fromtimestamp(float(span['data-time'])) + if span != None: + lastLogin = datetime.fromtimestamp(float(span['data-time'])) + ## Sometimes, for reasons that are unclear, data-time is not present. Parse the date out of the title instead. + else: + span = listItems[1].find('span', title=True) + loginRegex = re.search('([a-zA-Z ]+)([0-9]+)(th of|nd of|rd of)([a-zA-Z ]+[0-9]+)', span['title']) + loginString = loginRegex.group(2) + loginRegex.group(4) + lastLogin = datetime.strptime(loginString, "%d %B %Y") self.story.setMetadata("authorLastLogin", lastLogin) def ordinal_date_string_to_date(self, datestring): From 7ed6a982b78bcafde02ffa5c8e36dd9d3d592e1b Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Thu, 8 Jun 2017 10:19:11 -0500 Subject: [PATCH 3/3] Bump Test Version --- calibre-plugin/__init__.py | 2 +- fanficfare/cli.py | 2 +- setup.py | 2 +- webservice/app.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/calibre-plugin/__init__.py b/calibre-plugin/__init__.py index 6a291ae5..e4cbb410 100644 --- a/calibre-plugin/__init__.py +++ b/calibre-plugin/__init__.py @@ -33,7 +33,7 @@ except NameError: from calibre.customize import InterfaceActionBase # pulled out from FanFicFareBase for saving in prefs.py -__version__ = (2, 12, 8) +__version__ = (2, 12, 9) ## Apparently the name for this class doesn't matter--it was still ## 'demo' for the first few versions. diff --git a/fanficfare/cli.py b/fanficfare/cli.py index 80168c75..12a31925 100644 --- a/fanficfare/cli.py +++ b/fanficfare/cli.py @@ -26,7 +26,7 @@ import pprint import string import sys -version="2.12.8" +version="2.12.9" if sys.version_info < (2, 5): print 'This program requires Python 2.5 or newer.' diff --git a/setup.py b/setup.py index a0c25c11..6eec4220 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ setup( name="FanFicFare", # Versions should comply with PEP440. - version="2.12.8", + version="2.12.9", description='A tool for downloading fanfiction to eBook formats', long_description=long_description, diff --git a/webservice/app.yaml b/webservice/app.yaml index e0d86594..f615ee27 100644 --- a/webservice/app.yaml +++ b/webservice/app.yaml @@ -1,6 +1,6 @@ # ffd-retief-hrd fanficfare application: fanficfare -version: 2-12-8 +version: 2-12-9 runtime: python27 api_version: 1 threadsafe: true