Merge branch 'gutenbergtools:master' into master

master
Eric Hellman 2021-05-06 13:38:26 -04:00
commit 7714ad9b62
7 changed files with 11 additions and 14 deletions

View File

@ -189,6 +189,8 @@ class SQLStatement(object):
@classmethod
def sub(cls, regex_, replace, query):
""" Like re.sub but also compile and cache the regex. """
if not isinstance(query, str):
query = query[0] if isinstance(query, list) and len(query) > 0 else ''
cregex = cls.regex_cache.setdefault(
regex_, regex.compile(regex_, regex.UNICODE | regex.VERSION1))

View File

@ -59,8 +59,7 @@ class ConnectionPool (plugins.SimplePlugin):
pool_size = pool_size,
max_overflow = max_overflow,
timeout = timeout,
recycle = recycle,
use_threadlocal = True)
recycle = recycle)
def connect (self):

View File

@ -66,12 +66,13 @@ class XMLishFormatter (BaseFormatter.BaseFormatter):
if file_.filetype and file_.filetype.endswith('images'):
dedupable[file_.filetype] = file_
do_dedupe = False
for ft in ['epub', 'kindle', 'pdf']:
for ft in ['epub', 'kindle', 'pdf', 'html']:
if ft + '.images' in dedupable and ft + '.noimages' in dedupable:
if dedupable[ft + '.images'].extent == dedupable[ft + '.noimages'].extent:
# because of timestamps, identical files may vary by a bit or 2
if abs (dedupable[ft + '.images'].extent - dedupable[ft + '.noimages'].extent) < 3:
do_dedupe = True
if do_dedupe:
for ft in ['epub', 'kindle', 'pdf']:
for ft in ['epub', 'kindle', 'pdf', 'html']:
if ft + '.images' in dedupable and ft + '.noimages' in dedupable:
dc.files.remove(dedupable[ft + '.images'])

View File

@ -9,6 +9,8 @@ RuntimeDirectory=autocat
WorkingDirectory=/var/lib/autocat/autocat3
ExecStartPre=-/usr/bin/mkdir -p /var/run/autocat
ExecStart=/usr/local/bin/pipenv run python CherryPyApp.py
LimitNOFILE=infinity
[Install]
WantedBy=multi-user.target

View File

@ -379,10 +379,9 @@ ${site_top()}
height="32"
alt="RDF/XML Metadata" /></a>
-->
</div>
${site_footer()}
</div>
<script>
function getBookMetadata(){

View File

@ -130,10 +130,9 @@ which contains *all* Project Gutenberg metadata in one RDF/XML file.
</div>
</div> <!--! body -->
</div>
${site_footer ()}
</div>
${site_top ()}

View File

@ -150,11 +150,6 @@
accesskey="+"
href="${os.url_carry (start_index = os.next_page_index)}">Next</a>
</py:if>
<py:if test="os.show_next_page_link">|
<a title="Go to the last page of results."
accesskey="+"
href="${os.url_carry (start_index = os.last_page_index)}">Next</a>
</py:if>
</span>
</py:def>