1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-04-21 05:31:30 +02:00

Enable mobi write support.

This commit is contained in:
2020-04-13 15:25:19 +02:00
parent 32b86ab224
commit a4533957f7
15 changed files with 77 additions and 90 deletions
@@ -46,8 +46,14 @@ class Resources(object):
try:
return func(data)
except Exception:
if 'png' != what(None, data):
ext = what(None, data)
if ext not in ('png', 'gif'):
raise
if ext == 'gif':
with PersistentTemporaryFile(suffix='.gif') as pt:
pt.write(data)
return mobify_image(data)
with PersistentTemporaryFile(suffix='.png') as pt:
pt.write(data)
try: