From 390c661a885fbf12fdf4feeb28873d6e2c237072 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Tue, 9 Jun 2015 13:00:43 -0500 Subject: [PATCH 1/3] Preserve order of URLs fetched from page--especially important for anthologies. --- fanficfare/geturls.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/fanficfare/geturls.py b/fanficfare/geturls.py index 2af9e6d..1e90df4 100644 --- a/fanficfare/geturls.py +++ b/fanficfare/geturls.py @@ -74,7 +74,7 @@ def get_urls_from_page(url,configuration=None,normalize=False): return get_urls_from_html(data,url,configuration,normalize,restrictsearch) def get_urls_from_html(data,url=None,configuration=None,normalize=False,restrictsearch=None): - urls = collections.defaultdict(list) + urls = collections.OrderedDict() if not configuration: configuration = Configuration("test1.com","EPUB") @@ -103,7 +103,10 @@ def get_urls_from_html(data,url=None,configuration=None,normalize=False,restrict #print("2 urlhref:%s"%href) adapter = adapters.getAdapter(configuration,href) #print("found adapter") - urls[adapter.story.getMetadata('storyUrl')].append(href) + if adapter.story.getMetadata('storyUrl') not in urls: + urls[adapter.story.getMetadata('storyUrl')] = [href] + else: + urls[adapter.story.getMetadata('storyUrl')].append(href) except Exception, e: #print e pass @@ -114,7 +117,7 @@ def get_urls_from_html(data,url=None,configuration=None,normalize=False,restrict def get_urls_from_text(data,configuration=None,normalize=False): - urls = collections.defaultdict(list) + urls = collections.OrderedDict(list) data=unicode(data) if not configuration: @@ -130,7 +133,10 @@ def get_urls_from_text(data,configuration=None,normalize=False): try: href = href.replace('&index=1','') adapter = adapters.getAdapter(configuration,href) - urls[adapter.story.getMetadata('storyUrl')].append(href) + if adapter.story.getMetadata('storyUrl') not in urls: + urls[adapter.story.getMetadata('storyUrl')] = [href] + else: + urls[adapter.story.getMetadata('storyUrl')].append(href) except: pass From 69d1ce6c01c67c91a3fdba6b6f7ca0423bf80c65 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Tue, 9 Jun 2015 13:08:56 -0500 Subject: [PATCH 2/3] Preserve order of URLs fetched from page--especially important for anthologies. --- fanficfare/geturls.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fanficfare/geturls.py b/fanficfare/geturls.py index 1e90df4..ab4b98f 100644 --- a/fanficfare/geturls.py +++ b/fanficfare/geturls.py @@ -117,7 +117,7 @@ def get_urls_from_html(data,url=None,configuration=None,normalize=False,restrict def get_urls_from_text(data,configuration=None,normalize=False): - urls = collections.OrderedDict(list) + urls = collections.OrderedDict() data=unicode(data) if not configuration: From c0adf8e027505450b7913a16e7e2e2ccbc047dff Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Tue, 9 Jun 2015 17:56:11 -0500 Subject: [PATCH 3/3] Bump version to v2.2.8 --- calibre-plugin/__init__.py | 2 +- setup.py | 2 +- webservice/app.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/calibre-plugin/__init__.py b/calibre-plugin/__init__.py index b7b6a69..8e157c6 100644 --- a/calibre-plugin/__init__.py +++ b/calibre-plugin/__init__.py @@ -42,7 +42,7 @@ class FanFicFareBase(InterfaceActionBase): description = _('UI plugin to download FanFiction stories from various sites.') supported_platforms = ['windows', 'osx', 'linux'] author = 'Jim Miller' - version = (2, 2, 7) + version = (2, 2, 8) minimum_calibre_version = (1, 48, 0) #: This field defines the GUI plugin class that contains all the code diff --git a/setup.py b/setup.py index bcb6dcb..269a769 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ setup( # Versions should comply with PEP440. For a discussion on single-sourcing # the version across setup.py and the project code, see # https://packaging.python.org/en/latest/single_source_version.html - version="2.2.7", + version="2.2.8", description='A tool for downloading fanfiction to eBook formats', long_description=long_description, diff --git a/webservice/app.yaml b/webservice/app.yaml index 9e5be88..7590765 100644 --- a/webservice/app.yaml +++ b/webservice/app.yaml @@ -1,6 +1,6 @@ # ffd-retief-hrd fanfictiondownloader fanficfare application: fanficfare -version: 2-2-7 +version: 2-2-8 runtime: python27 api_version: 1 threadsafe: true