08-17-2011, 02:31 PM | #1 |
onlinenewsreader.net
Posts: 324
Karma: 10143
Join Date: Dec 2009
Location: Phoenix, AZ & Victoria, BC
Device: Kindle 3, Kindle Fire, IPad3, iPhone4, Playbook, HTC Inspire
|
Fix for Kindle 3 problem with Sections and Articles
Kovid
Modified mobi/writer2 files are attached (from last Friday's calibre release). Code changes are identified by comments (# k3 add and # k3 delete). If you are happy with the changes (they were minimal since the MOBI rewrite was a huge improvement over the original) perhaps the writer2 code should become standard in the next release. |
08-17-2011, 04:28 PM | #2 |
creator of calibre
Posts: 43,859
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Thanks, I will merge your changes. I'm not comfortable with making the new writer the default as yet, since it is a complete rewrite and there are likely bugs. I will start a thread asking people to test the new writer (by setting the tweak) after the next release, and once enough testing has been done, I'll make it the default.
|
08-17-2011, 04:49 PM | #3 |
onlinenewsreader.net
Posts: 324
Karma: 10143
Join Date: Dec 2009
Location: Phoenix, AZ & Victoria, BC
Device: Kindle 3, Kindle Fire, IPad3, iPhone4, Playbook, HTC Inspire
|
Good plan, I'll certainly give it a pounding!
|
08-17-2011, 07:42 PM | #4 |
creator of calibre
Posts: 43,859
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
I'm a little confused by the toc type index entries. Since you aren't writing them to the MOBI Index header and you're ignoring them during the creatin of the TBS, why are you generating them at all?
|
08-17-2011, 08:19 PM | #5 |
onlinenewsreader.net
Posts: 324
Karma: 10143
Join Date: Dec 2009
Location: Phoenix, AZ & Victoria, BC
Device: Kindle 3, Kindle Fire, IPad3, iPhone4, Playbook, HTC Inspire
|
Those toc type index entries ensure that the index entries for the sections have an offset and length that includes the inline section TOC that is inserted into the markup. Without them, I believe the index entries for the sections would have an offset at the beginning of the first article in the section, not the TOC, and the section length would not include the TOC.
|
08-17-2011, 08:23 PM | #6 | |
Resident Curmudgeon
Posts: 73,983
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
08-17-2011, 08:41 PM | #7 | |
creator of calibre
Posts: 43,859
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Quote:
|
|
08-17-2011, 08:52 PM | #8 |
onlinenewsreader.net
Posts: 324
Karma: 10143
Join Date: Dec 2009
Location: Phoenix, AZ & Victoria, BC
Device: Kindle 3, Kindle Fire, IPad3, iPhone4, Playbook, HTC Inspire
|
You're right, I just checked it. Since I reset the section urls in the oeb.toc to feed_xx/index.html (from feed_xx/article_0/index.html) and associated them with the beginning of the TOC, we don't need the "toc" index nodes. They were in from an earlier iteration and ended up redundant. However, in running a quick test it looks like I've found a feed where there is still a problem in some parts of the periodical going "back" to the Sections and Articles view, so I'll have to look into that--it maybe a TBS boundary condition I heven't seen before. If you like you can hold off merging the code changes until I've run that down and I'll give you new code files (with the redundant toc index nodes removed).
|
08-17-2011, 08:53 PM | #9 |
creator of calibre
Posts: 43,859
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Cool, I'll wait.
|
08-18-2011, 06:44 PM | #10 |
onlinenewsreader.net
Posts: 324
Karma: 10143
Join Date: Dec 2009
Location: Phoenix, AZ & Victoria, BC
Device: Kindle 3, Kindle Fire, IPad3, iPhone4, Playbook, HTC Inspire
|
Enter new_mobi_writer = True in prefs>tweaks>plugin tweaks and restart calibre
Edit: sorry, I see you are asking about ebook-convert. I don't know the answer. Last edited by nickredding; 08-18-2011 at 06:48 PM. |
08-18-2011, 06:46 PM | #11 |
onlinenewsreader.net
Posts: 324
Karma: 10143
Join Date: Dec 2009
Location: Phoenix, AZ & Victoria, BC
Device: Kindle 3, Kindle Fire, IPad3, iPhone4, Playbook, HTC Inspire
|
Here it is. I found and corrected the TBS boundary condition (the code comment explains what the change to TBS type 3 is)
Last edited by nickredding; 08-18-2011 at 06:51 PM. |
08-18-2011, 07:22 PM | #12 |
creator of calibre
Posts: 43,859
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
The i == len(sections) - 1 is redundant, correct, since if i != len(sections) - 1 then next_sect would not be None?
Last edited by kovidgoyal; 08-18-2011 at 07:29 PM. |
08-18-2011, 07:39 PM | #13 |
onlinenewsreader.net
Posts: 324
Karma: 10143
Join Date: Dec 2009
Location: Phoenix, AZ & Victoria, BC
Device: Kindle 3, Kindle Fire, IPad3, iPhone4, Playbook, HTC Inspire
|
Yes, I agree--I think I was being overly cautious since it's important that the trailing vwi only be issued if the TOC starts at the end of the HTML record and either extends into the next record or ends exactly on the last byte of the HTML record.
Last edited by nickredding; 08-18-2011 at 07:42 PM. |
08-18-2011, 07:46 PM | #14 |
creator of calibre
Posts: 43,859
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Understandable, I just want to simplify that if expression as much as possible as I am particularly bad at grokking complex boolean expressions.
|
08-18-2011, 07:54 PM | #15 |
creator of calibre
Posts: 43,859
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Merged your code with some minor cleanups:
http://bazaar.launchpad.net/~kovid/c.../mobi/writer2/ Incidentally, have you tested a recipe with a single feed, that becomes a "blog" on the Kindle? |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Problem downloading articles... | DarkElf | Recipes | 0 | 04-21-2011 06:57 AM |
Show articles only, hide sections | sjk9 | Recipes | 1 | 04-11-2011 11:04 AM |
(another) FIX: New York Times Missing Articles | bcollier | Recipes | 11 | 02-11-2011 03:16 PM |
Help me fix my problem....$25 bonus | roland1919 | Sony Reader | 13 | 05-16-2008 04:37 AM |
FB2 problem in V3. How to fix it. | reycat | HanLin eBook | 2 | 02-18-2008 03:18 PM |