mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix Bug #4959: PML import doesn't add images to PMLZ file.
This commit is contained in:
parent
9ec911c8d7
commit
16cd03b17c
@ -70,9 +70,10 @@ class PML2PMLZ(FileTypePlugin):
|
|||||||
pmlz = zipfile.ZipFile(of.name, 'w')
|
pmlz = zipfile.ZipFile(of.name, 'w')
|
||||||
pmlz.write(pmlfile, os.path.basename(pmlfile))
|
pmlz.write(pmlfile, os.path.basename(pmlfile))
|
||||||
|
|
||||||
pml_img = os.path.basename(pmlfile)[0] + '_img'
|
pml_img = os.path.splitext(pmlfile)[0] + '_img'
|
||||||
img_dir = pml_img if os.path.exists(pml_img) else 'images' if \
|
i_img = os.path.join(os.path.dirname(pmlfile),'images')
|
||||||
os.path.exists('images') else ''
|
img_dir = pml_img if os.path.isdir(pml_img) else i_img if \
|
||||||
|
os.path.isdir(i_img) else ''
|
||||||
if img_dir:
|
if img_dir:
|
||||||
for image in glob.glob(os.path.join(img_dir, '*.png')):
|
for image in glob.glob(os.path.join(img_dir, '*.png')):
|
||||||
pmlz.write(image, os.path.join('images', (os.path.basename(image))))
|
pmlz.write(image, os.path.join('images', (os.path.basename(image))))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user