| 
			
			 | 
		#1081 | 
| 
			
			
			
			 but forgot what it's like 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 741 
				Karma: 2345678 
				Join Date: Dec 2011 
				Location: north (by northwest) 
				
				
				Device: Kindle Touch 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			So I just was telling you what you already knew and was planning to use. Sorry for noise. Nice work with tagging!
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#1082 | ||
| 
			
			
			
			 Groupie 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 195 
				Karma: 42216 
				Join Date: Oct 2013 
				Location: Poland 
				
				
				Device: Kindles: KOA1, KV 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 Quote: 
	
  
		 | 
||
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| Advert | |
| 
         | 
    
| 
			
			 | 
		#1083 | |
| 
			
			
			
			 but forgot what it's like 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 741 
				Karma: 2345678 
				Join Date: Dec 2011 
				Location: north (by northwest) 
				
				
				Device: Kindle Touch 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#1084 | 
| 
			
			
			
			 Connoisseur 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 80 
				Karma: 500000 
				Join Date: Oct 2011 
				Location: Utah 
				
				
				Device: iPad 
				
				
				 | 
	
	|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#1085 | 
| 
			
			
			
			 Connoisseur 
			
			![]() Posts: 94 
				Karma: 10 
				Join Date: Feb 2014 
				Location: Japan 
				
				
				Device: Kindle PaperWhite, Kobo Aura HD 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Hi Kevin, 
		
	
		
		
			I have fixed a bug in the python2and3 branch on the github. In addition, I have modified to make eaier to compare the unpacked results by python 2 and python 3. Take care,  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| Advert | |
| 
         | 
    
| 
			
			 | 
		#1086 | 
| 
			
			
			
			 Sigil Developer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,072 
				Karma: 6361556 
				Join Date: Nov 2009 
				
				
				
				Device: many 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Hi tkeo, 
		
	
		
		
		
		
		
		
		
		
		
		
		
			Do we really need to overwrite all dictionaries with ordered dictionaries? I would prefer we explicitly use ordered dicts only where needed (and none are actually truly needed here ... ). If you have some justification as to why you need an ordered dict then import it as something other than dict and use it only where needed explicitly. Also, the flake8 style checks require a space after the "#" for comments. Better yet simply delete those extra HtmlParser related lines since the compatibility_utils unescapeit removes their use completely. If you can fix both of these and have a github account, please create a fork and pull request, so that you get the proper credit in the history. Thanks, Kevin Last edited by KevinH; 10-25-2014 at 04:11 PM. Reason: updated now that I understand that dict() is a builtin for a normal dictionary  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#1087 | ||
| 
			
			
			
			 Connoisseur 
			
			![]() Posts: 94 
				Karma: 10 
				Join Date: Feb 2014 
				Location: Japan 
				
				
				Device: Kindle PaperWhite, Kobo Aura HD 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Hi Kevin, 
		
	
		
		
			Quote: 
	
 So, could you change dict to OrderedDict if acceptable for you? BTW, are there any case that keeping the oders of data in a mobi helps to understand the functionality of kindlegen better? Quote: 
	
 Thanks,  | 
||
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#1088 | |
| 
			
			
			
			 Sigil Developer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,072 
				Karma: 6361556 
				Join Date: Nov 2009 
				
				
				
				Device: many 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Hi tkeo, 
		
	
		
		
		
		
		
		
		
		
		
		
		
			Do you understand that no xml parser guarantees order of attributes? The order of attributes simply does not matter when recreating the opf. As for dumping the header, both DumpMobiHeader.py and the dump code in unpack will show you the order of the header values, the exth, and all of the sections themselves if you enable debug. So neither of your use cases makes any sense. Using an ordered dict to maintain order when no xml parser needs it just hurts execution time meaninglessly. An ordered dict actually requires a normal dict plus a doubly linked list, plus a second ordered dict to quickly find elements in the doubly linked list. All of that in unneccessary overhead for something that does not matter to any xml processor. So I will not integrate an ordered dict patch unless you can explain why it is truly needed. If it is only so you can diff things, then incorporate its use into a DEBUG setting to enable it only when DEBUG is true, otherwise use normal dictionaries. Hope this better explains things. KevinH ps. I have committed your bug fix for removal of HTMLParser Quote: 
	
 Last edited by KevinH; 10-26-2014 at 01:45 PM.  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#1089 | |
| 
			
			
			
			 Connoisseur 
			
			![]() Posts: 94 
				Karma: 10 
				Join Date: Feb 2014 
				Location: Japan 
				
				
				Device: Kindle PaperWhite, Kobo Aura HD 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Hi Kevin, 
		
	
		
		
		
		
		
		
		
		
		
		
	
	Quote: 
	
 Thanks,  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#1090 | 
| 
			
			
			
			 Grand Sorcerer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,891 
				Karma: 207182180 
				Join Date: Jan 2010 
				
				
				
				Device: Nexus 7, Kindle Fire HD 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			@tkeo and/or KevinH: 
		
	
		
		
		
		
		
		
		
		
		
		
	
	Got an error report over in the plugin thread that I could use more eyes on. I'm not up to speed on all the newer epub3 processing code and this appears to have something to do with a KeyError in the processRefinesMetadata portion of mobi_opf.py. Thanks. https://www.mobileread.com/forums/sho...&postcount=281  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#1091 | 
| 
			
			
			
			 Sigil Developer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,072 
				Karma: 6361556 
				Join Date: Nov 2009 
				
				
				
				Device: many 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Hi DiapDealer, 
		
	
		
		
		
		
		
		
		
		
		
		
	
	Yes, this is a bug. It only happens using the Furigana related Exth values that are only generated by Japanese versions of kindlegen. The bug in this case only happens when the book is an epub 2 book, and not an epub 3. I would guess we have never tested this case before ;-). We should check if the key is in the metadata under epub 2 just like we do when it is an epub3. Here is the original problem code in mobi_opf.py (starting at line 605) Code: 
	        if create_refines_metadata:
            for [EXTH, id, attrib, defaultid] in refines_list:
                if self.target_epubver == '3':
                    for i, value in id.items():
                        attrib[i] = ' id="%s"' % value
                    if EXTH in metadata.keys():
                        if len(metadata[EXTH]) == 1 and len(id) == 1:
                            self.createMetaTag(self.exth_solved_refines_metadata, 'file-as', metadata[EXTH][0], id[0])
                        else:
                            for i, value in enumerate(metadata[EXTH]):
                                self.createMetaTag(self.exth_refines_metadata, 'file-as', value, id.get(i, defaultid))
                else:
                    if len(metadata[EXTH]) == 1 and len(id) == 1:
                        attr = ' opf:file-as="%s"' % metadata[EXTH][0]
                        attrib[0] = attr
                    else:
                        for i, value in enumerate(metadata[EXTH]):
                            attr = ' id="#%s" opf:file-as="%s"\n' % (id.get(i, defaultid), value)
                            self.extra_attributes.append(attr)
Code: 
	        if create_refines_metadata:
            for [EXTH, id, attrib, defaultid] in refines_list:
                if self.target_epubver == '3':
                    for i, value in id.items():
                        attrib[i] = ' id="%s"' % value
                    if EXTH in metadata.keys():
                        if len(metadata[EXTH]) == 1 and len(id) == 1:
                            self.createMetaTag(self.exth_solved_refines_metadata, 'file-as', metadata[EXTH][0], id[0])
                        else:
                            for i, value in enumerate(metadata[EXTH]):
                                self.createMetaTag(self.exth_refines_metadata, 'file-as', value, id.get(i, defaultid))
                else:
                    if EXTH in metadata.keys():
                        if len(metadata[EXTH]) == 1 and len(id) == 1:
                            attr = ' opf:file-as="%s"' % metadata[EXTH][0]
                            attrib[0] = attr
                        else:
                            for i, value in enumerate(metadata[EXTH]):
                                attr = ' id="#%s" opf:file-as="%s"\n' % (id.get(i, defaultid), value)
                                self.extra_attributes.append(attr)
Please ask the reporter to give that change a try. If it works, I will commit it to the tree and its equivalent to the python2and3 branch as well. Hope this does the trick. KevinH  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#1092 | 
| 
			
			
			
			 Grand Sorcerer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,891 
				Karma: 207182180 
				Join Date: Jan 2010 
				
				
				
				Device: Nexus 7, Kindle Fire HD 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Thanks Kevin. I'm going to try to get a test version of the plugin (with those changes) to the reporter sometime later today.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#1093 | |
| 
			
			
			
			 Connoisseur 
			
			![]() Posts: 94 
				Karma: 10 
				Join Date: Feb 2014 
				Location: Japan 
				
				
				Device: Kindle PaperWhite, Kobo Aura HD 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Hi Kevin, 
		
	
		
		
		
		
		
		
		
		
		
		
	
	Thank you for your quick support. Yes. It is a bug. I think have made it. Correction. Quote: 
	
 Thanks,  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#1094 | 
| 
			
			
			
			 Connoisseur 
			
			![]() Posts: 94 
				Karma: 10 
				Join Date: Feb 2014 
				Location: Japan 
				
				
				Device: Kindle PaperWhite, Kobo Aura HD 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Hi, 
		
	
		
		
		
		
		
		
		
		
		
		
	
	In "auto" mode, an ebook should be converted to epub3 if Furigana relating EXTH exist in it since it requires "refines" attributes. I will modify mobi_opf.py to do so, after the bug fix is commited. Thanks,  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#1095 | 
| 
			
			
			
			 Grand Sorcerer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,891 
				Karma: 207182180 
				Join Date: Jan 2010 
				
				
				
				Device: Nexus 7, Kindle Fire HD 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			That indeed, seemed to work for the azw3 the user was having trouble with. Thanks.
		 
		
	
		
		
		
		
		
		
		
		
		
		
		
			Last edited by DiapDealer; 10-30-2014 at 10:24 AM.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
![]()  | 
            
        
            
            
  | 
    
			 
			Similar Threads
		 | 
	||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| Can i rotate text and insert images in Mobi and EPUB? | JanGLi | Kindle Formats | 5 | 02-02-2013 05:16 PM | 
| PDF to Mobi with text and images | pocketsprocket | Kindle Formats | 7 | 05-21-2012 08:06 AM | 
| Mobi files - images | DWC | Introduce Yourself | 5 | 07-06-2011 02:43 AM | 
| pdf to mobi... creating images rather than text | Dumhed | Calibre | 5 | 11-06-2010 01:08 PM | 
| Transfer of images on text files | anirudh215 | 2 | 06-22-2009 10:28 AM | |