mirror of
				https://github.com/kovidgoyal/calibre.git
				synced 2025-11-03 19:17:02 -05:00 
			
		
		
		
	MOBI Input: Fix regression that broke detection of covers in MOBI files when converting
This commit is contained in:
		
							parent
							
								
									5fbb2bae5c
								
							
						
					
					
						commit
						6febcf3558
					
				@ -619,6 +619,7 @@ class MobiReader(object):
 | 
				
			|||||||
                opf.cover = None
 | 
					                opf.cover = None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        cover = opf.cover
 | 
					        cover = opf.cover
 | 
				
			||||||
 | 
					        cover_copied = None
 | 
				
			||||||
        if cover is not None:
 | 
					        if cover is not None:
 | 
				
			||||||
            cover = cover.replace('/', os.sep)
 | 
					            cover = cover.replace('/', os.sep)
 | 
				
			||||||
            if os.path.exists(cover):
 | 
					            if os.path.exists(cover):
 | 
				
			||||||
@ -626,13 +627,19 @@ class MobiReader(object):
 | 
				
			|||||||
                if os.path.exists(ncover):
 | 
					                if os.path.exists(ncover):
 | 
				
			||||||
                    os.remove(ncover)
 | 
					                    os.remove(ncover)
 | 
				
			||||||
                shutil.copyfile(cover, ncover)
 | 
					                shutil.copyfile(cover, ncover)
 | 
				
			||||||
 | 
					                cover_copied = os.path.abspath(ncover)
 | 
				
			||||||
            opf.cover = ncover.replace(os.sep, '/')
 | 
					            opf.cover = ncover.replace(os.sep, '/')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        manifest = [(htmlfile, 'application/xhtml+xml'),
 | 
					        manifest = [(htmlfile, 'application/xhtml+xml'),
 | 
				
			||||||
            (os.path.abspath('styles.css'), 'text/css')]
 | 
					            (os.path.abspath('styles.css'), 'text/css')]
 | 
				
			||||||
        bp = os.path.dirname(htmlfile)
 | 
					        bp = os.path.dirname(htmlfile)
 | 
				
			||||||
 | 
					        added = set([])
 | 
				
			||||||
        for i in getattr(self, 'image_names', []):
 | 
					        for i in getattr(self, 'image_names', []):
 | 
				
			||||||
            manifest.append((os.path.join(bp, 'images/', i), 'image/jpeg'))
 | 
					            path = os.path.join(bp, 'images', i)
 | 
				
			||||||
 | 
					            added.add(path)
 | 
				
			||||||
 | 
					            manifest.append((path, 'image/jpeg'))
 | 
				
			||||||
 | 
					        if cover_copied is not None:
 | 
				
			||||||
 | 
					            manifest.append((cover_copied, 'image/jpeg'))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        opf.create_manifest(manifest)
 | 
					        opf.create_manifest(manifest)
 | 
				
			||||||
        opf.create_spine([os.path.basename(htmlfile)])
 | 
					        opf.create_spine([os.path.basename(htmlfile)])
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user