diff --git a/app.yaml b/app.yaml index 371bf6ce..bee0c4e6 100644 --- a/app.yaml +++ b/app.yaml @@ -1,5 +1,6 @@ +# fanfictionloader application: fanfictionloader -version: 3-0-1 +version: 3-0-2 runtime: python api_version: 1 @@ -25,6 +26,10 @@ handlers: - url: /static static_dir: static +- url: /favicon\.ico + static_files: static/favicon.ico + upload: static/favicon\.ico + - url: /.* script: main.py diff --git a/fanficdownloader/output.py b/fanficdownloader/output.py index 087fff30..b9404d56 100644 --- a/fanficdownloader/output.py +++ b/fanficdownloader/output.py @@ -476,22 +476,22 @@ class EPubFanficWriter(FanficWriter): ### writing content -- title page titleFilePath = "OEBPS/title_page.xhtml" - self._writeFile(titleFilePath, TABLE_TITLE_HEADER % (self.authorName, self.storyTitle, self.adapter.getStoryURL(), self.storyTitle, self.adapter.getAuthorURL(), self.authorName)) - self._writeFile(titleFilePath, TABLE_TITLE_ENTRY % ('Category:', self.adapter.getCategory())) - self._writeFile(titleFilePath, TABLE_TITLE_ENTRY % ('Genre:', self.adapter.getGenre())) - self._writeFile(titleFilePath, TABLE_TITLE_ENTRY % ('Status:', self.adapter.getStoryStatus())) - self._writeFile(titleFilePath, TABLE_TITLE_ENTRY % ('Published:', published)) - self._writeFile(titleFilePath, TABLE_TITLE_ENTRY % ('Updated:', updated)) - self._writeFile(titleFilePath, TABLE_TITLE_ENTRY % ('Packaged:', createda)) + self._writeFile(titleFilePath, TITLE_HEADER % (self.authorName, self.storyTitle, self.adapter.getStoryURL(), self.storyTitle, self.adapter.getAuthorURL(), self.authorName)) + self._writeFile(titleFilePath, TITLE_ENTRY % ('Category:', self.adapter.getCategory())) + self._writeFile(titleFilePath, TITLE_ENTRY % ('Genre:', self.adapter.getGenre())) + self._writeFile(titleFilePath, TITLE_ENTRY % ('Status:', self.adapter.getStoryStatus())) + self._writeFile(titleFilePath, TITLE_ENTRY % ('Published:', published)) + self._writeFile(titleFilePath, TITLE_ENTRY % ('Updated:', updated)) + self._writeFile(titleFilePath, TITLE_ENTRY % ('Packaged:', createda)) tmpstr = self.adapter.getStoryRating() + " / " + self.adapter.getStoryUserRating() - self._writeFile(titleFilePath, TABLE_TITLE_ENTRY % ('Rating Age/User:', tmpstr)) + self._writeFile(titleFilePath, TITLE_ENTRY % ('Rating Age/User:', tmpstr)) tmpstr = unicode(self.adapter.getNumChapters()) + " / " + commaGroups(unicode(self.adapter.getNumWords())) - self._writeFile(titleFilePath, TABLE_TITLE_ENTRY % ('Chapters/Words:', tmpstr)) - self._writeFile(titleFilePath, TABLE_TITLE_ENTRY % ('Publisher:', self.adapter.getHost())) - self._writeFile(titleFilePath, TABLE_TITLE_ENTRY % ('Story ID:', self.adapter.getStoryId())) - self._writeFile(titleFilePath, TABLE_TITLE_ENTRY % ('Author ID:', self.adapter.getAuthorId())) + self._writeFile(titleFilePath, TITLE_ENTRY % ('Chapters/Words:', tmpstr)) + self._writeFile(titleFilePath, TITLE_ENTRY % ('Publisher:', self.adapter.getHost())) + self._writeFile(titleFilePath, TITLE_ENTRY % ('Story ID:', self.adapter.getStoryId())) + self._writeFile(titleFilePath, TITLE_ENTRY % ('Author ID:', self.adapter.getAuthorId())) - self._writeFile(titleFilePath, TABLE_TITLE_FOOTER % description ) + self._writeFile(titleFilePath, TITLE_FOOTER % description ) ### writing content -- opf file opfFilePath = "OEBPS/content.opf" diff --git a/index.html b/index.html index d599c869..499d3be8 100644 --- a/index.html +++ b/index.html @@ -1,7 +1,7 @@ - + Fanfiction Downloader - read fanfiction from twilighted.net, fanfiction.net, fictionpress.com, fictionalley.org, ficwad.com, potionsandsnitches.net, harrypotterfanfiction.com, mediaminer.org on Kindle, Nook, Sony Reader, iPad, iPhone, Android, Aldiko, Stanza @@ -35,9 +35,25 @@ src="http://pagead2.googlesyndication.com/pagead/show_ads.js">

Hi, {{ nickname }}! This is a fan fiction downloader, which makes reading stories from various websites much easier.

-

For Amazon Kindle use Mobi output, for Sony Reader, Nook and iPad use ePub

+

For Amazon Kindle use Mobi output(see notice below), for Sony Reader, Nook and iPad use ePub

Or see your personal list of previously downloaded fanfics.

+

Experimental New Feature

+

+ If you select EPub format, when it's done you will also be given a 'Convert' link. +

+

+ That link will take you to convertfiles.com where you can + directly convert your new story to FictionBook (fb2), Mobipocket (mobi), MS Reader (lit) or Adobe Portable + Document Format(pdf). + There's also a 'Convert' link for EPubs on your recent downloads + page. We'd really like to hear from users about this in our Google Group. +

+

+ We'd especially like Kindle and other Mobi users to try it. The convertfiles.com Mobi file + appears to be more correct than our Mobi output. +

+
{{ error_message }}
diff --git a/main.py b/main.py index e4d603f0..eaa41d9f 100644 --- a/main.py +++ b/main.py @@ -81,8 +81,6 @@ class MainHandler(webapp.RequestHandler): self.response.out.write(template.render(path, template_values)) else: -# self.redirect(users.create_login_url(self.request.uri)) -# self.redirect('/login') logging.debug(users.create_login_url('/')) url = users.create_login_url(self.request.uri) template_values = {'login_url' : url, 'authorized': False} @@ -91,8 +89,8 @@ class MainHandler(webapp.RequestHandler): class FileServer(webapp.RequestHandler): + def get(self): -# user = users.get_current_user() fileId = self.request.get('id') if fileId == None or len(fileId) < 3: @@ -144,7 +142,6 @@ class FileServer(webapp.RequestHandler): class FileStatusServer(webapp.RequestHandler): def get(self): - logging.info("Status id: %s" % id) user = users.get_current_user() if not user: self.redirect(users.create_login_url(self.request.uri)) @@ -159,8 +156,14 @@ class FileStatusServer(webapp.RequestHandler): fic = db.get(key) logging.info("Status url: %s" % fic.url) - - template_values = dict(fic = fic, nickname = user.nickname()) + if fic.completed and fic.format=='epub': + escaped_url = urlEscape(self.request.host_url+"/file/"+fic.name+"."+fic.format+"?id="+fileId+"&fake=file."+fic.format) + else: + escaped_url=False + template_values = dict(fic = fic, + nickname = user.nickname(), + escaped_url = escaped_url + ) path = os.path.join(os.path.dirname(__file__), 'status.html') self.response.out.write(template.render(path, template_values)) @@ -174,6 +177,10 @@ class RecentFilesServer(webapp.RequestHandler): q = DownloadMeta.all() q.filter('user =', user).order('-date') fics = q.fetch(100) + + for fic in fics: + if fic.completed and fic.format == 'epub': + fic.escaped_url = urlEscape(self.request.host_url+"/file/"+fic.name+"."+fic.format+"?id="+str(fic.key())+"&fake=file."+fic.format) template_values = dict(fics = fics, nickname = user.nickname()) path = os.path.join(os.path.dirname(__file__), 'recent.html') @@ -412,7 +419,7 @@ def main(): application = webapp.WSGIApplication([('/', MainHandler), ('/fdowntask', FanfictionDownloaderTask), ('/fdown', FanfictionDownloader), - ('/file', FileServer), + (r'/file.*', FileServer), ('/status', FileStatusServer), ('/recent', RecentFilesServer), ('/r2d2', RecentAllFilesServer), diff --git a/recent.html b/recent.html index b0ff3009..d03a621f 100644 --- a/recent.html +++ b/recent.html @@ -1,7 +1,7 @@ - + Fanfiction Downloader (fanfiction.net, fanficauthors, fictionalley, ficwad to epub and HTML) @@ -36,8 +36,11 @@ src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> {% for fic in fics %}

{% if fic.completed %} - {{ fic.title }} + Download {{ fic.title }} by {{ fic.author }} ({{ fic.format }})
+ {% if fic.escaped_url %} + Convert {{ fic.title }} to other formats
+ {% endif %} {% endif %} {% if fic.failure %}

{{ fic.failure }}
diff --git a/status.html b/status.html index a5dfbf30..cb70cb0e 100644 --- a/status.html +++ b/status.html @@ -1,7 +1,7 @@ - + {% if fic.completed %} Finished {% else %} {% if fic.failure %} Failed {% else %} Working... {% endif %} {% endif %} - Fanfiction Downloader @@ -35,8 +35,11 @@
{% if fic.completed %}

Your fic has finished processing and you can download it now:

-

{{ fic.title }} +

Download {{ fic.title }} by {{ fic.author }} ({{ fic.format }})

+ {% if escaped_url %} +

Convert {{ fic.title }} to other formats

+ {% endif %} {% else %} {% if fic.failure %} Your fic failed to process. Please check the URL and the error message below.