mirror of
https://github.com/JimmXinu/FanFicFare.git
synced 2025-12-24 01:33:39 +01:00
3-0-2 Add convert link feature. Remove title page table(for convert). Make favicon.ico work.
This commit is contained in:
parent
bdaea79875
commit
f75abaad72
6 changed files with 61 additions and 27 deletions
7
app.yaml
7
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
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
20
index.html
20
index.html
|
|
@ -1,7 +1,7 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<html>
|
||||
<head>
|
||||
<link href="css/index.css" rel="stylesheet" type="text/css">
|
||||
<link href="/css/index.css" rel="stylesheet" type="text/css">
|
||||
<title>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</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta name="google-site-verification" content="kCFc-G4bka_pJN6Rv8CapPBcwmq0hbAUZPkKWqRsAYU" />
|
||||
|
|
@ -35,9 +35,25 @@ src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
|
|||
<div id='greeting'>
|
||||
<p>Hi, {{ nickname }}! This is a fan fiction downloader, which makes reading stories from various websites
|
||||
much easier. </p>
|
||||
<p>For Amazon Kindle use Mobi output, for Sony Reader, Nook and iPad use ePub</p>
|
||||
<p>For Amazon Kindle use Mobi output(see notice below), for Sony Reader, Nook and iPad use ePub</p>
|
||||
<p>Or see your personal list of <a href="/recent">previously downloaded fanfics</a>.</p>
|
||||
</div>
|
||||
<h3>Experimental New Feature</h3>
|
||||
<p>
|
||||
If you select EPub format, when it's done you will also be given a 'Convert' link.
|
||||
</p>
|
||||
<p>
|
||||
That link will take you to <a href="http://convertfiles.com">convertfiles.com</a> 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 <a href="/recent">recent downloads</a>
|
||||
page. We'd really like to hear from users about this in our <a href="http://groups.google.com/group/fanfic-downloader">Google Group</a>.
|
||||
</p>
|
||||
<p>
|
||||
We'd especially like Kindle and other Mobi users to try it. The <a href="http://convertfiles.com">convertfiles.com</a> Mobi file
|
||||
appears to be more correct than our Mobi output.
|
||||
</p>
|
||||
|
||||
<div id='error'>
|
||||
{{ error_message }}
|
||||
</div>
|
||||
|
|
|
|||
21
main.py
21
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),
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<html>
|
||||
<head>
|
||||
<link href="css/index.css" rel="stylesheet" type="text/css">
|
||||
<link href="/css/index.css" rel="stylesheet" type="text/css">
|
||||
<title>Fanfiction Downloader (fanfiction.net, fanficauthors, fictionalley, ficwad to epub and HTML)</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
</head>
|
||||
|
|
@ -36,8 +36,11 @@ src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
|
|||
{% for fic in fics %}
|
||||
<p>
|
||||
{% if fic.completed %}
|
||||
<a href="/file?id={{ fic.key }}">{{ fic.title }}</a>
|
||||
<a href="/file?id={{ fic.key }}">Download {{ fic.title }}</a>
|
||||
by {{ fic.author }} ({{ fic.format }})<br/>
|
||||
{% if fic.escaped_url %}
|
||||
<a href="http://www.convertfiles.com/index.php?url={{ fic.escaped_url }}">Convert {{ fic.title }} to other formats</a><br />
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if fic.failure %}
|
||||
<div id='error'>{{ fic.failure }}</div>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<html>
|
||||
<head>
|
||||
<link href="css/index.css" rel="stylesheet" type="text/css">
|
||||
<link href="/css/index.css" rel="stylesheet" type="text/css">
|
||||
<title>{% if fic.completed %} Finished {% else %} {% if fic.failure %} Failed {% else %} Working... {% endif %} {% endif %} - Fanfiction Downloader</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta name="google-site-verification" content="kCFc-G4bka_pJN6Rv8CapPBcwmq0hbAUZPkKWqRsAYU" />
|
||||
|
|
@ -35,8 +35,11 @@
|
|||
<div>
|
||||
{% if fic.completed %}
|
||||
<p>Your fic has finished processing and you can download it now:</p>
|
||||
<p><a href="/file?id={{ fic.key }}">{{ fic.title }}</a>
|
||||
<p><a href="/file?id={{ fic.key }}">Download {{ fic.title }}</a>
|
||||
by {{ fic.author }} ({{ fic.format }})</p>
|
||||
{% if escaped_url %}
|
||||
<p><a href="http://www.convertfiles.com/index.php?url={{ escaped_url }}">Convert {{ fic.title }} to other formats</a></p>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if fic.failure %}
|
||||
Your fic failed to process. Please check the URL and the error message below.<br />
|
||||
|
|
|
|||
Loading…
Reference in a new issue