Merge branch 'gutenbergtools:master' into master
commit
7714ad9b62
|
@ -189,6 +189,8 @@ class SQLStatement(object):
|
||||||
@classmethod
|
@classmethod
|
||||||
def sub(cls, regex_, replace, query):
|
def sub(cls, regex_, replace, query):
|
||||||
""" Like re.sub but also compile and cache the regex. """
|
""" 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(
|
cregex = cls.regex_cache.setdefault(
|
||||||
regex_, regex.compile(regex_, regex.UNICODE | regex.VERSION1))
|
regex_, regex.compile(regex_, regex.UNICODE | regex.VERSION1))
|
||||||
|
|
|
@ -59,8 +59,7 @@ class ConnectionPool (plugins.SimplePlugin):
|
||||||
pool_size = pool_size,
|
pool_size = pool_size,
|
||||||
max_overflow = max_overflow,
|
max_overflow = max_overflow,
|
||||||
timeout = timeout,
|
timeout = timeout,
|
||||||
recycle = recycle,
|
recycle = recycle)
|
||||||
use_threadlocal = True)
|
|
||||||
|
|
||||||
|
|
||||||
def connect (self):
|
def connect (self):
|
||||||
|
|
|
@ -66,12 +66,13 @@ class XMLishFormatter (BaseFormatter.BaseFormatter):
|
||||||
if file_.filetype and file_.filetype.endswith('images'):
|
if file_.filetype and file_.filetype.endswith('images'):
|
||||||
dedupable[file_.filetype] = file_
|
dedupable[file_.filetype] = file_
|
||||||
do_dedupe = False
|
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 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
|
do_dedupe = True
|
||||||
if do_dedupe:
|
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:
|
if ft + '.images' in dedupable and ft + '.noimages' in dedupable:
|
||||||
dc.files.remove(dedupable[ft + '.images'])
|
dc.files.remove(dedupable[ft + '.images'])
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@ RuntimeDirectory=autocat
|
||||||
WorkingDirectory=/var/lib/autocat/autocat3
|
WorkingDirectory=/var/lib/autocat/autocat3
|
||||||
ExecStartPre=-/usr/bin/mkdir -p /var/run/autocat
|
ExecStartPre=-/usr/bin/mkdir -p /var/run/autocat
|
||||||
ExecStart=/usr/local/bin/pipenv run python CherryPyApp.py
|
ExecStart=/usr/local/bin/pipenv run python CherryPyApp.py
|
||||||
|
LimitNOFILE=infinity
|
||||||
|
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
|
@ -379,10 +379,9 @@ ${site_top()}
|
||||||
height="32"
|
height="32"
|
||||||
alt="RDF/XML Metadata" /></a>
|
alt="RDF/XML Metadata" /></a>
|
||||||
-->
|
-->
|
||||||
|
</div>
|
||||||
${site_footer()}
|
${site_footer()}
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function getBookMetadata(){
|
function getBookMetadata(){
|
||||||
|
|
|
@ -130,10 +130,9 @@ which contains *all* Project Gutenberg metadata in one RDF/XML file.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div> <!--! body -->
|
</div> <!--! body -->
|
||||||
|
</div>
|
||||||
${site_footer ()}
|
${site_footer ()}
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
${site_top ()}
|
${site_top ()}
|
||||||
|
|
||||||
|
|
|
@ -150,11 +150,6 @@
|
||||||
accesskey="+"
|
accesskey="+"
|
||||||
href="${os.url_carry (start_index = os.next_page_index)}">Next</a>
|
href="${os.url_carry (start_index = os.next_page_index)}">Next</a>
|
||||||
</py:if>
|
</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>
|
</span>
|
||||||
</py:def>
|
</py:def>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue