mirror of
https://github.com/JimmXinu/FanFicFare.git
synced 2025-12-06 08:52:55 +01:00
Fix for zip files, status in epub.
This commit is contained in:
parent
94669a2179
commit
0e28d86a7b
5 changed files with 28 additions and 13 deletions
|
|
@ -81,6 +81,10 @@ def main():
|
||||||
outputepub = ZipFile(outputopt, "w", compression=ZIP_STORED)
|
outputepub = ZipFile(outputopt, "w", compression=ZIP_STORED)
|
||||||
outputepub.debug = 3
|
outputepub.debug = 3
|
||||||
outputepub.writestr("mimetype", "application/epub+zip")
|
outputepub.writestr("mimetype", "application/epub+zip")
|
||||||
|
# declares all the files created by Windows. otherwise, when
|
||||||
|
# it runs in appengine, windows unzips the files as 000 perms.
|
||||||
|
for zf in outputepub.filelist:
|
||||||
|
zf.create_system = 0
|
||||||
outputepub.close()
|
outputepub.close()
|
||||||
|
|
||||||
## Re-open file for content.
|
## Re-open file for content.
|
||||||
|
|
@ -277,6 +281,10 @@ def main():
|
||||||
outputepub.writestr("content.opf",contentdom.toxml('utf-8'))
|
outputepub.writestr("content.opf",contentdom.toxml('utf-8'))
|
||||||
outputepub.writestr("toc.ncx",tocncxdom.toxml('utf-8'))
|
outputepub.writestr("toc.ncx",tocncxdom.toxml('utf-8'))
|
||||||
|
|
||||||
|
# declares all the files created by Windows. otherwise, when
|
||||||
|
# it runs in appengine, windows unzips the files as 000 perms.
|
||||||
|
for zf in outputepub.filelist:
|
||||||
|
zf.create_system = 0
|
||||||
outputepub.close()
|
outputepub.close()
|
||||||
|
|
||||||
## Utility method for creating new tags.
|
## Utility method for creating new tags.
|
||||||
|
|
|
||||||
|
|
@ -159,6 +159,10 @@ class BaseStoryWriter(Configurable):
|
||||||
self.writeStoryImpl(out)
|
self.writeStoryImpl(out)
|
||||||
zipout = ZipFile(outstream, 'w', compression=ZIP_DEFLATED)
|
zipout = ZipFile(outstream, 'w', compression=ZIP_DEFLATED)
|
||||||
zipout.writestr(filename,out.getvalue())
|
zipout.writestr(filename,out.getvalue())
|
||||||
|
# declares all the files created by Windows. otherwise, when
|
||||||
|
# it runs in appengine, windows unzips the files as 000 perms.
|
||||||
|
for zf in zipout.filelist:
|
||||||
|
zf.create_system = 0
|
||||||
zipout.close()
|
zipout.close()
|
||||||
out.close()
|
out.close()
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -153,11 +153,13 @@ h6 { text-align: center; }
|
||||||
## ZipFile can't change compression type file-by-file, so we
|
## ZipFile can't change compression type file-by-file, so we
|
||||||
## have to close and re-open
|
## have to close and re-open
|
||||||
outputepub = ZipFile(zipio, 'w', compression=ZIP_STORED)
|
outputepub = ZipFile(zipio, 'w', compression=ZIP_STORED)
|
||||||
|
outputepub.debug=3
|
||||||
outputepub.writestr('mimetype','application/epub+zip')
|
outputepub.writestr('mimetype','application/epub+zip')
|
||||||
outputepub.close()
|
outputepub.close()
|
||||||
|
|
||||||
## Re-open file for content.
|
## Re-open file for content.
|
||||||
outputepub = ZipFile(zipio, 'a', compression=ZIP_DEFLATED)
|
outputepub = ZipFile(zipio, 'a', compression=ZIP_DEFLATED)
|
||||||
|
outputepub.debug=3
|
||||||
|
|
||||||
## Create META-INF/container.xml file. The only thing it does is
|
## Create META-INF/container.xml file. The only thing it does is
|
||||||
## point to content.opf
|
## point to content.opf
|
||||||
|
|
@ -238,6 +240,8 @@ h6 { text-align: center; }
|
||||||
metadata.appendChild(newTag(contentdom,"dc:description",text=
|
metadata.appendChild(newTag(contentdom,"dc:description",text=
|
||||||
self.getMetadata('description')))
|
self.getMetadata('description')))
|
||||||
|
|
||||||
|
metadata.appendChild(newTag(contentdom,"dc:subject",text=
|
||||||
|
self.getMetadata('status')))
|
||||||
# listables all go into dc:suject tags, but only if they are configured.
|
# listables all go into dc:suject tags, but only if they are configured.
|
||||||
for (name,lst) in self.story.getLists().iteritems():
|
for (name,lst) in self.story.getLists().iteritems():
|
||||||
if name in self.getConfigList("include_subject_tags"):
|
if name in self.getConfigList("include_subject_tags"):
|
||||||
|
|
@ -388,6 +392,11 @@ h6 { text-align: center; }
|
||||||
outputepub.writestr("OEBPS/file%04d.xhtml"%(index+1),fullhtml.encode('utf-8'))
|
outputepub.writestr("OEBPS/file%04d.xhtml"%(index+1),fullhtml.encode('utf-8'))
|
||||||
del fullhtml
|
del fullhtml
|
||||||
|
|
||||||
|
# declares all the files created by Windows. otherwise, when
|
||||||
|
# it runs in appengine, windows unzips the files as 000 perms.
|
||||||
|
logging.debug("outputepub create_system")
|
||||||
|
for zf in outputepub.filelist:
|
||||||
|
zf.create_system = 0
|
||||||
outputepub.close()
|
outputepub.close()
|
||||||
out.write(zipio.getvalue())
|
out.write(zipio.getvalue())
|
||||||
zipio.close()
|
zipio.close()
|
||||||
|
|
|
||||||
16
index.html
16
index.html
|
|
@ -35,23 +35,17 @@ src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
|
||||||
<div id='greeting'>
|
<div id='greeting'>
|
||||||
<p>Hi, {{ nickname }}! This is a fan fiction downloader, which makes reading stories from various websites
|
<p>Hi, {{ nickname }}! This is a fan fiction downloader, which makes reading stories from various websites
|
||||||
much easier. </p>
|
much easier. </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>
|
<p>Or see your personal list of <a href="/recent">previously downloaded fanfics</a>.</p>
|
||||||
</div>
|
</div>
|
||||||
<h3>Experimental New Feature</h3>
|
<h3>Experimental New Version!</h3>
|
||||||
<p>
|
<p>
|
||||||
If you select EPub format, when it's done you will also be given a 'Convert' link.
|
This version is a new re-org/re-write of the code
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
That link will take you to <a href="http://convertfiles.com">convertfiles.com</a> where you can
|
So far, only a few sites are supported: fanfiction.net, twilighted.net and whofic.com.
|
||||||
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>
|
||||||
<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
|
Mobi support (for Kindle) is only via EPub conversion in this version.
|
||||||
appears to be more correct than our Mobi output.
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div id='error'>
|
<div id='error'>
|
||||||
|
|
@ -66,7 +60,7 @@ src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
|
||||||
<input type='radio' name='format' value='epub' checked>EPub</input>
|
<input type='radio' name='format' value='epub' checked>EPub</input>
|
||||||
<input type='radio' name='format' value='html'>HTML</input>
|
<input type='radio' name='format' value='html'>HTML</input>
|
||||||
<input type='radio' name='format' value='txt'>Plain Text</input>
|
<input type='radio' name='format' value='txt'>Plain Text</input>
|
||||||
<p><i>For Mobi (Kindle) select EPub and Convert it.</i></p>
|
<p><i>For Mobi (Kindle) select EPub and use the Convert link when it's finished.</i></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ class Remover(webapp.RequestHandler):
|
||||||
logging.debug("Starting r3m0v3r")
|
logging.debug("Starting r3m0v3r")
|
||||||
user = users.get_current_user()
|
user = users.get_current_user()
|
||||||
logging.debug("Working as user %s" % user)
|
logging.debug("Working as user %s" % user)
|
||||||
theDate = datetime.date.today() - datetime.timedelta(days=5)
|
theDate = datetime.date.today() - datetime.timedelta(days=7)
|
||||||
logging.debug("Will delete stuff older than %s" % theDate)
|
logging.debug("Will delete stuff older than %s" % theDate)
|
||||||
|
|
||||||
fics = DownloadMeta.all()
|
fics = DownloadMeta.all()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue