Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 09-29-2014, 08:32 PM   #16
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,637
Karma: 5433388
Join Date: Nov 2009
Device: many
Hi JSWolf,

I decided it was better to fix this in mobi_header.py alongside where we fixed the same problem with CoverOffset values.

So I have attached a new mobi_header.py.zip. Use it to replace its namesake in kindleunpack/lib/ inside KindleImport and in KindleUnpack_v0.75/lib/ as well. Be careful to zip up the KindleImport zip exactly as it had been so that it still works as a plugin.

If it works, please let me know and I will add it for the next KindleUnpack release.

Thanks,

Kevin


Quote:
Originally Posted by JSWolf View Post
Yes, you are correct about ThumbOffset being 0xffffffff. I'm ready to run your test version of mobi_opf.py when you are ready to get it to me.
Attached Files
File Type: zip mobi_header.py.zip (7.4 KB, 548 views)
KevinH is offline   Reply With Quote
Old 09-29-2014, 10:36 PM   #17
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,897
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
OK, I've tried the test version of mobi_header.py and it didn't work. Different error this time.

Code:
Status: failed

Traceback (most recent call last):
  File "C:\Program Files\Sigil\plugin_launchers\\python\launcher.py", line 137, in launch
    self.exitcode = target_script.run(container)
  File "C:\Users\Jon\AppData\Local\sigil-ebook\sigil\plugins\KindleImport\plugin.py", line 113, in run
    epub = qe.makeEPUB()
  File "C:\Users\Jon\AppData\Local\sigil-ebook\sigil\plugins\KindleImport\quickepub.py", line 51, in makeEPUB
    xhtmlstr, css, cssname = ml2html.processml()
  File "C:\Users\Jon\AppData\Local\sigil-ebook\sigil\plugins\KindleImport\mobiml2xhtml.py", line 219, in processml
    htmlstr += self.processtag(taginfo)
  File "C:\Users\Jon\AppData\Local\sigil-ebook\sigil\plugins\KindleImport\mobiml2xhtml.py", line 445, in processtag
    styles.append('font-size: %s' % size_to_em_map[sz])
KeyError: 'normal'
Error: 'normal'
JSWolf is offline   Reply With Quote
Advert
Old 09-29-2014, 11:02 PM   #18
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,547
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Actually, it looks like Kevin's fix worked on the KindleUnpack side of things. Your new error is squarely back in the hands of my KindleImport plugin. I'll try to take a peek tomorrow. I know I should stop being surprised by what finds its way into mobi markup, but ... dang! A font size attribute value of "normal"? That's a new one on me.
DiapDealer is offline   Reply With Quote
Old 09-30-2014, 05:44 AM   #19
poxalew
Junior Member
poxalew can program the VCR without an owner's manual.poxalew can program the VCR without an owner's manual.poxalew can program the VCR without an owner's manual.poxalew can program the VCR without an owner's manual.poxalew can program the VCR without an owner's manual.poxalew can program the VCR without an owner's manual.poxalew can program the VCR without an owner's manual.poxalew can program the VCR without an owner's manual.poxalew can program the VCR without an owner's manual.poxalew can program the VCR without an owner's manual.poxalew can program the VCR without an owner's manual.
 
Posts: 9
Karma: 166666
Join Date: Aug 2014
Device: Kindle PW2
Ugh. It's most likely produced by CSS flattening tools--I've seen many big-name publisher stylesheets sporting "font-size: normal;" stanzas. And since some seem to run a preprocessor on the source markup before feeding it to kindlegen, it infects the output as well. kindlegen does warn about this, but allows it through regardless, and people ignore warnings when they seem to cause no ill effects at first. Arguably a kindlegen bug, but, well...

Incidentally, you might want to prepare yourself for "vertical-align: sup" instead of "super" as well
poxalew is offline   Reply With Quote
Old 09-30-2014, 07:09 AM   #20
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,547
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by poxalew View Post
Incidentally, you might want to prepare yourself for "vertical-align: sup" instead of "super" as well
"Invalid" attributes won't disturb me that much, most of the time. That one won't "break" the import.

I'm not trying to fix everything prior to opening in Sigil. But the <font> tags (in mobi-only, html 3.2ish markup) were one thing I wanted to try to "fix up" (since it's so prevalent). I'll just have to make allowances for size attribute values other than [+/-]1-7, and x[x[x]]-small|medium|large.

Getting some of those messy mobis (non-KF8) open in Sigil isn't going to be doing users any huge favors in some cases. They're still going to have their work cut out for them getting them cleaned up.

Last edited by DiapDealer; 09-30-2014 at 07:12 AM.
DiapDealer is offline   Reply With Quote
Advert
Old 09-30-2014, 09:49 AM   #21
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,547
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
@KevinH

Unrelated to (and regardless of) what I decide to do for the newly opened epub's temporary name, I think we need to examine KindleUnpack's file naming methods for mobi-only kindlebooks. We're technically creating invalid OPF/NCX files whenever the original file name has an ampersand in it. Which means I'm, in turn, creating an invalid container.xml file when trying to man-handle KindleUnpack's output into an epub structure with this plugin.

It's either that, or I need to sanitize all filenames with my plugin (when unpacking mobi-only kindlebooks) and replace all references to them in all the KindelUnpack-produced files with those sanitized versions. A thought I don't really relish, needless to say.

The KF8 portions of Kindlebooks, don't suffer this file naming "problem."

Last edited by DiapDealer; 09-30-2014 at 09:51 AM.
DiapDealer is offline   Reply With Quote
Old 09-30-2014, 10:27 AM   #22
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,637
Karma: 5433388
Join Date: Nov 2009
Device: many
Hi DiapDealer's,

Yes, I am never a fan of using titles as file names because of all that nonsense. I will go grab a file name sanitizer routine. Also, I agree with you in changing the base name of the file to match what we do with KF8 to prevent these difficulties in the first place.

Feel free to fix those in KindleUnpack any way you like (as well as any other related changes you need) and I will add them to the next KindleUnpack release to keep things in sync.

Thanks,

KevinH


Quote:
Originally Posted by DiapDealer View Post
@KevinH

Unrelated to (and regardless of) what I decide to do for the newly opened epub's temporary name, I think we need to examine KindleUnpack's file naming methods for mobi-only kindlebooks. We're technically creating invalid OPF/NCX files whenever the original file name has an ampersand in it. Which means I'm, in turn, creating an invalid container.xml file when trying to man-handle KindleUnpack's output into an epub structure with this plugin.

It's either that, or I need to sanitize all filenames with my plugin (when unpacking mobi-only kindlebooks) and replace all references to them in all the KindelUnpack-produced files with those sanitized versions. A thought I don't really relish, needless to say.

The KF8 portions of Kindlebooks, don't suffer this file naming "problem."
KevinH is offline   Reply With Quote
Old 09-30-2014, 03:01 PM   #23
varlog
actually it is /var/log
varlog ought to be getting tired of karma fortunes by now.varlog ought to be getting tired of karma fortunes by now.varlog ought to be getting tired of karma fortunes by now.varlog ought to be getting tired of karma fortunes by now.varlog ought to be getting tired of karma fortunes by now.varlog ought to be getting tired of karma fortunes by now.varlog ought to be getting tired of karma fortunes by now.varlog ought to be getting tired of karma fortunes by now.varlog ought to be getting tired of karma fortunes by now.varlog ought to be getting tired of karma fortunes by now.varlog ought to be getting tired of karma fortunes by now.
 
varlog's Avatar
 
Posts: 341
Karma: 2994236
Join Date: Sep 2012
Location: usually Europa
Device: prs t1
Quote:
Originally Posted by KevinH View Post
You do realize that you are talking about naming a temporary file that will be needed to have save-as done on it once it makes it to Sigil, right?
Yes, I do. I even wrote patch to make Sigil propose "Save As" instead of "Save" in those cases - alas: user-none didn't like it .

Quote:
Yes, running it through a file cleaning routine is indeed possible and KindleUnpack has one I think. Giving it the same basename as the original file might in fact be easier to do since no file name cleaning routine would be needed at all since a valid base name has to exist.
I would just like to get meaningful file name proposed by Sigil on the fly.
Original file name would be second choice for me. This would be in most cases unique but not necessarily meaningful. Both of them would be optimal but, as I've mentioned, somehow overkill.
varlog is offline   Reply With Quote
Old 09-30-2014, 03:29 PM   #24
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,897
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Before you get your proper filename, I'd just like to get the eBook.
JSWolf is offline   Reply With Quote
Old 09-30-2014, 04:04 PM   #25
varlog
actually it is /var/log
varlog ought to be getting tired of karma fortunes by now.varlog ought to be getting tired of karma fortunes by now.varlog ought to be getting tired of karma fortunes by now.varlog ought to be getting tired of karma fortunes by now.varlog ought to be getting tired of karma fortunes by now.varlog ought to be getting tired of karma fortunes by now.varlog ought to be getting tired of karma fortunes by now.varlog ought to be getting tired of karma fortunes by now.varlog ought to be getting tired of karma fortunes by now.varlog ought to be getting tired of karma fortunes by now.varlog ought to be getting tired of karma fortunes by now.
 
varlog's Avatar
 
Posts: 341
Karma: 2994236
Join Date: Sep 2012
Location: usually Europa
Device: prs t1
Quote:
Originally Posted by JSWolf View Post
Before you get your proper filename, I'd just like to get the eBook.
I think you have your ebook already - you just want to have it proper
varlog is offline   Reply With Quote
Old 09-30-2014, 06:57 PM   #26
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,547
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by JSWolf View Post
Before you get your proper filename, I'd just like to get the eBook.
See if the attached beta version gives you any joy, Jon.

@varlog
I'm not convinced that something might not break with the filename experimentation I've done (it's actually incomplete on the KF8 side of things in this beta), but let me know what you think.
Attached Files
File Type: zip KindleImport_v0.1.1beta.zip (78.3 KB, 475 views)
DiapDealer is offline   Reply With Quote
Old 09-30-2014, 08:31 PM   #27
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
Posts: 2,488
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
Quote:
Originally Posted by varlog View Post
Yes, I do. I even wrote patch to make Sigil propose "Save As" instead of "Save" in those cases - alas: user-none didn't like it .
That is correct. You should have been clearer about the reason for the patch. The patch itself would still have been rejected. You shouldn't check for special dir names in the path. The proper solution is to expose a clear_save_name function from MainWindow and have plugin runner call this after loading the book.
user_none is offline   Reply With Quote
Old 09-30-2014, 10:25 PM   #28
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,897
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by DiapDealer View Post
See if the attached beta version gives you any joy, Jon.

@varlog
I'm not convinced that something might not break with the filename experimentation I've done (it's actually incomplete on the KF8 side of things in this beta), but let me know what you think.
Yes it worked. Now, would it be possible to split the HTML at the chapter stops? That would make things much easier to deal with. With the entire eBook as a single HTML males Sigil very slow.
JSWolf is offline   Reply With Quote
Old 09-30-2014, 10:39 PM   #29
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,637
Karma: 5433388
Join Date: Nov 2009
Device: many
Hi,
I think you can insert Sigil split markers using Sigil's find and replace regular expressions and then split the file into all chapters at one time. Since chapter starting points may change formats across ebooks, using a custom regular expression in Sigil is probably the best approach.
KevinH


Quote:
Originally Posted by JSWolf View Post
Yes it worked. Now, would it be possible to split the HTML at the chapter stops? That would make things much easier to deal with. With the entire eBook as a single HTML males Sigil very slow.
KevinH is offline   Reply With Quote
Old 09-30-2014, 11:10 PM   #30
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,547
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by KevinH View Post
Hi,
I think you can insert Sigil split markers using Sigil's find and replace regular expressions and then split the file into all chapters at one time. Since chapter starting points may change formats across ebooks, using a custom regular expression in Sigil is probably the best approach.
KevinH
I agree. My approach with these mobi files is basically doing the bare minimum to get it in an epub-like state (and approximate xhtml-ness wherever possible). There's no getting around the fact that if you want mobis turned into "pretty," well-behaved epubs, you're going to have to get your hands dirty regardless. But if you want something that you can give a quick tweak and then feed right back to kindlegen, this might be the ticket. I'm not trying to make something that can take every ugly-assed mobi anyone throws at it and turn it into a sleek, shiny new epub. I'm trying to make something that can take every ugly-assed mobi thrown at it and not barf on your shoes.
DiapDealer is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
epubcheck plugin for Sigil Doitsu Plugins 502 02-20-2024 06:58 AM
kindlegen plugin for Sigil Doitsu Plugins 169 02-16-2024 06:48 AM
[Plugin] PunctuationSmarten Sigil plugin DiapDealer Plugins 138 07-11-2023 11:22 AM
[Plugin] ePub3-itizer - epub3 output plugin for Sigil KevinH Plugins 435 01-19-2023 09:46 PM
smoothRemove_v010 plugin for Sigil kbanelas Plugins 15 01-27-2017 05:51 PM


All times are GMT -4. The time now is 09:49 PM.


MobileRead.com is a privately owned, operated and funded community.