Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Development

Notices

Reply
 
Thread Tools Search this Thread
Old 08-17-2011, 03:31 PM   #1
nickredding
onlinenewsreader.net
nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'
 
Posts: 320
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.
Attached Files
File Type: zip mobi writer2 fixes.zip (11.8 KB, 82 views)
nickredding is offline   Reply With Quote
Old 08-17-2011, 05:28 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 26,448
Karma: 5383257
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.
kovidgoyal is offline   Reply With Quote
Old 08-17-2011, 05:49 PM   #3
nickredding
onlinenewsreader.net
nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'
 
Posts: 320
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!
nickredding is offline   Reply With Quote
Old 08-17-2011, 08:42 PM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 26,448
Karma: 5383257
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?
kovidgoyal is offline   Reply With Quote
Old 08-17-2011, 09:19 PM   #5
nickredding
onlinenewsreader.net
nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'
 
Posts: 320
Karma: 10143
Join Date: Dec 2009
Location: Phoenix, AZ & Victoria, BC
Device: Kindle 3, Kindle Fire, IPad3, iPhone4, Playbook, HTC Inspire
Quote:
Originally Posted by kovidgoyal View Post
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?
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.
nickredding is offline   Reply With Quote
Old 08-17-2011, 09:23 PM   #6
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: 38,629
Karma: 19637653
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Aura H2O, Sony PRS-650, Sony PRS-T1, nook STR, iPad 1, iPhone 5
Quote:
Originally Posted by kovidgoyal View Post
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.
How do I specify the new Mobi writer using ebook-convert?
JSWolf is offline   Reply With Quote
Old 08-17-2011, 09:41 PM   #7
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 26,448
Karma: 5383257
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by nickredding View Post
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.
Are you sure they're necessary? Looking at the code, the section offset is set independently of the offset of the first article in the section and the length is set as next_section.offset - section.offset
kovidgoyal is offline   Reply With Quote
Old 08-17-2011, 09:52 PM   #8
nickredding
onlinenewsreader.net
nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'
 
Posts: 320
Karma: 10143
Join Date: Dec 2009
Location: Phoenix, AZ & Victoria, BC
Device: Kindle 3, Kindle Fire, IPad3, iPhone4, Playbook, HTC Inspire
Quote:
Originally Posted by kovidgoyal View Post
Are you sure they're necessary? Looking at the code, the section offset is set independently of the offset of the first article in the section and the length is set as next_section.offset - section.offset
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).
nickredding is offline   Reply With Quote
Old 08-17-2011, 09:53 PM   #9
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 26,448
Karma: 5383257
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Cool, I'll wait.
kovidgoyal is offline   Reply With Quote
Old 08-18-2011, 07:44 PM   #10
nickredding
onlinenewsreader.net
nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'
 
Posts: 320
Karma: 10143
Join Date: Dec 2009
Location: Phoenix, AZ & Victoria, BC
Device: Kindle 3, Kindle Fire, IPad3, iPhone4, Playbook, HTC Inspire
Quote:
Originally Posted by JSWolf View Post
How do I specify the new Mobi writer using ebook-convert?
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 07:48 PM.
nickredding is offline   Reply With Quote
Old 08-18-2011, 07:46 PM   #11
nickredding
onlinenewsreader.net
nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'
 
Posts: 320
Karma: 10143
Join Date: Dec 2009
Location: Phoenix, AZ & Victoria, BC
Device: Kindle 3, Kindle Fire, IPad3, iPhone4, Playbook, HTC Inspire
Quote:
Originally Posted by kovidgoyal View Post
Cool, I'll wait.
Here it is. I found and corrected the TBS boundary condition (the code comment explains what the change to TBS type 3 is)
Attached Files
File Type: zip mobi writer2 fixes v2.zip (11.6 KB, 63 views)

Last edited by nickredding; 08-18-2011 at 07:51 PM.
nickredding is offline   Reply With Quote
Old 08-18-2011, 08:22 PM   #12
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 26,448
Karma: 5383257
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 08:29 PM.
kovidgoyal is offline   Reply With Quote
Old 08-18-2011, 08:39 PM   #13
nickredding
onlinenewsreader.net
nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'nickredding knows the difference between 'who' and 'whom'
 
Posts: 320
Karma: 10143
Join Date: Dec 2009
Location: Phoenix, AZ & Victoria, BC
Device: Kindle 3, Kindle Fire, IPad3, iPhone4, Playbook, HTC Inspire
Quote:
Originally Posted by kovidgoyal View Post
The i == len(sections) - 1 is redundant, correct, since if i != len(sections) - 1 then next_sect would not be None?
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 08:42 PM.
nickredding is offline   Reply With Quote
Old 08-18-2011, 08:46 PM   #14
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 26,448
Karma: 5383257
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.
kovidgoyal is offline   Reply With Quote
Old 08-18-2011, 08:54 PM   #15
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 26,448
Karma: 5383257
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?
kovidgoyal is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem downloading articles... DarkElf Recipes 0 04-21-2011 07:57 AM
Show articles only, hide sections sjk9 Recipes 1 04-11-2011 12:04 PM
(another) FIX: New York Times Missing Articles bcollier Recipes 11 02-11-2011 04:16 PM
Help me fix my problem....$25 bonus roland1919 Sony Reader 13 05-16-2008 05:37 AM
FB2 problem in V3. How to fix it. reycat HanLin eBook 2 02-18-2008 04:18 PM


All times are GMT -4. The time now is 08:52 PM.


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