From 6071352d678fa1ad3dcd73f2c1c932a198a7a4c4 Mon Sep 17 00:00:00 2001 From: Andrey Efremov Date: Sun, 6 Oct 2019 13:28:45 +0700 Subject: [PATCH] FB2 Output: Fix id for PNG images --- src/calibre/ebooks/fb2/fb2ml.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/calibre/ebooks/fb2/fb2ml.py b/src/calibre/ebooks/fb2/fb2ml.py index 10ea49dc64..3a191cd54e 100644 --- a/src/calibre/ebooks/fb2/fb2ml.py +++ b/src/calibre/ebooks/fb2/fb2ml.py @@ -253,9 +253,8 @@ class FB2MLizer(object): if cover_href: # Only write the image tag if it is in the manifest. - if cover_href in self.oeb_book.manifest.hrefs.keys(): - if cover_href not in self.image_hrefs.keys(): - self.image_hrefs[cover_href] = '_%s.jpg' % len(self.image_hrefs.keys()) + if cover_href in self.oeb_book.manifest.hrefs and cover_href not in self.image_hrefs: + self.image_hrefs[cover_href] = 'img_%s' % len(self.image_hrefs) return '' % self.image_hrefs[cover_href] return '' @@ -462,7 +461,7 @@ class FB2MLizer(object): ihref = urlnormalize(page.abshref(elem_tree.attrib['src'])) if ihref in self.oeb_book.manifest.hrefs: if ihref not in self.image_hrefs: - self.image_hrefs[ihref] = '_%s.jpg' % len(self.image_hrefs) + self.image_hrefs[ihref] = 'img_%s' % len(self.image_hrefs) p_txt, p_tag = self.ensure_p() fb2_out += p_txt tags += p_tag