From 3f9abb8c0734966278894074955c888730dadf19 Mon Sep 17 00:00:00 2001
From: Jim Miller
Date: Fri, 24 Feb 2012 16:39:37 -0600
Subject: [PATCH] Activate gayauthors.org, support ga authors with space, bump
plugin version.
---
app.yaml | 2 +-
calibre-plugin/__init__.py | 2 +-
fanficdownloader/adapters/__init__.py | 1 +
.../adapters/adapter_gayauthorsorg.py | 9 ++++++++-
index.html | 15 ++++++++-------
5 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/app.yaml b/app.yaml
index 1fd9e75b..c4d89c4c 100644
--- a/app.yaml
+++ b/app.yaml
@@ -1,5 +1,5 @@
# ffd-retief-hrd fanfictiondownloader
-application: fanfictiondownloader
+application: ffd-retief-hrd
version: 4-3-2
runtime: python27
api_version: 1
diff --git a/calibre-plugin/__init__.py b/calibre-plugin/__init__.py
index d2345878..af7832c0 100644
--- a/calibre-plugin/__init__.py
+++ b/calibre-plugin/__init__.py
@@ -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, 4, 5)
+ version = (1, 4, 6)
minimum_calibre_version = (0, 8, 30)
#: This field defines the GUI plugin class that contains all the code
diff --git a/fanficdownloader/adapters/__init__.py b/fanficdownloader/adapters/__init__.py
index 6b841870..353f9dac 100644
--- a/fanficdownloader/adapters/__init__.py
+++ b/fanficdownloader/adapters/__init__.py
@@ -45,6 +45,7 @@ import adapter_whoficcom
import adapter_siyecouk
import adapter_archiveofourownorg
import adapter_ficbooknet
+import adapter_gayauthorsorg
## This bit of complexity allows adapters to be added by just adding
## importing. It eliminates the long if/else clauses we used to need
diff --git a/fanficdownloader/adapters/adapter_gayauthorsorg.py b/fanficdownloader/adapters/adapter_gayauthorsorg.py
index dba046a8..ab4984e4 100644
--- a/fanficdownloader/adapters/adapter_gayauthorsorg.py
+++ b/fanficdownloader/adapters/adapter_gayauthorsorg.py
@@ -19,6 +19,7 @@ import datetime
import logging
import re
import urllib2
+from urllib import unquote
from .. import BeautifulSoup as bs
from ..htmlcleanup import stripHTML
@@ -49,7 +50,13 @@ class GayAuthorsAdapter(BaseSiteAdapter):
# get storyId from url--url validation guarantees query is only sid=1234
self.story.setMetadata('storyId',self.parsedUrl.path.split('/',)[3])
logging.debug("storyId: (%s)"%self.story.getMetadata('storyId'))
- self.story.setMetadata('authorId',self.parsedUrl.path.split('/',)[2])
+
+ # unqoute, change '_' and ' ' to '-', downcase, and remove non-[a-z0-9-]
+ authid = unquote(self.parsedUrl.path.split('/',)[2])
+ authid = authid.lower().replace('_','-').replace(' ','-')
+ authid = re.sub(r"[^a-z0-9-]","",authid)
+
+ self.story.setMetadata('authorId',authid)
logging.debug("authorId: (%s)"%self.story.getMetadata('authorId'))
# normalized story URL.
diff --git a/index.html b/index.html
index f43930d2..6fab4ff9 100644
--- a/index.html
+++ b/index.html
@@ -54,13 +54,9 @@
much easier.
- fanfiction.net fixed
+ New Site gayauthors.org
- fanfiction.net changed their formatting slightly, which broken the downloader for a while. It's fixed now.
-
- New Russian Language Site ficbook.net
-
- Thanks to Ida Leter's hard work, we now support ficbook.net, a Russian language fanfiction site.
+ Thanks to Ida Leter's hard work, we now support gayauthors.org, a fanfiction site specializing in gay stories.
If you have any problems with this application, please
@@ -235,13 +231,18 @@
http://archiveofourown.org/works/76366.
http://archiveofourown.org/works/76366/chapters/101584.
-
ficbook.net(Russian)
Use the URL of the story, or one of it's chapters, such as
http://ficbook.net/readfic/93626.
http://ficbook.net/readfic/93626/246417#part_content.
+ gayauthors.org
+
+ Use the URL of the story, or one of it's chapters, such as
+
http://www.gayauthors.org/story/mark-arbour/stvincent.
+
http://www.gayauthors.org/story/Mark Arbour/stvincent/7.
+
A few additional things to know, which will make your life substantially easier: