From 9ec911c8d7d2fe91eaf537c510c12a83118b9440 Mon Sep 17 00:00:00 2001 From: John Schember Date: Sat, 20 Feb 2010 17:17:18 -0500 Subject: [PATCH 1/2] Fix bug #4961: eReader conversion error. --- src/calibre/ebooks/pml/pmlml.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/ebooks/pml/pmlml.py b/src/calibre/ebooks/pml/pmlml.py index d57ed136f6..3df24fcc86 100644 --- a/src/calibre/ebooks/pml/pmlml.py +++ b/src/calibre/ebooks/pml/pmlml.py @@ -131,7 +131,7 @@ class PMLMLizer(object): if item.href in self.link_hrefs.keys(): toc.append('* \\q="#%s"%s\\q\n' % (self.link_hrefs[item.href], item.title)) else: - self.oeb.warn('Ignoring toc item: %s not found in document.' % item) + self.oeb_book.warn('Ignoring toc item: %s not found in document.' % item) return ''.join(toc) def get_text(self): From 16cd03b17cd82e9f4336bb6856a8d09e8d211867 Mon Sep 17 00:00:00 2001 From: John Schember Date: Sat, 20 Feb 2010 17:29:56 -0500 Subject: [PATCH 2/2] Fix Bug #4959: PML import doesn't add images to PMLZ file. --- src/calibre/customize/builtins.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/calibre/customize/builtins.py b/src/calibre/customize/builtins.py index 040f28549e..5a3a209f5c 100644 --- a/src/calibre/customize/builtins.py +++ b/src/calibre/customize/builtins.py @@ -70,9 +70,10 @@ class PML2PMLZ(FileTypePlugin): pmlz = zipfile.ZipFile(of.name, 'w') pmlz.write(pmlfile, os.path.basename(pmlfile)) - pml_img = os.path.basename(pmlfile)[0] + '_img' - img_dir = pml_img if os.path.exists(pml_img) else 'images' if \ - os.path.exists('images') else '' + pml_img = os.path.splitext(pmlfile)[0] + '_img' + i_img = os.path.join(os.path.dirname(pmlfile),'images') + img_dir = pml_img if os.path.isdir(pml_img) else i_img if \ + os.path.isdir(i_img) else '' if img_dir: for image in glob.glob(os.path.join(img_dir, '*.png')): pmlz.write(image, os.path.join('images', (os.path.basename(image))))