Skip to content

Commit

Permalink
WebP support (close ciromattia#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
AcidWeb committed Jul 8, 2018
1 parent a2a405e commit ef4a91e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
3 changes: 2 additions & 1 deletion kindlecomicconverter/comic2ebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,8 @@ def splitDirectory(path):
level = -1
for root, _, files in os.walk(os.path.join(path, 'OEBPS', 'Images')):
for f in files:
if f.endswith('.jpg') or f.endswith('.jpeg') or f.endswith('.png') or f.endswith('.gif'):
if f.endswith('.jpg') or f.endswith('.jpeg') or f.endswith('.png') or f.endswith('.gif') or \
f.endswith('.webp'):
newLevel = os.path.join(root, f).replace(os.path.join(path, 'OEBPS', 'Images'), '').count(os.sep)
if level != -1 and level != newLevel:
level = 0
Expand Down
9 changes: 5 additions & 4 deletions kindlecomicconverter/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def error(self, message):
def getImageFileName(imgfile):
name, ext = os.path.splitext(imgfile)
ext = ext.lower()
if name.startswith('.') or (ext != '.png' and ext != '.jpg' and ext != '.jpeg' and ext != '.gif'):
if name.startswith('.') or (ext != '.png' and ext != '.jpg' and ext != '.jpeg' and ext != '.gif' and
ext != '.webp'):
return None
return [name, ext]

Expand Down Expand Up @@ -146,10 +147,10 @@ def dependencyCheck(level):
missing.append('python-slugify 1.2.1+')
try:
from PIL import __version__ as pillowVersion
if StrictVersion('4.0.0') > StrictVersion(pillowVersion):
missing.append('Pillow 4.0.0+')
if StrictVersion('5.2.0') > StrictVersion(pillowVersion):
missing.append('Pillow 5.2.0+')
except ImportError:
missing.append('Pillow 4.0.0+')
missing.append('Pillow 5.2.0+')
if len(missing) > 0:
print('ERROR: ' + ', '.join(missing) + ' is not installed!')
exit(1)
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PyQt5>=5.6.0
Pillow>=4.0.0
Pillow>=5.2.0
psutil>=5.0.0
python-slugify>=1.2.1
raven>=6.0.0
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def run(self):
packages=['kindlecomicconverter'],
install_requires=[
'PyQt5>=5.6.0',
'Pillow>=4.0.0',
'Pillow>=5.2.0',
'psutil>=5.0.0',
'python-slugify>=1.2.1',
'raven>=6.0.0',
Expand Down

0 comments on commit ef4a91e

Please sign in to comment.