make metadata cacheable

This commit is contained in:
daniel-j 2016-08-17 10:37:41 +02:00
parent 5555b20d47
commit 5027cdff63
3 changed files with 14 additions and 4 deletions

View file

@ -4,7 +4,7 @@
"name": "fimfic2epub", "name": "fimfic2epub",
"short_name": "fimfic2epub", "short_name": "fimfic2epub",
"description": "Improved EPUB exporter for Fimfiction", "description": "Improved EPUB exporter for Fimfiction",
"version": "1.1.5", "version": "1.1.6",
"icons": { "icons": {
"128": "icon-128.png" "128": "icon-128.png"

View file

@ -1,6 +1,6 @@
{ {
"name": "fimfic2epub", "name": "fimfic2epub",
"version": "1.1.5", "version": "1.1.6",
"description": "Tool to generate EPUB ebooks from fimfiction stories", "description": "Tool to generate EPUB ebooks from fimfiction stories",
"author": "djazz", "author": "djazz",
"repository": { "repository": {

View file

@ -53,7 +53,17 @@ module.exports = class FimFic2Epub {
reject(data.error) reject(data.error)
return return
} }
if (!data.story.chapters) data.story.chapters = [] let story = data.story
// this is so the metadata can be cached.
if (!story.chapters) story.chapters = []
delete story.likes
delete story.dislikes
delete story.views
delete story.total_views
delete story.comments
story.chapters.forEach((ch) => {
delete ch.views
})
resolve(data.story) resolve(data.story)
}) })
}) })
@ -416,7 +426,7 @@ module.exports = class FimFic2Epub {
compressionOptions: {level: 9} compressionOptions: {level: 9}
}).then((file) => { }).then((file) => {
this.cachedFile = file this.cachedFile = file
resolve(file) resolve(file, this.filename)
}) })
}) })
} }