1
0
Fork 0
mirror of https://github.com/kemayo/leech synced 2026-03-02 02:21:21 +01:00

Fix lint errors

This commit is contained in:
Will Oursler 2017-10-12 10:07:22 -04:00
parent 5bd07a5b90
commit 1c577b6f67
2 changed files with 21 additions and 22 deletions

View file

@ -1,7 +1,6 @@
from .epub import *
from .cover import *
from .epub import make_epub
from .cover import make_cover
import os
import datetime
import requests
@ -78,29 +77,29 @@ def chapter_html(story, titleprefix=None):
return chapters
def generate_epub(story, output_filename = None):
dates = list(story.dates())
metadata = {
'title': story.title,
'author': story.author,
'unique_id': story.url,
'started': min(dates),
'updated': max(dates),
}
def generate_epub(story, output_filename=None):
dates = list(story.dates())
metadata = {
'title': story.title,
'author': story.author,
'unique_id': story.url,
'started': min(dates),
'updated': max(dates),
}
# The cover is static, and the only change comes from the image which we generate
html = [('Cover', 'cover.html', cover_template)]
# The cover is static, and the only change comes from the image which we generate
html = [('Cover', 'cover.html', cover_template)]
cover_image = ('images/cover.png', cover.make_cover(story.title, story.author).read(), 'image/png')
cover_image = ('images/cover.png', make_cover(story.title, story.author).read(), 'image/png')
html.append(('Front Matter', 'frontmatter.html', frontmatter_template.format(now=datetime.datetime.now(), **metadata)))
html.append(('Front Matter', 'frontmatter.html', frontmatter_template.format(now=datetime.datetime.now(), **metadata)))
html.extend(chapter_html(story))
html.extend(chapter_html(story))
css = ('Styles/base.css', requests.Session().get('https://raw.githubusercontent.com/mattharrison/epub-css-starter-kit/master/css/base.css').text, 'text/css')
css = ('Styles/base.css', requests.Session().get('https://raw.githubusercontent.com/mattharrison/epub-css-starter-kit/master/css/base.css').text, 'text/css')
output_filename = output_filename or story.title + '.epub'
output_filename = output_filename or story.title + '.epub'
output_filename = epub.make_epub(output_filename, html, metadata, extra_files=(css, cover_image))
output_filename = make_epub(output_filename, html, metadata, extra_files=(css, cover_image))
return output_filename
return output_filename

View file

@ -26,7 +26,7 @@ class ArchiveOfOurOwn(Site):
story = Section(
title=metadata[0].string,
author=metadata[1].string,
url=url
url='http://archiveofourown.org/works/{}'.format(workid)
)
for chapter in soup.select('#main ol[role="navigation"] li'):